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

Method RemoveUser

endpoints/team.endpoint.go:161–176  ·  view source on GitHub ↗

REmove user function

(ctx *fiber.Ctx)

Source from the content-addressed store, hash-verified

159
160// REmove user function
161func (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}

Callers

nothing calls this directly

Calls 3

ShowTeamSerializerFunction · 0.92
CurrentUserMethod · 0.80
CanMethod · 0.80

Tested by

no test coverage detected