Timon 2025-12-10 18:13:11 +07:00 committed by GitHub
commit f753d746b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

@ -431,7 +431,9 @@ export class AssetRepository {
eb
.selectFrom('asset as stacked')
.selectAll('stack')
.select((eb) => eb.fn('array_agg', [eb.table('stacked')]).as('assets'))
.select(
sql<unknown[]>`array_agg(to_json(stacked) ORDER BY stacked."fileCreatedAt" ASC)`.as('assets'),
)
.whereRef('stacked.stackId', '=', 'stack.id')
.whereRef('stacked.id', '!=', 'stack.primaryAssetId')
.where('stacked.deletedAt', 'is', 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');
};