routes.go 7.6 KB
// Code generated by goctl. DO NOT EDIT.
package handler

import (
	"net/http"

	article "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/article"
	comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment"
	company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company"
	message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message"
	role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role"
	tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags"
	user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/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:    "/mini/comment",
				Handler: comment.MiniCommentHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/system/comment",
				Handler: comment.SystemCommentHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/mini/message/system",
				Handler: message.MiniSystemHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/message/business",
				Handler: message.MiniBusinessHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/article_tag",
				Handler: tags.CreateTagHandler(serverCtx),
			},
			{
				Method:  http.MethodPut,
				Path:    "/article_tag",
				Handler: tags.EditTagHandler(serverCtx),
			},
			{
				Method:  http.MethodGet,
				Path:    "/article_tag/:id",
				Handler: tags.GetTagHandler(serverCtx),
			},
			{
				Method:  http.MethodDelete,
				Path:    "/article_tag/:id",
				Handler: tags.DeleteTagHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article_tag/search",
				Handler: tags.SearchTagHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
		rest.WithPrefix("/v1/system"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/apply-join-company",
				Handler: user.MiniUserApplyJoinCompanyHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/login",
				Handler: user.MiniUserLoginHandler(serverCtx),
			},
		},
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/switch-account",
				Handler: user.MiniUserSwitchAccountHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/info",
				Handler: user.MiniUserInfoHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/audit-list",
				Handler: user.MiniUserAuditListHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/audit",
				Handler: user.MiniUserAuditHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/department-users",
				Handler: user.MiniUserDepartmentUsersHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/follower",
				Handler: user.MiniUserFollowerHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/following",
				Handler: user.MiniUserFollowingHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/follow",
				Handler: user.MiniUserFollowHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/mini/user/unfollow",
				Handler: user.MiniUserUnFollowHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/user/mylike",
				Handler: user.MiniMyLikeHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/mini/company/search",
				Handler: company.MiniCompanySearchHandler(serverCtx),
			},
		},
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/system/company/search",
				Handler: company.SystemCompanySearchHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodPost,
				Path:    "/article",
				Handler: article.MiniCreateArticleHandler(serverCtx),
			},
			{
				Method:  http.MethodGet,
				Path:    "/article/:id",
				Handler: article.MiniGetArticleHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article/user_like/list",
				Handler: article.MiniUserLikeArticleHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article/user_like/set",
				Handler: article.MiniSetUserLikeHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article/mark/user_read",
				Handler: article.MiniArticleMarkUserReadHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article/search/me",
				Handler: article.MiniArticleSearchMeHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article_draft",
				Handler: article.MiniCreateArticleDraftHandler(serverCtx),
			},
			{
				Method:  http.MethodPut,
				Path:    "/article_draft",
				Handler: article.MiniUpdateArticleDraftHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article_draft/search/me",
				Handler: article.MiniSearchArticleDraftMeHandler(serverCtx),
			},
			{
				Method:  http.MethodGet,
				Path:    "/article_draft/me/:id",
				Handler: article.MiniGetArticleDraftMeHandler(serverCtx),
			},
			{
				Method:  http.MethodDelete,
				Path:    "/article_draft/me/:id",
				Handler: article.MiniDeleteArticleDraftMeHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article_backup/search",
				Handler: article.MiniArticleBackupSearchHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
		rest.WithPrefix("/v1/mini"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/article/:id",
				Handler: article.SystemGetArticleHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/article/search",
				Handler: article.SystemSearchArticleHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
		rest.WithPrefix("/v1/system"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				Method:  http.MethodGet,
				Path:    "/system/role/:id",
				Handler: role.SystemGetRoleHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/system/role",
				Handler: role.SystemSaveRoleHandler(serverCtx),
			},
			{
				Method:  http.MethodDelete,
				Path:    "/system/role/:id",
				Handler: role.SystemDeleteRoleHandler(serverCtx),
			},
			{
				Method:  http.MethodPut,
				Path:    "/system/role/:id",
				Handler: role.SystemUpdateRoleHandler(serverCtx),
			},
			{
				Method:  http.MethodPost,
				Path:    "/system/role/search",
				Handler: role.SystemSearchRoleHandler(serverCtx),
			},
		},
		rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
		rest.WithPrefix("/v1"),
	)
}