aboutsummaryrefslogtreecommitdiff
path: root/pkg/database/sql
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/database/sql')
-rw-r--r--pkg/database/sql/media.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/database/sql/media.go b/pkg/database/sql/media.go
index b13e267..16769bf 100644
--- a/pkg/database/sql/media.go
+++ b/pkg/database/sql/media.go
@@ -164,7 +164,8 @@ func (self *MediaRepository) List(ctx context.Context, pagination *repository.Pa
Offset(pagination.Page * pagination.Size).
Limit(pagination.Size).
Where("path like '" + pagination.Path + "%'").
- Order("created_at DESC").
+ Order("COALESCE (media_exifs.date_shot, media.created_at) DESC").
+ InnerJoins("INNER JOIN media_exifs ON media_exifs.media_id = media.id").
Find(&medias)
if result.Error != nil {