Files
neo-blog/internal/dto/post.go
Snowykami d1d8aa529f
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 9s
feat: Refactor comment section to correctly handle API response structure
fix: Update Gravatar URL size and improve avatar rendering logic

style: Adjust footer margin for better layout consistency

refactor: Remove old navbar component and integrate new layout structure

feat: Enhance user profile page with user header component

chore: Remove unused user profile component

fix: Update posts per page configuration for better pagination

feat: Extend device context to support system theme mode

refactor: Remove unused device hook

fix: Improve storage state hook for better error handling

i18n: Add new translations for blog home page

feat: Implement pagination component for better navigation

feat: Create theme toggle component for improved user experience

feat: Introduce responsive navbar or side layout with theme toggle

feat: Develop custom select component for better UI consistency

feat: Create user header component to display user information

chore: Add query key constants for better code maintainability
2025-09-12 00:26:08 +08:00

49 lines
1.9 KiB
Go

package dto
import "time"
type PostDto struct {
ID uint `json:"id"` // 帖子ID
UserID uint `json:"user_id"` // 发布者的用户ID
User UserDto `json:"user"` // 发布者信息
Title string `json:"title"` // 帖子标题
Content string `json:"content"`
Cover string `json:"cover"` // 帖子封面图
Type string `json:"type"` // 帖子类型 markdown / html / text
Labels []LabelDto `json:"labels"` // 关联的标签
IsOriginal bool `json:"is_original"` // 是否为原创帖子
IsPrivate bool `json:"is_private"` // 是否为私密帖子
LikeCount uint64 `json:"like_count"` // 点赞数
CommentCount uint64 `json:"comment_count"` // 评论数
ViewCount uint64 `json:"view_count"` // 浏览数
Heat uint64 `json:"heat"` // 热度
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` // 更新时间
}
type CreateOrUpdatePostReq struct {
Title string `json:"title"`
Content string `json:"content"`
Cover string `json:"cover"`
IsPrivate bool `json:"is_private"`
Type string `json:"type"`
Labels []uint `json:"labels"` // 标签ID列表
}
type ListPostReq struct {
Keywords []string `json:"keywords"` // 关键词列表
OrderBy string `json:"order_by"` // 排序方式
Page uint64 `json:"page"` // 页码
Size uint64 `json:"size"`
Desc bool `json:"desc"`
Labels []LabelDto `json:"labels"`
LabelRule string `json:"label_rule"` // 标签过滤规则 union or intersection
}
type ListPostResp struct {
Posts []PostDto `json:"posts"`
Total uint64 `json:"total"` // 总数
OrderBy string `json:"order_by"` // 排序方式
Desc bool `json:"desc"`
}