Skip to content

High performance self-hosted photo and video management solution.

fix(server): memory lane assets order (#15882)

Alex06f077bac25d
diff --git a/server/src/queries/asset.repository.sql b/server/src/queries/asset.repository.sql
index 948f7dd114..437e1e173c 100644
--- a/server/src/queries/asset.repository.sql
+++ b/server/src/queries/asset.repository.sql
@@ -47,6 +47,8 @@ with
and "asset_files"."type" = $6
)
and "assets"."deletedAt" is null
+ order by
+ (assets."localDateTime" at time zone 'UTC')::date desc
limit
$7
) as "a" on true
diff --git a/server/src/repositories/asset.repository.ts b/server/src/repositories/asset.repository.ts
index b306b1a694..1f52b9c71a 100644
--- a/server/src/repositories/asset.repository.ts
+++ b/server/src/repositories/asset.repository.ts
@@ -121,6 +121,7 @@ export class AssetRepository implements IAssetRepository {
),
)
.where('assets.deletedAt', 'is', null)
+ .orderBy(sql`(assets."localDateTime" at time zone 'UTC')::date`, 'desc')
.limit(20)
.as('a'),
(join) => join.onTrue(),