pull/24033/merge
Timon 2026-06-03 15:02:17 +02:00 committed by GitHub
commit 3760ab79b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -54,6 +54,8 @@ select
"asset"."deletedAt" is null
and "asset"."stackId" = "stack"."id"
and "asset"."visibility" in ('archive', 'timeline')
order by
"asset"."fileCreatedAt" asc
) as agg
) as "assets"
from
@ -139,6 +141,8 @@ select
"asset"."deletedAt" is null
and "asset"."stackId" = "stack"."id"
and "asset"."visibility" in ('archive', 'timeline')
order by
"asset"."fileCreatedAt" asc
) as agg
) as "assets"
from

View File

@ -6,7 +6,6 @@ import {
NotNull,
Selectable,
SelectQueryBuilder,
ShallowDehydrateObject,
sql,
Updateable,
UpdateResult,
@ -583,10 +582,8 @@ export class AssetRepository {
eb
.selectFrom('asset as stacked')
.selectAll('stack')
.select((eb) =>
eb
.fn<ShallowDehydrateObject<Selectable<AssetTable>>>('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')

View File

@ -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');
};