string tuple

This commit is contained in:
mertalev
2025-05-05 10:33:48 -04:00
parent 21bbf2f5e2
commit 71cc045405
12 changed files with 21 additions and 127 deletions

View File

@@ -87,13 +87,14 @@ export class TimeBucketAssetResponseDto implements TimeBucketAssets {
@ApiProperty({
type: 'array',
items: {
type: 'array',
type: 'string',
nullable: true,
items: { oneOf: [{ type: 'string' }, { type: 'number' }], minItems: 2, maxItems: 2 },
},
description: 'The stack ID and stack asset count as a tuple',
maxItems: 2,
minItems: 2,
description: '(stack ID, stack asset count) tuple',
})
stack?: ([string, number] | null)[];
stack?: ([string, string] | null)[];
@ApiProperty({ type: 'array', items: { type: 'string', nullable: true } })
projectionType!: (string | null)[];

View File

@@ -293,7 +293,7 @@ with
inner join "exif" on "assets"."id" = "exif"."assetId"
left join lateral (
select
json_build_array(stacked."stackId", count('stacked')) as "stack"
array[stacked."stackId"::text, count('stacked')::text] as "stack"
from
"assets" as "stacked"
where

View File

@@ -652,7 +652,7 @@ export class AssetRepository {
(eb) =>
eb
.selectFrom('assets as stacked')
.select(sql`json_build_array(stacked."stackId", count('stacked'))`.as('stack'))
.select(sql`array[stacked."stackId"::text, count('stacked')::text]`.as('stack'))
.whereRef('stacked.stackId', '=', 'assets.stackId')
.where('stacked.deletedAt', 'is', null)
.where('stacked.isArchived', '=', false)

View File

@@ -19,7 +19,7 @@ export type TimeBucketAssets = {
isImage: number[];
thumbhash: (string | null)[];
localDateTime: string[];
stack?: ([string, number] | null)[];
stack?: ([string, string] | null)[];
duration: (string | null)[];
projectionType: (string | null)[];
livePhotoVideoId: (string | null)[];