UpdateMe function
(ctx *fiber.Ctx)
| 38 | |
| 39 | // UpdateMe function |
| 40 | func (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 |
| 58 | func (userEndpoint *UserEndpoint) ChangePassword(ctx *fiber.Ctx) error { |
nothing calls this directly
no test coverage detected