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
@@ -6,6 +6,17 @@ type ListSitesUseCase struct {
|
||||
siteRepository site.Repository
|
||||
}
|
||||
|
||||
type ListSitesCommand struct {
|
||||
Q string
|
||||
Page int
|
||||
Size int
|
||||
}
|
||||
|
||||
type SitePage struct {
|
||||
Items []site.Site
|
||||
Total int
|
||||
}
|
||||
|
||||
func NewListSitesUseCase(siteRepository site.Repository) *ListSitesUseCase {
|
||||
return &ListSitesUseCase{siteRepository}
|
||||
}
|
||||
@@ -13,3 +24,11 @@ func NewListSitesUseCase(siteRepository site.Repository) *ListSitesUseCase {
|
||||
func (u *ListSitesUseCase) List() ([]site.Site, error) {
|
||||
return u.siteRepository.List()
|
||||
}
|
||||
|
||||
func (u *ListSitesUseCase) ListPage(command ListSitesCommand) (SitePage, error) {
|
||||
found, err := u.siteRepository.Find(site.ListQuery{Q: command.Q, Page: command.Page, Size: command.Size})
|
||||
if err != nil {
|
||||
return SitePage{}, err
|
||||
}
|
||||
return SitePage{Items: found.Items, Total: found.Total}, nil
|
||||
}
|
||||
Reference in new issue
Block a user