aboutsummaryrefslogtreecommitdiff
path: root/pkg/components
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-29 23:21:56 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-06-29 23:21:56 +0200
commit1ae70dbd9124675d4a510954619b01edd5f1f6c3 (patch)
treee6db7f5553a00094d048b6a4d03163853a5a4e7c /pkg/components
parent024da3e546e98cbaeea5f7bc86af12b671996f41 (diff)
downloadlens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.tar.gz
lens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.tar.bz2
lens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.zip
ref: Move away other repositories
Finish moving all repositories to a repository package. This should reduce the amount of packages.
Diffstat (limited to 'pkg/components')
-rw-r--r--pkg/components/filesystem/controller.go6
-rw-r--r--pkg/components/filesystem/model.go10
-rw-r--r--pkg/components/media/model.go64
-rw-r--r--pkg/components/settings/model.go15
4 files changed, 4 insertions, 91 deletions
diff --git a/pkg/components/filesystem/controller.go b/pkg/components/filesystem/controller.go
index 6b478a5..6c613a3 100644
--- a/pkg/components/filesystem/controller.go
+++ b/pkg/components/filesystem/controller.go
@@ -5,11 +5,13 @@ import (
"net/url"
"path"
"strings"
+
+ "git.sr.ht/~gabrielgio/img/pkg/database/repository"
)
type (
Controller struct {
- repository Repository
+ repository repository.FileSystemRepository
}
DirectoryParam struct {
@@ -28,7 +30,7 @@ type (
}
)
-func NewController(repository Repository) *Controller {
+func NewController(repository repository.FileSystemRepository) *Controller {
return &Controller{
repository: repository,
}
diff --git a/pkg/components/filesystem/model.go b/pkg/components/filesystem/model.go
deleted file mode 100644
index 2caed82..0000000
--- a/pkg/components/filesystem/model.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package filesystem
-
-import "io/fs"
-
-type (
- Repository interface {
- List(path string) ([]fs.FileInfo, error)
- Stat(path string) (fs.FileInfo, error)
- }
-)
diff --git a/pkg/components/media/model.go b/pkg/components/media/model.go
deleted file mode 100644
index 1962a23..0000000
--- a/pkg/components/media/model.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package media
-
-import (
- "context"
- "strings"
- "time"
-)
-
-type (
- Media struct {
- ID uint
- Name string
- Path string
- PathHash string
- MIMEType string
- }
-
- MediaEXIF struct {
- Width *float64
- Height *float64
- Description *string
- Camera *string
- Maker *string
- Lens *string
- DateShot *time.Time
- Exposure *float64
- Aperture *float64
- Iso *int64
- FocalLength *float64
- Flash *int64
- Orientation *int64
- ExposureProgram *int64
- GPSLatitude *float64
- GPSLongitude *float64
- }
-
- Pagination struct {
- Page int
- Size int
- }
-
- CreateMedia struct {
- Name string
- Path string
- PathHash string
- MIMEType string
- }
-
- Repository interface {
- Create(context.Context, *CreateMedia) error
- Exists(context.Context, string) (bool, error)
- List(context.Context, *Pagination) ([]*Media, error)
- Get(context.Context, string) (*Media, error)
- GetPath(context.Context, string) (string, error)
-
- GetEmptyEXIF(context.Context, *Pagination) ([]*Media, error)
- GetEXIF(context.Context, uint) (*MediaEXIF, error)
- CreateEXIF(context.Context, uint, *MediaEXIF) error
- }
-)
-
-func (m *Media) IsVideo() bool {
- return strings.HasPrefix(m.MIMEType, "video")
-}
diff --git a/pkg/components/settings/model.go b/pkg/components/settings/model.go
deleted file mode 100644
index da07f2c..0000000
--- a/pkg/components/settings/model.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package settings
-
-import "context"
-
-type (
- Settings struct {
- ShowMode bool
- ShowOwner bool
- }
-
- Repository interface {
- Save(context.Context, *Settings) error
- Load(context.Context) (*Settings, error)
- }
-)