158 lines
3.7 KiB
Go

// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
package handler
import (
"net/http"
auth "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/auth"
common "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/common"
order "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/order"
ticket "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/ticket"
user "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/user"
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/login",
Handler: auth.UserLoginHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/register",
Handler: auth.UserRegisterHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/reset",
Handler: auth.ResetPasswordHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1/auth"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/announcement",
Handler: common.GetAnnouncementListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/config",
Handler: common.GetGlobalConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/document",
Handler: common.GetDocumentListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/document/:id",
Handler: common.GetDocumentDetailHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/health",
Handler: common.HealthHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/payment/methods",
Handler: common.GetAvailablePaymentMethodsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/send_email_code",
Handler: common.SendEmailCodeHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/subscribe",
Handler: common.GetSubscribeListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/subscribe/group",
Handler: common.GetSubscribeGroupListHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/:order_no",
Handler: order.GetOrderDetailHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/:order_no/close",
Handler: order.CloseOrderHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/create",
Handler: order.CreateOrderHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/order"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/:id",
Handler: ticket.GetTicketDetailHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/:id/follow",
Handler: ticket.CreateTicketFollowHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/create",
Handler: ticket.CreateTicketHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/ticket"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/info",
Handler: user.GetUserInfoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/password",
Handler: user.UpdateUserPasswordHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/subscribe",
Handler: user.GetUserSubscribeHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
rest.WithPrefix("/api/v1/user"),
)
}