aboutsummaryrefslogtreecommitdiff
path: root/pkg/view
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/view')
-rw-r--r--pkg/view/filesystem.go6
-rw-r--r--pkg/view/media.go16
-rw-r--r--pkg/view/settings.go9
3 files changed, 15 insertions, 16 deletions
diff --git a/pkg/view/filesystem.go b/pkg/view/filesystem.go
index f10d788..d2ebff4 100644
--- a/pkg/view/filesystem.go
+++ b/pkg/view/filesystem.go
@@ -5,14 +5,14 @@ import (
"git.sr.ht/~gabrielgio/img"
"git.sr.ht/~gabrielgio/img/pkg/components/filesystem"
- "git.sr.ht/~gabrielgio/img/pkg/components/settings"
+ "git.sr.ht/~gabrielgio/img/pkg/database/repository"
"git.sr.ht/~gabrielgio/img/pkg/ext"
)
type (
FileSystemView struct {
controller filesystem.Controller
- settings settings.Repository
+ settings repository.SettingsRepository
}
FilePage struct {
Page *filesystem.Page
@@ -23,7 +23,7 @@ type (
func NewFileSystemView(
controller filesystem.Controller,
- settingsRepository settings.Repository,
+ settingsRepository repository.SettingsRepository,
) *FileSystemView {
return &FileSystemView{
controller: controller,
diff --git a/pkg/view/media.go b/pkg/view/media.go
index 66e3020..ce9e272 100644
--- a/pkg/view/media.go
+++ b/pkg/view/media.go
@@ -6,22 +6,22 @@ import (
"github.com/valyala/fasthttp"
"git.sr.ht/~gabrielgio/img"
- "git.sr.ht/~gabrielgio/img/pkg/components/media"
+ "git.sr.ht/~gabrielgio/img/pkg/database/repository"
"git.sr.ht/~gabrielgio/img/pkg/ext"
)
type (
MediaView struct {
- mediaRepository media.Repository
+ mediaRepository repository.MediaRepository
}
Page struct {
- Medias []*media.Media
- Next *media.Pagination
+ Medias []*repository.Media
+ Next *repository.Pagination
}
)
-func getPagination(ctx *fasthttp.RequestCtx) *media.Pagination {
+func getPagination(ctx *fasthttp.RequestCtx) *repository.Pagination {
var (
size int
page int
@@ -45,13 +45,13 @@ func getPagination(ctx *fasthttp.RequestCtx) *media.Pagination {
page = p
}
- return &media.Pagination{
+ return &repository.Pagination{
Page: page,
Size: size,
}
}
-func NewMediaView(mediaRepository media.Repository) *MediaView {
+func NewMediaView(mediaRepository repository.MediaRepository) *MediaView {
return &MediaView{
mediaRepository: mediaRepository,
}
@@ -68,7 +68,7 @@ func (self *MediaView) Index(ctx *fasthttp.RequestCtx) error {
Title: "Media",
Data: &Page{
Medias: medias,
- Next: &media.Pagination{
+ Next: &repository.Pagination{
Size: p.Size,
Page: p.Page + 1,
},
diff --git a/pkg/view/settings.go b/pkg/view/settings.go
index 954cc98..14f4e49 100644
--- a/pkg/view/settings.go
+++ b/pkg/view/settings.go
@@ -4,7 +4,6 @@ import (
"github.com/valyala/fasthttp"
"git.sr.ht/~gabrielgio/img"
- "git.sr.ht/~gabrielgio/img/pkg/components/settings"
"git.sr.ht/~gabrielgio/img/pkg/database/repository"
"git.sr.ht/~gabrielgio/img/pkg/ext"
)
@@ -12,18 +11,18 @@ import (
type (
SettingsView struct {
// there is not need to create a controller for this
- settingsRepository settings.Repository
+ settingsRepository repository.SettingsRepository
userRepository repository.UserRepository
}
SettingsPage struct {
- Settings *settings.Settings
+ Settings *repository.Settings
Users []*repository.User
}
)
func NewSettingsView(
- settingsRespository settings.Repository,
+ settingsRespository repository.SettingsRepository,
userRepository repository.UserRepository,
) *SettingsView {
return &SettingsView{
@@ -58,7 +57,7 @@ func (self *SettingsView) Save(ctx *fasthttp.RequestCtx) error {
showOwner = string(ctx.FormValue("showOwner")) == "on"
)
- err := self.settingsRepository.Save(ctx, &settings.Settings{
+ err := self.settingsRepository.Save(ctx, &repository.Settings{
ShowMode: showMode,
ShowOwner: showOwner,
})