350 lines
9.4 KiB
Go
350 lines
9.4 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.7.3
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
captcha "schisandra-album-cloud-microservices/app/auth/api/internal/handler/captcha"
|
|
client "schisandra-album-cloud-microservices/app/auth/api/internal/handler/client"
|
|
comment "schisandra-album-cloud-microservices/app/auth/api/internal/handler/comment"
|
|
oauth "schisandra-album-cloud-microservices/app/auth/api/internal/handler/oauth"
|
|
sms "schisandra-album-cloud-microservices/app/auth/api/internal/handler/sms"
|
|
storage "schisandra-album-cloud-microservices/app/auth/api/internal/handler/storage"
|
|
token "schisandra-album-cloud-microservices/app/auth/api/internal/handler/token"
|
|
upscale "schisandra-album-cloud-microservices/app/auth/api/internal/handler/upscale"
|
|
user "schisandra-album-cloud-microservices/app/auth/api/internal/handler/user"
|
|
websocket "schisandra-album-cloud-microservices/app/auth/api/internal/handler/websocket"
|
|
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/rotate/generate",
|
|
Handler: captcha.GenerateRotateCaptchaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/slide/generate",
|
|
Handler: captcha.GenerateSlideBasicCaptchaHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/captcha"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(1048576),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/generate",
|
|
Handler: client.GenerateClientIdHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/client"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(1048576),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.CasbinVerifyMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/dislike",
|
|
Handler: comment.DislikeCommentHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/like",
|
|
Handler: comment.LikeCommentHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/list",
|
|
Handler: comment.GetCommentListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/reply/list",
|
|
Handler: comment.GetReplyListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/reply/reply/submit",
|
|
Handler: comment.SubmitReplyReplyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/reply/submit",
|
|
Handler: comment.SubmitReplyCommentHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/submit",
|
|
Handler: comment.SubmitCommentHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/auth/comment"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(1048576),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/gitee/callback",
|
|
Handler: oauth.GiteeCallbackHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/gitee/url",
|
|
Handler: oauth.GetGiteeOauthUrlHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/github/callback",
|
|
Handler: oauth.GithubCallbackHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/github/url",
|
|
Handler: oauth.GetGithubOauthUrlHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/qq/callback",
|
|
Handler: oauth.QqCallbackHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/qq/url",
|
|
Handler: oauth.GetQqOauthUrlHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/wechat/offiaccount/callback",
|
|
Handler: oauth.WechatOffiaccountCallbackHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/wechat/offiaccount/callback",
|
|
Handler: oauth.WechatOffiaccountCallbackVerifyHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/oauth"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(1048576),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/ali/send",
|
|
Handler: sms.SendSmsByAliyunHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/smsbao/send",
|
|
Handler: sms.SendSmsBySmsbaoHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/test/send",
|
|
Handler: sms.SendSmsByTestHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/sms"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(1048576),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.CasbinVerifyMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/album/create",
|
|
Handler: storage.CreateAlbumHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/album/delete",
|
|
Handler: storage.DeleteAlbumHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/album/detail/list",
|
|
Handler: storage.GetAlbumDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/album/list",
|
|
Handler: storage.GetAlbumListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/album/rename",
|
|
Handler: storage.RenameAlbumHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/config",
|
|
Handler: storage.SetStorageConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/face/detail/list",
|
|
Handler: storage.GetFaceDetailListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/face/sample/list",
|
|
Handler: storage.GetFaceSampleLibraryListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/face/sample/modify/name",
|
|
Handler: storage.ModifyFaceLibraryNameHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/face/sample/modify/type",
|
|
Handler: storage.ModifyFaceLibraryTypeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/image/all/list",
|
|
Handler: storage.QueryAllImageListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/uploads",
|
|
Handler: storage.UploadFileHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/auth/storage"),
|
|
rest.WithTimeout(20000*time.Millisecond),
|
|
rest.WithMaxBytes(104857600),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.CasbinVerifyMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/token/refresh",
|
|
Handler: token.RefreshTokenHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithSignature(serverCtx.Config.Signature),
|
|
rest.WithPrefix("/api/auth"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(1048576),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/phone/upload",
|
|
Handler: upscale.UploadImageHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithPrefix("/api/auth/upscale"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(10485760),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/login",
|
|
Handler: user.AccountLoginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/phone/login",
|
|
Handler: user.PhoneLoginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/reset/password",
|
|
Handler: user.ResetPasswordHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/wechat/offiaccount/login",
|
|
Handler: user.WechatOffiaccountLoginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/wechat/offiaccount/qrcode",
|
|
Handler: user.GetWechatOffiaccountQrcodeHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithSignature(serverCtx.Config.Signature),
|
|
rest.WithPrefix("/api/user"),
|
|
rest.WithTimeout(10000*time.Millisecond),
|
|
rest.WithMaxBytes(1048576),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/file",
|
|
Handler: websocket.FileWebsocketHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/message",
|
|
Handler: websocket.MessageWebsocketHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/qrcode",
|
|
Handler: websocket.QrcodeWebsocketHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/ws"),
|
|
)
|
|
}
|