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

Method UpdateMe

endpoints/user.endpoint.go:40–55  ·  view source on GitHub ↗

UpdateMe function

(ctx *fiber.Ctx)

Source from the content-addressed store, hash-verified

38
39// UpdateMe function
40func (userEndpoint *UserEndpoint) UpdateMe(ctx *fiber.Ctx) error {
41 me, _ := userEndpoint.CurrentUser(ctx)
42
43 var inputMap = make(map[string]interface{})
44 ctx.BodyParser(&inputMap)
45
46 v := validate.Map(inputMap)
47 v.StringRule("language", "in:it,en")
48
49 if !v.Validate() {
50 return ctx.Status(422).JSON(v.Errors)
51 }
52 updatedUser, _ := userService.Update(me.GetID(), me.AccountID, inputMap)
53 showUser := models.ShowUserSerializer().Transform(updatedUser)
54 return ctx.JSON(showUser)
55}
56
57// ChangePassword function
58func (userEndpoint *UserEndpoint) ChangePassword(ctx *fiber.Ctx) error {

Callers

nothing calls this directly

Calls 3

ShowUserSerializerFunction · 0.92
CurrentUserMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected