first commit
This commit is contained in:
167
apps/gateway/internal/handler/routes.go
Normal file
167
apps/gateway/internal/handler/routes.go
Normal file
@@ -0,0 +1,167 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.7.2
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
auth "tianyuan-api/apps/gateway/internal/handler/auth"
|
||||
base "tianyuan-api/apps/gateway/internal/handler/base"
|
||||
product "tianyuan-api/apps/gateway/internal/handler/product"
|
||||
user "tianyuan-api/apps/gateway/internal/handler/user"
|
||||
userProduct "tianyuan-api/apps/gateway/internal/handler/userProduct"
|
||||
whitelistr "tianyuan-api/apps/gateway/internal/handler/whitelistr"
|
||||
"tianyuan-api/apps/gateway/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/getVerifyCode",
|
||||
Handler: auth.GetVerifyCodeHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/login",
|
||||
Handler: auth.LoginUserHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/logout",
|
||||
Handler: auth.LogoutHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/phoneLogin",
|
||||
Handler: auth.PhoneLoginUserHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/register",
|
||||
Handler: auth.RegisterUserHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/console/auth"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/health",
|
||||
Handler: base.HealthHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/console/base"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/:productId",
|
||||
Handler: product.GetProductByIdHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/list",
|
||||
Handler: product.GetProductListHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/product"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/businessLicenseUpload",
|
||||
Handler: user.UploadBusinessLicenseHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/enterpriseAuth",
|
||||
Handler: user.EnterpriseAuthHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/getSecretInfo",
|
||||
Handler: user.GetSecretInfoHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/info",
|
||||
Handler: user.GetUserInfoHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/user"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/userProductAdd",
|
||||
Handler: userProduct.AddUserProductHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/userProductDel/:id",
|
||||
Handler: userProduct.DeleteUserProductHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/userProductList",
|
||||
Handler: userProduct.GetUserProductListHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/user-product"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/getWhitelistList",
|
||||
Handler: whitelistr.GetWhitelistListHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/whitelist"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.AuthInterceptor, serverCtx.EntAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/addWhitelist",
|
||||
Handler: whitelistr.AddWhitelistHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodDelete,
|
||||
Path: "/delWhitelist",
|
||||
Handler: whitelistr.DeleteWhitelistHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/api/console/whitelist"),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user