fix
This commit is contained in:
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user