Files
neo-blog/internal/dto/post.go
Snowykami e659de23fb ️ feat: refactor sorting parameters in post listing API and components
- Renamed `orderedBy` to `orderBy` and `reverse` to `desc` in ListPostsParams interface and related functions.
- Updated all usages of the sorting parameters in the post listing logic to reflect the new naming convention.

feat: add user-related API functions

- Implemented `getLoginUser` and `getUserById` functions in the user API to fetch user details.
- Enhanced user model to include `language` property.

feat: integrate next-intl for internationalization

- Added `next-intl` plugin to Next.js configuration for improved localization support.
- Removed previous i18n implementation and replaced it with a new structure using JSON files for translations.
- Created locale files for English, Japanese, and Chinese with basic translations.
- Implemented a request configuration to handle user locales and messages dynamically.

fix: clean up unused imports and code

- Removed unused i18n utility functions and language settings from device context.
- Cleaned up commented-out code in blog card component and sidebar.

chore: update dependencies

- Added `deepmerge` for merging locale messages.
- Updated package.json and pnpm-lock.yaml to reflect new dependencies.
2025-07-26 09:48:23 +08:00

45 lines
1.6 KiB
Go

package dto
import "time"
type PostDto struct {
ID uint `json:"id"` // 帖子ID
UserID uint `json:"user_id"` // 发布者的用户ID
Title string `json:"title"` // 帖子标题
Content string `json:"content"`
Cover string `json:"cover"` // 帖子封面图
Type string `json:"type"` // 帖子类型 markdown / html / text
Labels []LabelDto `json:"labels"` // 关联的标签
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"`
}
type ListPostResp struct {
Posts []PostDto `json:"posts"`
Total uint64 `json:"total"` // 总数
OrderBy string `json:"order_by"` // 排序方式
Desc bool `json:"desc"`
}