Files
neo-blog/internal/dto/comment.go
Snowykami dd7641bf6e
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 13s
feat: implement advanced comment features including reply and like functionality
- Added support for nested comments with reply functionality.
- Implemented like/unlike feature for comments and posts.
- Enhanced comment DTO to include reply count, like count, and like status.
- Updated comment and like services to handle new functionalities.
- Created new API endpoints for toggling likes and listing comments.
- Improved UI components for comments to support replies and likes with animations.
- Added localization for new comment-related messages.
- Introduced a TODO list for future enhancements in the comment module.
2025-09-09 00:24:25 +08:00

42 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dto
type CommentDto struct {
ID uint `json:"id"`
TargetID uint `json:"target_id"`
TargetType string `json:"target_type"` // 目标类型,如 "post", "page"
Content string `json:"content"`
ReplyID uint `json:"reply_id"` // 回复的评论ID
Depth int `json:"depth"` // 评论的层级深度
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
User UserDto `json:"user"` // 评论的
ReplyCount int64 `json:"reply_count"` // 回复数量
LikeCount uint64 `json:"like_count"` // 点赞数量
IsLiked bool `json:"is_liked"` // 当前用户是否点赞
}
type CreateCommentReq struct {
TargetID uint `json:"target_id" binding:"required"` // 目标ID
TargetType string `json:"target_type" binding:"required"` // 目标类型,如 "post", "page"
Content string `json:"content" binding:"required"` // 评论内容
ReplyID uint `json:"reply_id"` // 回复的评论ID
IsPrivate bool `json:"is_private"` // 是否私密评论默认false
}
type UpdateCommentReq struct {
CommentID uint `json:"comment_id" binding:"required"` // 评论ID
Content string `json:"content" binding:"required"` // 评论内容
IsPrivate bool `json:"is_private"` // 是否私密
}
type GetCommentListReq struct {
TargetID uint `json:"target_id" binding:"required"`
TargetType string `json:"target_type" binding:"required"`
CommentID uint `json:"comment_id"` // 获取某条评论的所有子评论
OrderBy string `json:"order_by"` // 排序方式
Page uint64 `json:"page"` // 页码
Size uint64 `json:"size"`
Desc bool `json:"desc"`
Depth int `json:"depth"` // 评论的层级深度
}