Skip to content

Commit 051b7f9

Browse files
authored
fix(launch_screen): config list api (#520)
* feat(launch_screen): config list api * fix: use math.MaxInt * fix(launch_screen): list image soft delete support
1 parent 5e2dbc9 commit 051b7f9

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

pkg/db/launch_screen/list_image.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func (c *DBLaunchScreen) ListImage(ctx context.Context, pageNum, pageSize int) (
3737

3838
var total int64
3939
if err := c.client.WithContext(ctx).
40+
Model(&model.Picture{}).
4041
Table(constants.LaunchScreenTableName).
4142
Count(&total).Error; err != nil {
4243
return nil, 0, errno.NewErrNo(errno.InternalDatabaseErrorCode, fmt.Sprintf("dal.ListImage count error: %v", err))
@@ -45,6 +46,7 @@ func (c *DBLaunchScreen) ListImage(ctx context.Context, pageNum, pageSize int) (
4546
pictures := new([]model.Picture)
4647
offset := (pageNum - 1) * pageSize
4748
if err := c.client.WithContext(ctx).
49+
Model(&model.Picture{}).
4850
Table(constants.LaunchScreenTableName).
4951
Order("id DESC").
5052
Limit(pageSize).

pkg/db/launch_screen/list_image_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ func TestDBLaunchScreen_ListImage(t *testing.T) {
8888
mockey.Mock((*gorm.DB).WithContext).To(func(ctx context.Context) *gorm.DB {
8989
return mockGormDB
9090
}).Build()
91+
mockey.Mock((*gorm.DB).Model).To(func(value interface{}) *gorm.DB {
92+
return mockGormDB
93+
}).Build()
9194
mockey.Mock((*gorm.DB).Table).To(func(name string, args ...interface{}) *gorm.DB {
9295
return mockGormDB
9396
}).Build()

0 commit comments

Comments
 (0)