feat: fix issues
This commit is contained in:
@@ -81,7 +81,7 @@ func (svc *Service) GetMediaByID(ctx context.Context, tenantId, userId, id int64
|
||||
}
|
||||
|
||||
func (svc *Service) ModelToListItem(ctx context.Context, m *model.Medias) *ListItem {
|
||||
return &ListItem{
|
||||
item := &ListItem{
|
||||
ID: m.ID,
|
||||
Poster: fmt.Sprintf("/static/%s/poster.jpg", m.Hash),
|
||||
Hash: m.Hash,
|
||||
@@ -93,7 +93,10 @@ func (svc *Service) ModelToListItem(ctx context.Context, m *model.Medias) *ListI
|
||||
Resources: m.Resources,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
Bought: false,
|
||||
}
|
||||
|
||||
return item
|
||||
}
|
||||
|
||||
// List
|
||||
@@ -146,7 +149,11 @@ func (svc *Service) List(ctx context.Context, tenantId, userId int64, filter *Li
|
||||
}
|
||||
|
||||
items := lo.Map(dest, func(m model.Medias, _ int) *ListItem {
|
||||
return svc.ModelToListItem(ctx, &m)
|
||||
item := svc.ModelToListItem(ctx, &m)
|
||||
if lo.Contains(boughtIDs, m.ID) {
|
||||
item.Bought = true
|
||||
}
|
||||
return item
|
||||
})
|
||||
|
||||
return items, nil
|
||||
|
||||
Reference in New Issue
Block a user