(ctx *fiber.Ctx)
| 11 | type TeamEndpoint struct{ BaseEndpoint } |
| 12 | |
| 13 | func (teamEndpoint *TeamEndpoint) Index(ctx *fiber.Ctx) error { |
| 14 | me, _ := userEndpoint.CurrentUser(ctx) |
| 15 | if can := userEndpoint.Can(ctx, models.AdminRole); !can { |
| 16 | return ctx.Status(401).JSON(fiber.Map{ |
| 17 | "message": "You are not authorized to perform this action", |
| 18 | }) |
| 19 | } |
| 20 | params := bson.M{} |
| 21 | ctx.BodyParser(¶ms) |
| 22 | params["accountId"] = me.AccountID |
| 23 | teams, err := teamService.FindBy(params) |
| 24 | if err != nil { |
| 25 | return ctx.Status(401).JSON(fiber.Map{ |
| 26 | "message": err.Error(), |
| 27 | }) |
| 28 | } |
| 29 | showTeams, _ := models.ShowTeamSerializer().TransformArray(teams) |
| 30 | return ctx.JSON(showTeams) |
| 31 | } |
| 32 | |
| 33 | func (teamEndpoint *TeamEndpoint) ByID(ctx *fiber.Ctx) error { |
| 34 | me, _ := userEndpoint.CurrentUser(ctx) |
nothing calls this directly
no test coverage detected