feat: add ordering by file creation date in asset and stack repositories

pull/24033/head
timonrieger 2025-11-20 13:13:05 +07:00
parent 1e1cf0d1fe
commit 024ef94fb2
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

@ -436,6 +436,7 @@ export class AssetRepository {
.whereRef('stacked.id', '!=', 'stack.primaryAssetId')
.where('stacked.deletedAt', 'is', null)
.where('stacked.visibility', '=', AssetVisibility.Timeline)
.orderBy('stacked.fileCreatedAt', 'asc')
.groupBy('stack.id')
.as('stacked_assets'),
(join) => join.on('stack.id', 'is not', null),

@ -41,7 +41,8 @@ const withAssets = (eb: ExpressionBuilder<DB, 'stack'>, withTags = false) => {
.select((eb) => eb.fn.toJson('exifInfo').as('exifInfo'))
.where('asset.deletedAt', 'is', null)
.whereRef('asset.stackId', '=', 'stack.id')
.$call(withDefaultVisibility),
.$call(withDefaultVisibility)
.orderBy('asset.fileCreatedAt', 'asc'),
).as('assets');
};