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

Method UpdateSubGroupWeight

internal/handler/group_handler.go:479–503  ·  view source on GitHub ↗

UpdateSubGroupWeight handles updating the weight of a sub group

(c *gin.Context)

Source from the content-addressed store, hash-verified

477
478// UpdateSubGroupWeight handles updating the weight of a sub group
479func (s *Server) UpdateSubGroupWeight(c *gin.Context) {
480 id, err := strconv.Atoi(c.Param("id"))
481 if err != nil {
482 response.ErrorI18nFromAPIError(c, app_errors.ErrBadRequest, "validation.invalid_group_id")
483 return
484 }
485
486 subGroupID, err := strconv.Atoi(c.Param("subGroupId"))
487 if err != nil {
488 response.ErrorI18nFromAPIError(c, app_errors.ErrBadRequest, "validation.invalid_sub_group_id")
489 return
490 }
491
492 var req UpdateSubGroupWeightRequest
493 if err := c.ShouldBindJSON(&req); err != nil {
494 response.Error(c, app_errors.NewAPIError(app_errors.ErrInvalidJSON, err.Error()))
495 return
496 }
497
498 if err := s.AggregateGroupService.UpdateSubGroupWeight(c.Request.Context(), uint(id), uint(subGroupID), req.Weight); s.handleGroupError(c, err) {
499 return
500 }
501
502 response.SuccessI18n(c, "success.sub_group_weight_updated", nil)
503}
504
505// DeleteSubGroup handles deleting a sub group from an aggregate group
506func (s *Server) DeleteSubGroup(c *gin.Context) {

Callers

nothing calls this directly

Calls 5

handleGroupErrorMethod · 0.95
ErrorI18nFromAPIErrorFunction · 0.92
ErrorFunction · 0.92
SuccessI18nFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected