There is a problem with Dto's background. Soy new, for favor ayuda :))

I have my Product entity and IProductService in my Domain layer. The problem is that by implementing ProductService in my Application layer, I need to return the DTO that is in Application as well. How do I make the IProductoService method found in Domain return a DTO if it is in the Application layer? This is the ProductService method where I need to return the DTO.
12 Replies
peladodocinero
peladodocineroOP8mo ago
In this layer: I have the Interface for ProductService
No description
peladodocinero
peladodocineroOP8mo ago
That returns a Producto. But I want to return a ProductoDto (who is n application leyer)
No description
peladodocinero
peladodocineroOP8mo ago
And this is the Application Layer
No description
peladodocinero
peladodocineroOP8mo ago
Obviously generate an error, because that returns a ProductDto
No description
peladodocinero
peladodocineroOP8mo ago
This is a basic architecture error
Jimmacle
Jimmacle8mo ago
with this architecture you'd need domain models for the service to use and map that to DTOs in the application layer
peladodocinero
peladodocineroOP8mo ago
but if the service is in the application layer
Jimmacle
Jimmacle8mo ago
but the interface isn't the domain can't know about any higher layers is there a reason you're doing clean architecture? this is one of its flaws, excessive boilerplate consider $vsa
peladodocinero
peladodocineroOP8mo ago
For practice so the repositoryInterface and service Interface, where do I have to put them?
Jimmacle
Jimmacle8mo ago
¯\_(ツ)_/¯ i don't use this architecture for this exact reason "where do i put this" isn't a question that should take much effort
peladodocinero
peladodocineroOP8mo ago
:// It's for a tecnical interview
Want results from more Discord servers?
Add your server