MCPcopy Create free account
hub / github.com/PGshen/thinking-map / UpdateNodeContext

Method UpdateNodeContext

server/internal/handler/node.go:152–196  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

150 })
151}
152func (h *NodeHandler) UpdateNodeContext(c *gin.Context) {
153 nodeID := c.Param("nodeID")
154 if nodeID == "" {
155 c.JSON(http.StatusBadRequest, dto.Response{
156 Code: http.StatusBadRequest,
157 Message: "node ID is required",
158 Data: nil,
159 Timestamp: time.Now(),
160 RequestID: uuid.New().String(),
161 })
162 return
163 }
164
165 var req dto.UpdateNodeContextRequest
166 if err := c.ShouldBindJSON(&req); err != nil {
167 c.JSON(http.StatusBadRequest, dto.Response{
168 Code: http.StatusBadRequest,
169 Message: "invalid request parameters",
170 Data: dto.ErrorData{Error: err.Error()},
171 Timestamp: time.Now(),
172 RequestID: uuid.New().String(),
173 })
174 return
175 }
176
177 resp, err := h.NodeService.UpdateNodeContext(c, nodeID, req)
178 if err != nil {
179 c.JSON(http.StatusInternalServerError, dto.Response{
180 Code: http.StatusInternalServerError,
181 Message: err.Error(),
182 Data: nil,
183 Timestamp: time.Now(),
184 RequestID: uuid.New().String(),
185 })
186 return
187 }
188
189 c.JSON(http.StatusOK, dto.Response{
190 Code: http.StatusOK,
191 Message: "success",
192 Data: resp,
193 Timestamp: time.Now(),
194 RequestID: uuid.New().String(),
195 })
196}
197
198// ResetNodeContext handles resetting a node's context
199func (h *NodeHandler) ResetNodeContext(c *gin.Context) {

Callers

nothing calls this directly

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected