diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-18 21:41:53 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-07-18 21:41:53 +0200 |
commit | 69d71c2a495d9cce1984ba2ffddf1d98622b01fe (patch) | |
tree | 3abd105a970fe773c0b19cb0c4f974688001e5e0 /pkg/database/sql | |
parent | 05a8dbf46792adfef007a0ffbcb654026db036fa (diff) | |
download | lens-69d71c2a495d9cce1984ba2ffddf1d98622b01fe.tar.gz lens-69d71c2a495d9cce1984ba2ffddf1d98622b01fe.tar.bz2 lens-69d71c2a495d9cce1984ba2ffddf1d98622b01fe.zip |
feat: Move to user path media
Now media also base on user folder to fetch its media.
Diffstat (limited to 'pkg/database/sql')
-rw-r--r-- | pkg/database/sql/media.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/database/sql/media.go b/pkg/database/sql/media.go index b8203f3..e5ba517 100644 --- a/pkg/database/sql/media.go +++ b/pkg/database/sql/media.go @@ -139,6 +139,7 @@ func (self *MediaRepository) List(ctx context.Context, pagination *repository.Pa Model(&Media{}). Offset(pagination.Page * pagination.Size). Limit(pagination.Size). + Where("path like '" + pagination.Path + "%'"). Order("created_at DESC"). Find(&medias) @@ -257,7 +258,7 @@ func (r *MediaRepository) ListEmptyEXIF(ctx context.Context, pagination *reposit WithContext(ctx). Model(&Media{}). Joins("left join media_exifs on media.id = media_exifs.media_id"). - Where("media_exifs.media_id IS NULL"). + Where("media_exifs.media_id IS NULL AND media.path like '" + pagination.Path + "%'"). Offset(pagination.Page * pagination.Size). Limit(pagination.Size). Order("media.created_at DESC"). @@ -280,7 +281,7 @@ func (r *MediaRepository) ListEmptyThumbnail(ctx context.Context, pagination *re WithContext(ctx). Model(&Media{}). Joins("left join media_thumbnails on media.id = media_thumbnails.media_id"). - Where("media_thumbnails.media_id IS NULL"). + Where("media_thumbnails.media_id IS NULL AND media.path like '" + pagination.Path + "%'"). Offset(pagination.Page * pagination.Size). Limit(pagination.Size). Order("media.created_at DESC"). |