feat: 重构内容列表接口,使用过滤器结构体简化参数传递;更新相关服务和测试用例
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"quyun/v2/app/commands/testx"
|
||||
content_dto "quyun/v2/app/http/v1/dto"
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/database"
|
||||
"quyun/v2/database/models"
|
||||
"quyun/v2/pkg/consts"
|
||||
@@ -65,7 +66,14 @@ func (s *ContentTestSuite) Test_List() {
|
||||
models.ContentQuery.WithContext(ctx).Create(c1, c2)
|
||||
|
||||
Convey("should list only published contents", func() {
|
||||
res, err := Content.List(ctx, "", "", "1", "", 1)
|
||||
filter := &content_dto.ContentListFilter{
|
||||
TenantID: "1",
|
||||
Pagination: requests.Pagination{
|
||||
Page: 1,
|
||||
Limit: 10,
|
||||
},
|
||||
}
|
||||
res, err := Content.List(ctx, filter)
|
||||
So(err, ShouldBeNil)
|
||||
So(res.Total, ShouldEqual, 1)
|
||||
items := res.Items.([]content_dto.ContentItem)
|
||||
|
||||
Reference in New Issue
Block a user