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

Method ReorderGroups

internal/handler/group_handler.go:221–245  ·  view source on GitHub ↗

ReorderGroups handles batch reorder updates for groups.

(c *gin.Context)

Source from the content-addressed store, hash-verified

219
220// ReorderGroups handles batch reorder updates for groups.
221func (s *Server) ReorderGroups(c *gin.Context) {
222 var req GroupReorderRequest
223 if err := c.ShouldBindJSON(&req); err != nil {
224 response.Error(c, app_errors.NewAPIError(app_errors.ErrInvalidJSON, err.Error()))
225 return
226 }
227
228 if err := validateGroupReorderItems(req.Items); s.handleGroupError(c, err) {
229 return
230 }
231
232 items := make([]services.GroupReorderItem, 0, len(req.Items))
233 for _, item := range req.Items {
234 items = append(items, services.GroupReorderItem{
235 ID: item.ID,
236 Sort: item.Sort,
237 })
238 }
239
240 if s.handleGroupError(c, s.GroupService.ReorderGroups(c.Request.Context(), items)) {
241 return
242 }
243
244 response.SuccessI18n(c, "success.groups_reordered", nil)
245}
246
247// GroupResponse defines the structure for a group response, excluding sensitive or large fields.
248type GroupResponse struct {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected