REmove user function
(ctx *fiber.Ctx)
| 159 | |
| 160 | // REmove user function |
| 161 | func (teamEndpoint *TeamEndpoint) RemoveUser(ctx *fiber.Ctx) error { |
| 162 | me, _ := userEndpoint.CurrentUser(ctx) |
| 163 | if can := userEndpoint.Can(ctx, models.AdminRole); !can { |
| 164 | return ctx.Status(401).JSON(fiber.Map{ |
| 165 | "message": "You are not authorized to perform this action", |
| 166 | }) |
| 167 | } |
| 168 | team, err := teamService.RemoveUser(ctx.Params("id"), me.AccountID, ctx.Params("userId")) |
| 169 | if err != nil { |
| 170 | return ctx.Status(422).JSON(fiber.Map{ |
| 171 | "message": err.Error(), |
| 172 | }) |
| 173 | } |
| 174 | showTeam := models.ShowTeamSerializer().Transform(team) |
| 175 | return ctx.JSON(showTeam) |
| 176 | } |
nothing calls this directly
no test coverage detected