routes.go 5.2 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"
	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/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),
			},
		},
		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.MethodPost,
				Path:    "/article/search/me",
				Handler: article.MiniArticleSearchMeHandler(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),
			},
		},
		rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
		rest.WithPrefix("/v1/mini"),
	)
}