This commit is contained in:
2026-08-17 21:20:45 +02:00
parent 321f11e817
commit 6fcdc74843
157 changed files with 2895 additions and 7544 deletions
@@ -24,6 +24,23 @@ func presentV1Category(item map[string]any) map[string]any {
}
}
// handleV1GetCategory serves GET /api/v1/categories/{id} as the public list DTO
// (no prompts, formulas, or has_prompt). Dashboard GET stays on handleGetCategory.
func (s *Server) handleV1GetCategory(w http.ResponseWriter, r *http.Request) {
cid, _ := CompanyIDFromContext(r.Context())
id, err := uuid.Parse(chi.URLParam(r, "id"))
if err != nil {
Error(w, http.StatusBadRequest, "invalid id")
return
}
item, err := s.Catalog.GetCategory(r.Context(), cid, id)
if err != nil {
Error(w, http.StatusNotFound, "not found")
return
}
v1OK(w, http.StatusOK, presentV1Category(item), nil)
}
func presentV1Attribute(item map[string]any) map[string]any {
out := map[string]any{
"id": item["id"],