The scenario:
- infrastructure/
├── dtos/
│ ├── note_dto
│ ├── todo_dto
│ └── note_preview_dto <-- includes 3-5 previewTodos from database
│ ***NotePreview needs this data***
└── repositories/
└── implementations
- domain/
├── entities/
│ ├── note <-- Entity (Pure, no previewTodos)
│ └── todo
└── repositories/
├── note_repository <-- abstract, doesn't know about previews
└── todo_repository
- application/
└── models/
└── note_preview <-- View-specific (not business rule - UI needs this)
***Needs previewTodos + Note***
- presentation/
└── home/
└── home_screen
└── uses NotePreview
- The repository interface lives in domain/ and returns pure
Note. - The
NotePreviewlives in application/ and needs preview data (previewTodos). - The
NotePreviewDTOwith previewTodos lives in infrastructure/.
- Domain can’t depend on Application or Infrastructure.
- Application needs previewTodos, but only Infrastructure sees them.
How can the application layer construct NotePreview using preview data from NotePreviewDto, if the repository interface (in domain) can't expose it, and the domain doesn't know anything about previews?