fix: api descript

This commit is contained in:
wwweww
2026-02-28 05:33:16 +08:00
parent 5930fb0dde
commit d2f33b4b96
243 changed files with 37065 additions and 780 deletions
+18 -12
View File
@@ -2,8 +2,11 @@ syntax = "v1"
import "common.api"
type (
PathId {
Id int64 `path:"id"`
}
Post {
Id string `json:"id"`
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
@@ -35,7 +38,7 @@ type (
}
Comment {
Id string `json:"id"`
Id int64 `json:"id"`
Content string `json:"content"`
Author UserProfile `json:"author"`
LikeCount int64 `json:"likeCount"`
@@ -51,6 +54,10 @@ type (
CreateCommentReq {
Content string `json:"content"`
}
ListCommentsReq {
PathId
PageReq
}
)
@server(
@@ -64,21 +71,20 @@ service juwan-api {
@doc "获取帖子详情"
@handler GetPost
get /posts/:id (EmptyResp) returns (Post)
get /posts/:id (PathId) returns (Post)
@doc "获取帖子评论"
@handler ListComments
get /posts/:id/comments (PageReq) returns (CommentListResp)
get /posts/:id/comments (ListCommentsReq ) returns (CommentListResp)
@doc "获取用户帖子"
@handler ListUserPosts
get /users/:id/posts (PageReq) returns (PostListResp)
get /users/:id/posts (ListCommentsReq ) returns (PostListResp)
}
@server(
prefix: api/v1
group: community
jwt: Auth
)
service juwan-api {
@doc "发布帖子"
@@ -87,19 +93,19 @@ service juwan-api {
@doc "点赞帖子"
@handler LikePost
post /posts/:id/like (EmptyResp) returns (EmptyResp)
post /posts/:id/like (PathId) returns (EmptyResp)
@doc "取消点赞帖子"
@handler UnlikePost
delete /posts/:id/like (EmptyResp) returns (EmptyResp)
delete /posts/:id/like (PathId) returns (EmptyResp)
@doc "置顶帖子"
@handler PinPost
post /posts/:id/pin (EmptyResp) returns (EmptyResp)
post /posts/:id/pin (PathId) returns (EmptyResp)
@doc "取消置顶"
@handler UnpinPost
delete /posts/:id/pin (EmptyResp) returns (EmptyResp)
delete /posts/:id/pin (PathId) returns (EmptyResp)
@doc "发表评论"
@handler CreateComment
@@ -107,9 +113,9 @@ service juwan-api {
@doc "点赞评论"
@handler LikeComment
post /comments/:id/like (EmptyResp) returns (EmptyResp)
post /comments/:id/like (PathId) returns (EmptyResp)
@doc "取消点赞评论"
@handler UnlikeComment
delete /comments/:id/like (EmptyResp) returns (EmptyResp)
delete /comments/:id/like (PathId) returns (EmptyResp)
}