MCPcopy Create free account
hub / github.com/tbphp/gpt-load / CopyGroup

Method CopyGroup

internal/handler/group_handler.go:395–419  ·  view source on GitHub ↗

CopyGroup handles copying a group with optional content.

(c *gin.Context)

Source from the content-addressed store, hash-verified

393// CopyGroup handles copying a group with optional content.
394
395func (s *Server) CopyGroup(c *gin.Context) {
396 id, err := strconv.Atoi(c.Param("id"))
397 if err != nil {
398 response.ErrorI18nFromAPIError(c, app_errors.ErrBadRequest, "validation.invalid_group_id")
399 return
400 }
401
402 var req GroupCopyRequest
403 if err := c.ShouldBindJSON(&req); err != nil {
404 response.Error(c, app_errors.NewAPIError(app_errors.ErrInvalidJSON, err.Error()))
405 return
406 }
407
408 newGroup, err := s.GroupService.CopyGroup(c.Request.Context(), uint(id), req.CopyKeys)
409 if s.handleGroupError(c, err) {
410 return
411 }
412
413 groupResponse := s.newGroupResponse(newGroup)
414 copyResponse := &GroupCopyResponse{
415 Group: groupResponse,
416 }
417
418 response.Success(c, copyResponse)
419}
420
421// List godoc
422func (s *Server) List(c *gin.Context) {

Callers

nothing calls this directly

Calls 6

handleGroupErrorMethod · 0.95
newGroupResponseMethod · 0.95
ErrorI18nFromAPIErrorFunction · 0.92
ErrorFunction · 0.92
SuccessFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected