Files
juwan-backend/app/shop/api/internal/handler/routes.go
T

124 lines
2.9 KiB
Go

// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1
package handler
import (
"net/http"
shop "juwan-backend/app/shop/api/internal/handler/shop"
"juwan-backend/app/shop/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: "/shops",
Handler: shop.ListShopsHandler(serverCtx),
},
{
// 获取店铺详情
Method: http.MethodGet,
Path: "/shops/:id",
Handler: shop.GetShopHandler(serverCtx),
},
{
// 获取店长的店铺
Method: http.MethodGet,
Path: "/users/:id/shop",
Handler: shop.GetUserShopHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// 创建店铺
Method: http.MethodPost,
Path: "/shops",
Handler: shop.CreateShopHandler(serverCtx),
},
{
// 更新店铺信息
Method: http.MethodPut,
Path: "/shops/:id",
Handler: shop.UpdateShopHandler(serverCtx),
},
{
// 新增店铺公告
Method: http.MethodPost,
Path: "/shops/:id/announcements",
Handler: shop.AddAnnouncementHandler(serverCtx),
},
{
// 删除店铺公告
Method: http.MethodDelete,
Path: "/shops/:id/announcements/:index",
Handler: shop.DeleteAnnouncementHandler(serverCtx),
},
{
// 获取收入统计
Method: http.MethodGet,
Path: "/shops/:id/income-stats",
Handler: shop.GetShopIncomeStatsHandler(serverCtx),
},
{
// 邀请打手
Method: http.MethodPost,
Path: "/shops/:id/invitations",
Handler: shop.InvitePlayerHandler(serverCtx),
},
{
// 获取店铺邀请列表
Method: http.MethodGet,
Path: "/shops/:id/invitations",
Handler: shop.ListShopInvitationsHandler(serverCtx),
},
{
// 移除打手
Method: http.MethodDelete,
Path: "/shops/:id/players/:playerId",
Handler: shop.RemovePlayerHandler(serverCtx),
},
{
// 更新店铺模板
Method: http.MethodPut,
Path: "/shops/:id/template",
Handler: shop.UpdateShopTemplateHandler(serverCtx),
},
{
// 拒绝邀请
Method: http.MethodDelete,
Path: "/shops/invitations/:id",
Handler: shop.RejectInvitationHandler(serverCtx),
},
{
// 接受邀请
Method: http.MethodPost,
Path: "/shops/invitations/:id/accept",
Handler: shop.AcceptInvitationHandler(serverCtx),
},
{
// 获取我收到的邀请
Method: http.MethodGet,
Path: "/shops/invitations/mine",
Handler: shop.MyInvitationsHandler(serverCtx),
},
{
// 获取当前用户的店铺
Method: http.MethodGet,
Path: "/shops/mine",
Handler: shop.GetMyShopHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
}