MCPcopy Create free account
hub / github.com/devinterface/startersaas-go-api / Index

Method Index

endpoints/team.endpoint.go:13–31  ·  view source on GitHub ↗
(ctx *fiber.Ctx)

Source from the content-addressed store, hash-verified

11type TeamEndpoint struct{ BaseEndpoint }
12
13func (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(&params)
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
33func (teamEndpoint *TeamEndpoint) ByID(ctx *fiber.Ctx) error {
34 me, _ := userEndpoint.CurrentUser(ctx)

Callers

nothing calls this directly

Calls 4

ShowTeamSerializerFunction · 0.92
CurrentUserMethod · 0.80
CanMethod · 0.80
FindByMethod · 0.45

Tested by

no test coverage detected