56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package blog
|
||
|
||
import (
|
||
"context"
|
||
|
||
"gitlab.com/go-course-project/go17/vblog/utils"
|
||
)
|
||
|
||
type Service interface {
|
||
// 创建博客
|
||
CreateBlog(context.Context, *CreateBlogRequest) (*Blog, error)
|
||
// 博客列表查询
|
||
QueryBlog(context.Context, *QueryBlogRequest) (*BlogSet, error)
|
||
// 博客详情查询
|
||
DescribeBlog(context.Context, *DescribeBlogRequest) (*Blog, error)
|
||
// 博客编辑
|
||
UpdateBlog(context.Context, *UpdateBlogRequest) (*Blog, error)
|
||
// 发布
|
||
PublishBlog(context.Context, *PublishBlogRequest) (*Blog, error)
|
||
// 删除
|
||
DeleteBlog(context.Context, *DeleteBlogRequest) error
|
||
}
|
||
|
||
type DeleteBlogRequest struct {
|
||
utils.GetRequest
|
||
}
|
||
|
||
type PublishBlogRequest struct {
|
||
utils.GetRequest
|
||
StatusSpec
|
||
}
|
||
|
||
type UpdateBlogRequest struct {
|
||
utils.GetRequest
|
||
CreateBlogRequest
|
||
}
|
||
|
||
type DescribeBlogRequest struct {
|
||
utils.GetRequest
|
||
}
|
||
|
||
type QueryBlogRequest struct {
|
||
// 分页参数
|
||
utils.PageRequest
|
||
// 文章标题模糊匹配, Golang
|
||
Keywords string `json:"keywords"`
|
||
// 状态过滤参数, 作者:nil, 访客: STAGE_PUBLISHED
|
||
Stage *STAGE `json:"stage"`
|
||
// 查询某个用户具体的文章: 给作者用的
|
||
Username string `json:"username"`
|
||
// 分类
|
||
Category string `json:"category"`
|
||
// 查询Tag相关的文章
|
||
Tags map[string]string `json:"tag"`
|
||
}
|