55 lines
2.6 KiB
Go
55 lines
2.6 KiB
Go
package queries
|
|
|
|
import "tyapi-server/internal/domains/article/entities"
|
|
|
|
// ListArticleQuery 文章列表查询
|
|
type ListArticleQuery struct {
|
|
Page int `form:"page" binding:"min=1" comment:"页码"`
|
|
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
|
|
Status entities.ArticleStatus `form:"status" comment:"文章状态"`
|
|
CategoryID string `form:"category_id" comment:"分类ID"`
|
|
TagID string `form:"tag_id" comment:"标签ID"`
|
|
Title string `form:"title" comment:"标题关键词"`
|
|
Summary string `form:"summary" comment:"摘要关键词"`
|
|
IsFeatured *bool `form:"is_featured" comment:"是否推荐"`
|
|
OrderBy string `form:"order_by" comment:"排序字段"`
|
|
OrderDir string `form:"order_dir" comment:"排序方向"`
|
|
}
|
|
|
|
// SearchArticleQuery 文章搜索查询
|
|
type SearchArticleQuery struct {
|
|
Page int `form:"page" binding:"min=1" comment:"页码"`
|
|
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
|
|
Keyword string `form:"keyword" comment:"搜索关键词"`
|
|
CategoryID string `form:"category_id" comment:"分类ID"`
|
|
AuthorID string `form:"author_id" comment:"作者ID"`
|
|
Status entities.ArticleStatus `form:"status" comment:"文章状态"`
|
|
OrderBy string `form:"order_by" comment:"排序字段"`
|
|
OrderDir string `form:"order_dir" comment:"排序方向"`
|
|
}
|
|
|
|
// GetArticleQuery 获取文章详情查询
|
|
type GetArticleQuery struct {
|
|
ID string `uri:"id" binding:"required" comment:"文章ID"`
|
|
}
|
|
|
|
// GetArticlesByAuthorQuery 获取作者文章查询
|
|
type GetArticlesByAuthorQuery struct {
|
|
AuthorID string `uri:"author_id" binding:"required" comment:"作者ID"`
|
|
Page int `form:"page" binding:"min=1" comment:"页码"`
|
|
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
|
|
}
|
|
|
|
// GetArticlesByCategoryQuery 获取分类文章查询
|
|
type GetArticlesByCategoryQuery struct {
|
|
CategoryID string `uri:"category_id" binding:"required" comment:"分类ID"`
|
|
Page int `form:"page" binding:"min=1" comment:"页码"`
|
|
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
|
|
}
|
|
|
|
// GetFeaturedArticlesQuery 获取推荐文章查询
|
|
type GetFeaturedArticlesQuery struct {
|
|
Page int `form:"page" binding:"min=1" comment:"页码"`
|
|
PageSize int `form:"page_size" binding:"min=1,max=100" comment:"每页数量"`
|
|
}
|