fix
This commit is contained in:
@@ -11,6 +11,11 @@ import (
|
||||
)
|
||||
|
||||
type IForumV1 interface {
|
||||
ForumBoardsCreate(ctx context.Context, req *v1.ForumBoardsCreateReq) (res *v1.ForumBoardsCreateRes, err error)
|
||||
ForumBoardsUpdate(ctx context.Context, req *v1.ForumBoardsUpdateReq) (res *v1.ForumBoardsUpdateRes, err error)
|
||||
ForumBoardsDelete(ctx context.Context, req *v1.ForumBoardsDeleteReq) (res *v1.ForumBoardsDeleteRes, err error)
|
||||
ForumBoardsView(ctx context.Context, req *v1.ForumBoardsViewReq) (res *v1.ForumBoardsViewRes, err error)
|
||||
ForumBoardsList(ctx context.Context, req *v1.ForumBoardsListReq) (res *v1.ForumBoardsListRes, err error)
|
||||
ForumCommentsCreate(ctx context.Context, req *v1.ForumCommentsCreateReq) (res *v1.ForumCommentsCreateRes, err error)
|
||||
ForumCommentsUpdate(ctx context.Context, req *v1.ForumCommentsUpdateReq) (res *v1.ForumCommentsUpdateRes, err error)
|
||||
ForumCommentsDelete(ctx context.Context, req *v1.ForumCommentsDeleteReq) (res *v1.ForumCommentsDeleteRes, err error)
|
||||
|
||||
67
Backend/api/forum/v1/forum_boards.go
Normal file
67
Backend/api/forum/v1/forum_boards.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"TrangleAgent/internal/model"
|
||||
"TrangleAgent/internal/model/response"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ForumBoardsCreateReq 创建版块请求
|
||||
type ForumBoardsCreateReq struct {
|
||||
g.Meta `path:"/forum/boards/create" method:"post" tags:"论坛版块" summary:"创建版块"`
|
||||
model.ForumBoard
|
||||
}
|
||||
|
||||
// ForumBoardsCreateRes 创建版块响应
|
||||
type ForumBoardsCreateRes struct {
|
||||
Id uint64 `json:"id" description:"版块ID"`
|
||||
}
|
||||
|
||||
// ForumBoardsUpdateReq 更新版块请求
|
||||
type ForumBoardsUpdateReq struct {
|
||||
g.Meta `path:"/forum/boards/update" method:"put" tags:"论坛版块" summary:"更新版块"`
|
||||
Id uint64 `json:"id" description:"版块ID"`
|
||||
model.ForumBoard
|
||||
}
|
||||
|
||||
// ForumBoardsUpdateRes 更新版块响应
|
||||
type ForumBoardsUpdateRes struct {
|
||||
Id uint64 `json:"id" description:"版块ID"`
|
||||
}
|
||||
|
||||
// ForumBoardsDeleteReq 删除版块请求
|
||||
type ForumBoardsDeleteReq struct {
|
||||
g.Meta `path:"/forum/boards/delete" method:"delete" tags:"论坛版块" summary:"删除版块"`
|
||||
Id uint64 `json:"id" description:"版块ID"`
|
||||
}
|
||||
|
||||
// ForumBoardsDeleteRes 删除版块响应
|
||||
type ForumBoardsDeleteRes struct {
|
||||
}
|
||||
|
||||
// ForumBoardsViewReq 查看版块请求
|
||||
type ForumBoardsViewReq struct {
|
||||
g.Meta `path:"/forum/boards/view" method:"get" tags:"论坛版块" summary:"查看版块"`
|
||||
Id uint64 `json:"id" description:"版块ID"`
|
||||
}
|
||||
|
||||
// ForumBoardsViewRes 查看版块响应
|
||||
type ForumBoardsViewRes struct {
|
||||
model.ForumBoardViewParams
|
||||
}
|
||||
|
||||
// ForumBoardsListReq 版块列表请求
|
||||
type ForumBoardsListReq struct {
|
||||
response.PageResult
|
||||
g.Meta `path:"/forum/boards/list" method:"get" tags:"论坛版块" summary:"版块列表"`
|
||||
SectionId uint64 `json:"sectionId,omitempty" description:"所属频道ID"`
|
||||
Name string `json:"name,omitempty" description:"版块名称"`
|
||||
Status string `json:"status,omitempty" description:"版块状态"`
|
||||
}
|
||||
|
||||
// ForumBoardsListRes 版块列表响应
|
||||
type ForumBoardsListRes struct {
|
||||
response.PageResult
|
||||
List []*model.ForumBoardViewParams `json:"list" description:"版块列表"`
|
||||
}
|
||||
@@ -1,19 +1,16 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"TrangleAgent/internal/model"
|
||||
"TrangleAgent/internal/model/response"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ForumCommentsCreateReq 创建评论请求
|
||||
type ForumCommentsCreateReq struct {
|
||||
g.Meta `path:"/forum/comments/create" method:"post" tags:"论坛评论" summary:"创建评论"`
|
||||
UserId uint64 `json:"userId" description:"评论发布者ID"`
|
||||
PostId uint64 `json:"postId" description:"所属帖子ID"`
|
||||
ParentId uint64 `json:"parentId" description:"父评论ID"`
|
||||
Content string `json:"content" description:"评论内容"`
|
||||
Status string `json:"status" description:"评论状态"`
|
||||
g.Meta `path:"/forum/comments/create" method:"post" tags:"论坛评论" summary:"创建评论"`
|
||||
model.ForumComment
|
||||
}
|
||||
|
||||
// ForumCommentsCreateRes 创建评论响应
|
||||
@@ -23,13 +20,9 @@ type ForumCommentsCreateRes struct {
|
||||
|
||||
// ForumCommentsUpdateReq 更新评论请求
|
||||
type ForumCommentsUpdateReq struct {
|
||||
g.Meta `path:"/forum/comments/update" method:"put" tags:"论坛评论" summary:"更新评论"`
|
||||
Id uint64 `json:"id" description:"评论ID"`
|
||||
UserId uint64 `json:"userId,omitempty" description:"评论发布者ID"`
|
||||
PostId uint64 `json:"postId,omitempty" description:"所属帖子ID"`
|
||||
ParentId uint64 `json:"parentId,omitempty" description:"父评论ID"`
|
||||
Content string `json:"content,omitempty" description:"评论内容"`
|
||||
Status string `json:"status,omitempty" description:"评论状态"`
|
||||
g.Meta `path:"/forum/comments/update" method:"put" tags:"论坛评论" summary:"更新评论"`
|
||||
Id uint64 `json:"id" description:"评论ID"`
|
||||
model.ForumComment
|
||||
}
|
||||
|
||||
// ForumCommentsUpdateRes 更新评论响应
|
||||
@@ -55,24 +48,15 @@ type ForumCommentsViewReq struct {
|
||||
|
||||
// ForumCommentsViewRes 查看评论响应
|
||||
type ForumCommentsViewRes struct {
|
||||
Id uint64 `json:"id" description:"评论ID"`
|
||||
UserId uint64 `json:"userId" description:"评论发布者ID"`
|
||||
PostId uint64 `json:"postId" description:"所属帖子ID"`
|
||||
ParentId uint64 `json:"parentId" description:"父评论ID"`
|
||||
Content string `json:"content" description:"评论内容"`
|
||||
Status string `json:"status" description:"评论状态"`
|
||||
LikeCount uint `json:"likeCount" description:"点赞数"`
|
||||
ReplyCount uint `json:"replyCount" description:"回复数"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"评论创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"评论更新时间"`
|
||||
model.ForumCommentViewParams
|
||||
}
|
||||
|
||||
// ForumCommentsListReq 评论列表请求
|
||||
type ForumCommentsListReq struct {
|
||||
response.PageResult
|
||||
g.Meta `path:"/forum/comments/list" method:"get" tags:"论坛评论" summary:"评论列表"`
|
||||
UserId uint64 `json:"userId,omitempty" description:"评论发布者ID"`
|
||||
PostId uint64 `json:"postId,omitempty" description:"所属帖子ID"`
|
||||
UserId uint64 `json:"userId,omitempty" description:"评论发布者ID"`
|
||||
PostId uint64 `json:"postId,omitempty" description:"所属帖子ID"`
|
||||
ParentId uint64 `json:"parentId,omitempty" description:"父评论ID"`
|
||||
Status string `json:"status,omitempty" description:"评论状态"`
|
||||
}
|
||||
@@ -80,5 +64,5 @@ type ForumCommentsListReq struct {
|
||||
// ForumCommentsListRes 评论列表响应
|
||||
type ForumCommentsListRes struct {
|
||||
response.PageResult
|
||||
List []*ForumCommentsViewRes `json:"list" description:"评论列表"`
|
||||
List []*model.ForumCommentViewParams `json:"list" description:"评论列表"`
|
||||
}
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"TrangleAgent/internal/model"
|
||||
"TrangleAgent/internal/model/response"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ForumPostsCreateReq 创建帖子请求
|
||||
type ForumPostsCreateReq struct {
|
||||
g.Meta `path:"/forum/posts/create" method:"post" tags:"论坛帖子" summary:"创建帖子"`
|
||||
UserId uint64 `json:"userId" description:"发帖用户ID"`
|
||||
Title string `json:"title" description:"帖子标题"`
|
||||
Content string `json:"content" description:"帖子正文"`
|
||||
CoverImage string `json:"coverImage" description:"帖子封面图URL"`
|
||||
Status string `json:"status" description:"帖子状态"`
|
||||
Id uint64 `json:"id" orm:"id" description:"帖子ID"`
|
||||
BoardId uint64 `json:"boardId" orm:"board_id" description:"所属版块ID"`
|
||||
UserId uint64 `json:"userId" orm:"user_id" description:"发帖用户ID"`
|
||||
Title string `json:"title" orm:"title" description:"帖子标题"`
|
||||
Content string `json:"content" orm:"content" description:"帖子正文"`
|
||||
CoverImage string `json:"coverImage" orm:"cover_image" description:"帖子封面图URL"`
|
||||
Status string `json:"status" orm:"status" description:"帖子状态"`
|
||||
}
|
||||
|
||||
// ForumPostsCreateRes 创建帖子响应
|
||||
@@ -23,13 +26,9 @@ type ForumPostsCreateRes struct {
|
||||
|
||||
// ForumPostsUpdateReq 更新帖子请求
|
||||
type ForumPostsUpdateReq struct {
|
||||
g.Meta `path:"/forum/posts/update" method:"put" tags:"论坛帖子" summary:"更新帖子"`
|
||||
Id uint64 `json:"id" description:"帖子ID"`
|
||||
UserId uint64 `json:"userId,omitempty" description:"发帖用户ID"`
|
||||
Title string `json:"title,omitempty" description:"帖子标题"`
|
||||
Content string `json:"content,omitempty" description:"帖子正文"`
|
||||
CoverImage string `json:"coverImage,omitempty" description:"帖子封面图URL"`
|
||||
Status string `json:"status,omitempty" description:"帖子状态"`
|
||||
g.Meta `path:"/forum/posts/update" method:"put" tags:"论坛帖子" summary:"更新帖子"`
|
||||
Id uint64 `json:"id" description:"帖子ID"`
|
||||
model.ForumPost
|
||||
}
|
||||
|
||||
// ForumPostsUpdateRes 更新帖子响应
|
||||
@@ -55,30 +54,23 @@ type ForumPostsViewReq struct {
|
||||
|
||||
// ForumPostsViewRes 查看帖子响应
|
||||
type ForumPostsViewRes struct {
|
||||
Id uint64 `json:"id" description:"帖子ID"`
|
||||
UserId uint64 `json:"userId" description:"发帖用户ID"`
|
||||
Title string `json:"title" description:"帖子标题"`
|
||||
Content string `json:"content" description:"帖子正文"`
|
||||
CoverImage string `json:"coverImage" description:"帖子封面图URL"`
|
||||
Status string `json:"status" description:"帖子状态"`
|
||||
ViewCount uint `json:"viewCount" description:"浏览量"`
|
||||
LikeCount uint `json:"likeCount" description:"点赞数"`
|
||||
CommentCount uint `json:"commentCount" description:"评论数"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"发帖时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"更新时间"`
|
||||
model.ForumPostViewParams
|
||||
}
|
||||
|
||||
// ForumPostsListReq 帖子列表请求
|
||||
type ForumPostsListReq struct {
|
||||
response.PageResult
|
||||
g.Meta `path:"/forum/posts/list" method:"get" tags:"论坛帖子" summary:"帖子列表"`
|
||||
UserId uint64 `json:"userId,omitempty" description:"发帖用户ID"`
|
||||
Title string `json:"title,omitempty" description:"帖子标题"`
|
||||
Status string `json:"status,omitempty" description:"帖子状态"`
|
||||
g.Meta `path:"/forum/posts/list" method:"get" tags:"论坛帖子" summary:"帖子列表"`
|
||||
BoardId uint64 `json:"boardId,omitempty" description:"所属版块ID"`
|
||||
UserId uint64 `json:"userId,omitempty" description:"发帖用户ID"`
|
||||
Title string `json:"title,omitempty" description:"帖子标题"`
|
||||
Status string `json:"status,omitempty" description:"帖子状态"`
|
||||
IsPinned int `json:"isPinned,omitempty" description:"是否置顶"`
|
||||
IsEssence int `json:"isEssence,omitempty" description:"是否精华"`
|
||||
}
|
||||
|
||||
// ForumPostsListRes 帖子列表响应
|
||||
type ForumPostsListRes struct {
|
||||
response.PageResult
|
||||
List []*ForumPostsViewRes `json:"list" description:"帖子列表"`
|
||||
List []*model.ForumPostViewParams `json:"list" description:"帖子列表"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user