|
|
@@ -13,11 +13,13 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
|
server.AddRoutes(
|
|
|
[]rest.Route{
|
|
|
{
|
|
|
+ // 登录方法
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/user/login",
|
|
|
Handler: loginHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 用户注册
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/user/register",
|
|
|
Handler: registerHandler(serverCtx),
|
|
|
@@ -29,41 +31,49 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
|
server.AddRoutes(
|
|
|
[]rest.Route{
|
|
|
{
|
|
|
+ // 获取粉丝
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/fans",
|
|
|
Handler: getFansHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 查询用户
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/user/find",
|
|
|
Handler: findUserHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 关注用户
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/user/follow",
|
|
|
Handler: followUserHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取关注列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/follows",
|
|
|
Handler: getFollowsHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取用户信息
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/info",
|
|
|
Handler: getUserInfoHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取用户信息
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/profile",
|
|
|
Handler: getUserProfileHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 搜索用户
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/search",
|
|
|
Handler: searchUsernameHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 取消关注用户
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/user/unfollow",
|
|
|
Handler: unfollowUserHandler(serverCtx),
|
|
|
@@ -76,46 +86,55 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
|
server.AddRoutes(
|
|
|
[]rest.Route{
|
|
|
{
|
|
|
+ // 评论删除
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/comment/delete",
|
|
|
Handler: commentDeleteHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 帖子收藏
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/collection",
|
|
|
Handler: postCollectionHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 发布评论
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/comment",
|
|
|
Handler: postCommentHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 评论点赞
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/comment/upvote",
|
|
|
Handler: postCommentUpvoteHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 创建帖子
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/create",
|
|
|
Handler: createPostHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 帖子删除
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/delete",
|
|
|
Handler: postDeleteHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 回复评论
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/reply",
|
|
|
Handler: postReplyHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 帖子分享
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/share",
|
|
|
Handler: postShareHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 帖子点赞
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/post/upvote",
|
|
|
Handler: postUpvoteHandler(serverCtx),
|
|
|
@@ -130,46 +149,55 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
|
[]rest.Middleware{serverCtx.OptionalJwtMiddleware},
|
|
|
[]rest.Route{
|
|
|
{
|
|
|
+ // 获取帖子详情
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/post",
|
|
|
Handler: getPostHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取评论列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/post/comment/list",
|
|
|
Handler: getPostCommentListHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取帖子列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/post/list",
|
|
|
Handler: getPostListHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取回复列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/post/reply/list",
|
|
|
Handler: getReplyListHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取话题详情
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/tag",
|
|
|
Handler: getTagHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取话题列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/tag/list",
|
|
|
Handler: getTagListHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取用户收藏的帖子列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/post/collection/list",
|
|
|
Handler: getUserPostCollectionListHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取用户点赞的帖子列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/post/like/list",
|
|
|
Handler: getUserPostLikeListHandler(serverCtx),
|
|
|
},
|
|
|
{
|
|
|
+ // 获取用户发布的帖子列表
|
|
|
Method: http.MethodGet,
|
|
|
Path: "/user/post/list",
|
|
|
Handler: getUserPostListHandler(serverCtx),
|
|
|
@@ -182,6 +210,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
|
server.AddRoutes(
|
|
|
[]rest.Route{
|
|
|
{
|
|
|
+ // 上传文件
|
|
|
Method: http.MethodPost,
|
|
|
Path: "/attachment/upload",
|
|
|
Handler: attachmentUploadHandler(serverCtx),
|