MCPcopy Create free account
hub / github.com/compozy/agh / CreateChildTask

Method CreateChildTask

internal/api/core/tasks.go:838–879  ·  view source on GitHub ↗

CreateChildTask creates one child task beneath the supplied parent.

(c *gin.Context)

Source from the content-addressed store, hash-verified

836
837// CreateChildTask creates one child task beneath the supplied parent.
838func (h *BaseHandlers) CreateChildTask(c *gin.Context) {
839 manager, ok := h.requireTaskManager(c)
840 if !ok {
841 return
842 }
843
844 parentTaskID, err := requiredPathID(c.Param("id"), "task id")
845 if err != nil {
846 h.respondError(c, StatusForTaskError(err), err)
847 return
848 }
849
850 var req contract.CreateTaskChildRequest
851 if err := c.ShouldBindJSON(&req); err != nil {
852 h.respondError(
853 c,
854 http.StatusBadRequest,
855 NewTaskValidationError(fmt.Errorf("%s: decode create child task request: %w", h.transportName(), err)),
856 )
857 return
858 }
859
860 actor, err := h.taskActorContext(c, taskActionCreateChild)
861 if err != nil {
862 h.respondError(c, StatusForTaskError(err), err)
863 return
864 }
865
866 spec, err := h.createChildTaskSpecFromRequest(c.Request.Context(), req)
867 if err != nil {
868 h.respondError(c, StatusForTaskError(err), err)
869 return
870 }
871
872 record, err := manager.CreateChildTask(c.Request.Context(), parentTaskID, spec, actor)
873 if err != nil {
874 h.respondError(c, StatusForTaskError(err), err)
875 return
876 }
877
878 c.JSON(http.StatusCreated, contract.TaskResponse{Task: TaskPayloadFromTask(record)})
879}
880
881// AddTaskDependency adds one blocking dependency edge.
882func (h *BaseHandlers) AddTaskDependency(c *gin.Context) {

Callers

nothing calls this directly

Calls 10

requireTaskManagerMethod · 0.95
respondErrorMethod · 0.95
transportNameMethod · 0.95
taskActorContextMethod · 0.95
requiredPathIDFunction · 0.85
StatusForTaskErrorFunction · 0.85
NewTaskValidationErrorFunction · 0.85
TaskPayloadFromTaskFunction · 0.85
CreateChildTaskMethod · 0.65

Tested by

no test coverage detected