SHEET 03 · DRAWING REGISTER
DETAIL SHEET 03.2 — P-02
Subscription Tracker
Track recurring subscriptions and see your monthly total. Part 1 of the series: a classic layered backend with hand-written SQL.
ControllerREST · validation
DTOsServicetransactions · mapping
entityDAO · JdbcTemplatehand-written SQL
SQLPostgreSQL 16Flyway migrations
SPECIFICATION
- LAYERS
- Controller → service → DAO, each talking only to the one beneath. DTOs at the edge; the entity never leaves the service.
- DATA ACCESS
- Spring JDBC: JdbcTemplate with hand-written, parameterized SQL and RowMappers — no JPA, no Spring Data.
- MIGRATIONS
- Flyway on PostgreSQL 16. V2 replaces a plain unique constraint with a case-insensitive unique index on LOWER(name).
- API
- Code-first OpenAPI with springdoc and Swagger UI; versioned under /api/v1, Bean Validation at the edge.
- ERRORS
- RFC 9457 problem details (400, 404, 409) from one exception handler; unexpected errors get a generic message, never the exception text.
- TESTING
- 63 tests, written test-first: unit, web slice, DAO integration and end-to-end against a real PostgreSQL on Testcontainers; JaCoCo coverage.
- 2end-to-end on Testcontainers
- 22DAO integration
- 25web slice
- 14unit
REV. NOTE Names are unique regardless of case — enforced by a case-insensitive unique index, not just in code.