fix: technical debts left by the Sites, Authors and SEO slices, plus backend support for the new Sites and Authors pagination
This commit is contained in:
1 parent
9f4ce426a8
commit
daf3594316
86 files changed
+4223
-1485
No files matched your search
@@ -82,8 +82,7 @@ func (l *ListMediaUseCase) List(query image.ListQuery) (MediaPage, error) {
|
||||
}
|
||||
}
|
||||
|
||||
offset := (query.Page - 1) * query.Size
|
||||
pageStart := min(offset, len(matching))
|
||||
pageStart := min(min(query.Page-1, len(matching))*query.Size, len(matching))
|
||||
pageEnd := min(pageStart+query.Size, len(matching))
|
||||
names := newUploaderNames(l.userRepository)
|
||||
items := []MediaItem{}
|
||||
@@ -106,6 +105,14 @@ func (l *ListMediaUseCase) List(query image.ListQuery) (MediaPage, error) {
|
||||
return MediaPage{Items: items, Total: len(matching), Page: query.Page, Size: query.Size, Counts: counts}, nil
|
||||
}
|
||||
|
||||
func (l *ListMediaUseCase) Get(id uint32) (MediaItem, error) {
|
||||
found, err := l.imageRepository.Get(id)
|
||||
if err != nil {
|
||||
return MediaItem{}, err
|
||||
}
|
||||
return l.Describe(found)
|
||||
}
|
||||
|
||||
func (l *ListMediaUseCase) Describe(img image.Image) (MediaItem, error) {
|
||||
articleCount, err := l.articleUsageCount(img)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user