add: user accomplished

This commit is contained in:
wwweww
2026-02-27 05:42:13 +08:00
parent 659168fe32
commit a0c720eb2f
90 changed files with 9592 additions and 1180 deletions
+40 -13
View File
@@ -17,18 +17,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.Logger},
[]rest.Route{
{
// 获取用户信息
Method: http.MethodGet,
Path: "/:userId",
Handler: user.GetUserInfoHandler(serverCtx),
},
{
// 修改用户信息
Method: http.MethodPut,
Path: "/:userId",
Handler: user.UpdateUserInfoHandler(serverCtx),
},
{
// 用户登出
Method: http.MethodPost,
@@ -41,6 +29,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/:userId/password",
Handler: user.UpdatePasswordHandler(serverCtx),
},
{
// 修改密码-使用验证码
Method: http.MethodPut,
Path: "/forgot-password/reset",
Handler: user.UpdatePasswordByVcodeHandler(serverCtx),
},
{
// 用户登录接口
Method: http.MethodPost,
@@ -55,6 +49,39 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
}...,
),
rest.WithPrefix("/api/users"),
rest.WithPrefix("/api/v1/auth"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.Logger},
[]rest.Route{
{
// 获取用户信息
Method: http.MethodGet,
Path: "/:userId",
Handler: user.GetUserInfoHandler(serverCtx),
},
{
// 修改用户信息
Method: http.MethodPut,
Path: "/:userId",
Handler: user.UpdateUserInfoHandler(serverCtx),
},
{
// 获取当前登录用户信息
Method: http.MethodGet,
Path: "/me",
Handler: user.GetMeHandler(serverCtx),
},
{
// 更改当前登录用户信息
Method: http.MethodPut,
Path: "/me",
Handler: user.UpdateMeHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1/user"),
)
}