chore(repo): reinitialize repository
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user