AddSubGroups handles adding sub groups to an aggregate group
(c *gin.Context)
| 456 | |
| 457 | // AddSubGroups handles adding sub groups to an aggregate group |
| 458 | func (s *Server) AddSubGroups(c *gin.Context) { |
| 459 | id, err := strconv.Atoi(c.Param("id")) |
| 460 | if err != nil { |
| 461 | response.ErrorI18nFromAPIError(c, app_errors.ErrBadRequest, "validation.invalid_group_id") |
| 462 | return |
| 463 | } |
| 464 | |
| 465 | var req AddSubGroupsRequest |
| 466 | if err := c.ShouldBindJSON(&req); err != nil { |
| 467 | response.Error(c, app_errors.NewAPIError(app_errors.ErrInvalidJSON, err.Error())) |
| 468 | return |
| 469 | } |
| 470 | |
| 471 | if err := s.AggregateGroupService.AddSubGroups(c.Request.Context(), uint(id), req.SubGroups); s.handleGroupError(c, err) { |
| 472 | return |
| 473 | } |
| 474 | |
| 475 | response.SuccessI18n(c, "success.sub_groups_added", nil) |
| 476 | } |
| 477 | |
| 478 | // UpdateSubGroupWeight handles updating the weight of a sub group |
| 479 | func (s *Server) UpdateSubGroupWeight(c *gin.Context) { |
nothing calls this directly
no test coverage detected