add: user accomplished
This commit is contained in:
@@ -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"),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user