(items []GroupReorderItemRequest)
| 144 | } |
| 145 | |
| 146 | func validateGroupReorderItems(items []GroupReorderItemRequest) error { |
| 147 | if len(items) == 0 { |
| 148 | return services.NewI18nError(app_errors.ErrValidation, "validation.reorder_items_required", nil) |
| 149 | } |
| 150 | |
| 151 | seen := make(map[uint]struct{}, len(items)) |
| 152 | for _, item := range items { |
| 153 | if item.ID == 0 { |
| 154 | return services.NewI18nError(app_errors.ErrValidation, "validation.reorder_group_id", nil) |
| 155 | } |
| 156 | if item.Sort < 0 { |
| 157 | return services.NewI18nError(app_errors.ErrValidation, "validation.reorder_sort_negative", nil) |
| 158 | } |
| 159 | if _, exists := seen[item.ID]; exists { |
| 160 | return services.NewI18nError(app_errors.ErrValidation, "validation.reorder_duplicate_group", map[string]any{"id": item.ID}) |
| 161 | } |
| 162 | seen[item.ID] = struct{}{} |
| 163 | } |
| 164 | |
| 165 | return nil |
| 166 | } |
| 167 | |
| 168 | // UpdateGroup handles updating an existing group. |
| 169 | func (s *Server) UpdateGroup(c *gin.Context) { |
no test coverage detected