feat: site languages, setup and site URL settings
This commit is contained in:
1 parent
0806733d5c
commit
d9158025d4
106 files changed
+10184
-56
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
"RenewCMS/internal/domain/localization"
|
||||
"RenewCMS/internal/domain/site"
|
||||
)
|
||||
|
||||
type GetSiteLanguagesUseCase struct {
|
||||
sites site.Repository
|
||||
localization localization.Repository
|
||||
}
|
||||
|
||||
func NewGetSiteLanguagesUseCase(sites site.Repository, localization localization.Repository) *GetSiteLanguagesUseCase {
|
||||
return &GetSiteLanguagesUseCase{sites, localization}
|
||||
}
|
||||
|
||||
func (g *GetSiteLanguagesUseCase) Get(key string) (localization.View, error) {
|
||||
found, err := g.sites.GetByKey(key)
|
||||
if err != nil {
|
||||
return localization.View{}, err
|
||||
}
|
||||
return readSiteLanguages(g.localization, found.ID)
|
||||
}
|
||||
|
||||
func readSiteLanguages(repository localization.Repository, siteID uint32) (localization.View, error) {
|
||||
rows, err := repository.Rows(siteID)
|
||||
if err != nil {
|
||||
return localization.View{}, err
|
||||
}
|
||||
counts, err := repository.VersionCounts(siteID)
|
||||
if err != nil {
|
||||
return localization.View{}, err
|
||||
}
|
||||
return localization.BuildView(rows, counts), nil
|
||||
}
|
||||
Reference in new issue
Block a user