Files
zetaloop 198c761063 fix: 补全 ShopProfile 和 Post 响应中缺失的后端字段
ShopProfile 补上 allowMultiShop/allowIndependentOrders/dispatchMode,Post 补上 pinned/linkedOrderId。这些字段在 RPC proto、数据库和写入逻辑中均已存在,但 API 响应类型和映射函数遗漏了它们。同时补回 community.api 中 CreateCommentReq 的 PostId 字段定义。
2026-04-23 20:36:44 +08:00

100 lines
2.2 KiB
Go

// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1
package handler
import (
"net/http"
community "juwan-backend/app/community/api/internal/handler/community"
"juwan-backend/app/community/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: "/posts",
Handler: community.ListPostsHandler(serverCtx),
},
{
// 获取帖子详情
Method: http.MethodGet,
Path: "/posts/:id",
Handler: community.GetPostHandler(serverCtx),
},
{
// 获取帖子评论
Method: http.MethodGet,
Path: "/posts/:id/comments",
Handler: community.ListCommentsHandler(serverCtx),
},
{
// 获取用户帖子
Method: http.MethodGet,
Path: "/users/:id/posts",
Handler: community.ListUserPostsHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// 点赞评论
Method: http.MethodPost,
Path: "/comments/:id/like",
Handler: community.LikeCommentHandler(serverCtx),
},
{
// 取消点赞评论
Method: http.MethodDelete,
Path: "/comments/:id/like",
Handler: community.UnlikeCommentHandler(serverCtx),
},
{
// 发布帖子
Method: http.MethodPost,
Path: "/posts",
Handler: community.CreatePostHandler(serverCtx),
},
{
// 发表评论
Method: http.MethodPost,
Path: "/posts/:id/comments",
Handler: community.CreateCommentHandler(serverCtx),
},
{
// 点赞帖子
Method: http.MethodPost,
Path: "/posts/:id/like",
Handler: community.LikePostHandler(serverCtx),
},
{
// 取消点赞帖子
Method: http.MethodDelete,
Path: "/posts/:id/like",
Handler: community.UnlikePostHandler(serverCtx),
},
{
// 置顶帖子
Method: http.MethodPost,
Path: "/posts/:id/pin",
Handler: community.PinPostHandler(serverCtx),
},
{
// 取消置顶
Method: http.MethodDelete,
Path: "/posts/:id/pin",
Handler: community.UnpinPostHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
}