You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
364 lines
9.3 KiB
Go
364 lines
9.3 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
auth "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/auth"
|
|
base "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/base"
|
|
captcha "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/captcha"
|
|
department_admin "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/department_admin"
|
|
dictionary_admin "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/dictionary_admin"
|
|
dictionary_admindetail "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/dictionary_admin/detail"
|
|
district "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/district"
|
|
oauthprovider_admin "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/oauthprovider_admin"
|
|
role_admin "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/role_admin"
|
|
token_admin "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/token_admin"
|
|
user "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/user"
|
|
user_admin "git.noahlan.cn/n-admin/n-admin-server/api/internal/handler/user_admin"
|
|
"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/initDatabase",
|
|
Handler: base.InitDatabaseHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/base"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/oauth/login",
|
|
Handler: auth.OauthLoginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/oauth/login/byCode",
|
|
Handler: auth.OauthLoginByCodeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/oauth/login/byPhone",
|
|
Handler: auth.OauthLoginByPhoneHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/oauth/login/callback",
|
|
Handler: auth.OauthCallbackHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/login",
|
|
Handler: auth.LoginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/login/byCode",
|
|
Handler: auth.LoginByCodeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/register",
|
|
Handler: auth.RegisterHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/auth"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/create",
|
|
Handler: user_admin.CreateUserAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/update",
|
|
Handler: user_admin.UpdateUserAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: user_admin.GetUserListAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: user_admin.GetUserAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/",
|
|
Handler: user_admin.DeleteUserAdminHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/admin/user"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: user.GetCurrentUserHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/user"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/create",
|
|
Handler: role_admin.CreateRoleAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/update",
|
|
Handler: role_admin.UpdateRoleAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/",
|
|
Handler: role_admin.DeleteRoleAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: role_admin.GetRoleListAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: role_admin.GetRoleAdminHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/admin/role"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: token_admin.GetTokenListAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/disable",
|
|
Handler: token_admin.DisableTokenAdminHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/admin/token"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: captcha.GetCaptchaHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/validate",
|
|
Handler: captcha.ValidateCaptchaHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/captcha"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/tree",
|
|
Handler: district.GetDistrictTreeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: district.GetDistrictListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/children",
|
|
Handler: district.GetDistrictChildrenHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/name",
|
|
Handler: district.GetDistrictNameHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/district"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/create",
|
|
Handler: oauthprovider_admin.CreateOauthProviderAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/update",
|
|
Handler: oauthprovider_admin.UpdateOauthProviderAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/delete",
|
|
Handler: oauthprovider_admin.DeleteOauthProviderAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: oauthprovider_admin.GetOauthProviderListAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: oauthprovider_admin.GetOauthProviderAdminHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/admin/oauth_provider"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/create",
|
|
Handler: department_admin.CreateDepartmentAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/update",
|
|
Handler: department_admin.UpdateDepartmentAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: department_admin.GetDepartmentListAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: department_admin.GetDepartmentAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/",
|
|
Handler: department_admin.DeleteDepartmentAdminHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/admin/department"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/create",
|
|
Handler: dictionary_admin.CreateDictionaryAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/update",
|
|
Handler: dictionary_admin.UpdateDictionaryAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: dictionary_admin.GetDictionaryListAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: dictionary_admin.GetDictionaryAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/",
|
|
Handler: dictionary_admin.DeleteDictionaryAdminHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/admin/dictionary"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
rest.WithMiddlewares(
|
|
[]rest.Middleware{serverCtx.Authority},
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/create",
|
|
Handler: dictionary_admindetail.CreateDictionaryDetailAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/update",
|
|
Handler: dictionary_admindetail.UpdateDictionaryDetailAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/list",
|
|
Handler: dictionary_admindetail.GetDictionaryDetailListAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/",
|
|
Handler: dictionary_admindetail.GetDictionaryDetailAdminHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/",
|
|
Handler: dictionary_admindetail.DeleteDictionaryDetailAdminHandler(serverCtx),
|
|
},
|
|
}...,
|
|
),
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/admin/dictionary/detail"),
|
|
)
|
|
}
|