feat: support set user phone

This commit is contained in:
2025-12-20 14:27:29 +08:00
parent 8e95dada82
commit 0185e51396
5 changed files with 135 additions and 6 deletions

View File

@@ -193,6 +193,15 @@ func (r *Routes) Register(router fiber.Router) {
},
Body[UserBalance]("balance"),
))
r.log.Debugf("Registering route: Post /admin/v1/users/:id/phone -> users.SetPhone")
router.Post("/admin/v1/users/:id/phone"[len(r.Path()):], Func2(
r.users.SetPhone,
func(ctx fiber.Ctx) (*models.User, error) {
v := fiber.Params[int](ctx, "id")
return models.UserQuery.WithContext(ctx).Where(field.NewUnsafeFieldRaw("id = ?", v)).First()
},
Body[UserPhoneForm]("form"),
))
r.log.Info("Successfully registered all routes")
}