Yeah, the defining domain model is always a challenge and I think depends on the project. In my case, on a project I was working recently, I defined in the shared domain model entities that will go to the outside (eg in the API responses), so I can map various SQL record types to the domain model and only define JSON encoding/decoding for a small subset of data.
But on the backend or in tests, it's usually just fine to use SQL generated types IMO.
Yeah, the defining domain model is always a challenge and I think depends on the project. In my case, on a project I was working recently, I defined in the shared domain model entities that will go to the outside (eg in the API responses), so I can map various SQL record types to the domain model and only define JSON encoding/decoding for a small subset of data.
But on the backend or in tests, it's usually just fine to use SQL generated types IMO.