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

import (
	"net/http"

	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"
	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:    "/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"),
	)
}