feat(07-01): add quick-add HTTP handlers and route registration

- Add ListQuickAddItems, CreateQuickAddItem, UpdateQuickAddItem, DeleteQuickAddItem handler methods
- Register GET/POST /api/quick-add and PUT/DELETE /api/quick-add/{itemId} in authenticated route group
- Validate name non-empty on create and update; return 404 on update when item not found
This commit is contained in:
2026-03-12 13:34:19 +01:00
parent 84d5b76a8a
commit b42f7b13bb
2 changed files with 89 additions and 0 deletions

View File

@@ -70,6 +70,13 @@ func NewRouter(queries *db.Queries, sessionSecret string, frontendFS fs.FS) http
r.Delete("/items/{itemId}", h.DeleteTemplateItem)
})
r.Route("/api/quick-add", func(r chi.Router) {
r.Get("/", h.ListQuickAddItems)
r.Post("/", h.CreateQuickAddItem)
r.Put("/{itemId}", h.UpdateQuickAddItem)
r.Delete("/{itemId}", h.DeleteQuickAddItem)
})
r.Get("/api/settings", h.GetSettings)
r.Put("/api/settings", h.UpdateSettings)
})