# Module: Common infrastructure ## Purpose Cross-cutting **filesystem layout** (annotation images, labels, thumbnails, results), **global error JSON**, and trivial shared API types. ## Components ### `PathResolver` (`Services/PathResolver.cs`) - Lazy-loads paths from `directory_settings` via `AppDataConnection`. - Methods: `GetImagePath`, `GetLabelPath`, `GetThumbnailPath`, `GetResultPath`, `GetMediaDir` — paths under configured dirs with `{annotationId}.jpg` / `.txt` patterns. - `Reset()` clears cache after directory settings change. ### `ErrorHandlingMiddleware` (`Middleware/`) Maps exceptions to `{ statusCode, message }` JSON (400/404/409/500). Aligns HTTP outcomes with `01_annotations.md` status tables. ### Shared DTOs (`DTOs/`) - `PaginatedResponse` — list + `totalCount` / `page` / `pageSize` (annotations list, media list, dataset). - `ErrorResponse` — available for explicit error contracts where used. ### `GlobalUsings.cs` Project-wide usings only. ## Dependencies - `PathResolver` → `AppDataConnection`, `DirectorySettings` entity. ## Consumers All services and controllers that touch disk or return paged lists. ## Suite doc File cleanup on DELETE annotation (`GetImgPath` / label / thumb) in `01_annotations.md` §4.