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:
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user