package httpapi import ( "net/http" "inbox/internal/base/httpx" ) func (h *Handler) listTopicHumanTasks(w http.ResponseWriter, r *http.Request) { items, err := h.HumanTasks.ListByTopic(r.Context(), r.PathValue("topicID")) if err != nil { writeStoreError(w, err) return } httpx.WriteJSON(w, http.StatusOK, map[string]any{"tasks": items}) } func (h *Handler) answerHumanTask(w http.ResponseWriter, r *http.Request) { type request struct { BodyMarkdown string `json:"body_markdown"` } var req request if err := httpx.DecodeJSON(r, &req); err != nil { httpx.WriteError(w, http.StatusBadRequest, err.Error()) return } item, err := h.HumanTasks.Answer(r.Context(), r.PathValue("taskID"), req.BodyMarkdown) if err != nil { writeStoreError(w, err) return } httpx.WriteJSON(w, http.StatusOK, item) }