feat: add appointment CRUD backend (Phase 1D)

This commit is contained in:
m
2026-03-25 13:32:51 +01:00
3 changed files with 359 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ func New(db *sqlx.DB, authMW *auth.Middleware) http.Handler {
tenantSvc := services.NewTenantService(db)
caseSvc := services.NewCaseService(db)
partySvc := services.NewPartyService(db)
appointmentSvc := services.NewAppointmentService(db)
// Middleware
tenantResolver := auth.NewTenantResolver(tenantSvc)
@@ -26,6 +27,7 @@ func New(db *sqlx.DB, authMW *auth.Middleware) http.Handler {
tenantH := handlers.NewTenantHandler(tenantSvc)
caseH := handlers.NewCaseHandler(caseSvc)
partyH := handlers.NewPartyHandler(partySvc)
apptH := handlers.NewAppointmentHandler(appointmentSvc)
// Public routes
mux.HandleFunc("GET /health", handleHealth(db))
@@ -57,9 +59,14 @@ func New(db *sqlx.DB, authMW *auth.Middleware) http.Handler {
scoped.HandleFunc("PUT /api/parties/{partyId}", partyH.Update)
scoped.HandleFunc("DELETE /api/parties/{partyId}", partyH.Delete)
// Appointments
scoped.HandleFunc("GET /api/appointments", apptH.List)
scoped.HandleFunc("POST /api/appointments", apptH.Create)
scoped.HandleFunc("PUT /api/appointments/{id}", apptH.Update)
scoped.HandleFunc("DELETE /api/appointments/{id}", apptH.Delete)
// Placeholder routes for future phases
scoped.HandleFunc("GET /api/deadlines", placeholder("deadlines"))
scoped.HandleFunc("GET /api/appointments", placeholder("appointments"))
scoped.HandleFunc("GET /api/documents", placeholder("documents"))
// Wire: auth -> tenant routes go directly, scoped routes get tenant resolver