Currently I don't use Clean architecture principles but I would like to.
I found an example where I can't figure how to implement it using Clean architecture.
Here is the Flow:
- Client send file with HTTP request
- Router handle request and create file on disk
- Router call the converter module with the file path
- Converter module is really complex and do a lot of things:
- Convert file data in other data structure (to do so, it's interacting with domain entities)
- Convertion involve computational methods and a lot of complex parsing
- Extract images contained in this file and save it in the local disk
- Send images to external storage
- Delete images on the disk
- Save whole file to S3
- Send HTTP response to client
I would split this like the following:
-
Interface adapters
- External file storage
- HTTP router
-
use case
- convertFile
-
Domain entities
- File model (handle files as a domain entity? - with methods like create, copy, clean, zip ...)
- outputDataStructure
- Computational models
It seems that the converter module handle a lot of logic, if I represent it as a "use case" all the business logic will be handled here.
Maybe I didn't give enough informations.
Best regards.
via Simon Bruneaud
No comments:
Post a Comment