mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(web): use timeline in geolocation manager (#21492)
This commit is contained in:
parent
5acd6b70d0
commit
7a1c45c364
20 changed files with 277 additions and 496 deletions
|
|
@ -53,6 +53,12 @@ export class TimeBucketDto {
|
|||
description: 'Filter by asset visibility status (ARCHIVE, TIMELINE, HIDDEN, LOCKED)',
|
||||
})
|
||||
visibility?: AssetVisibility;
|
||||
|
||||
@ValidateBoolean({
|
||||
optional: true,
|
||||
description: 'Include location data in the response',
|
||||
})
|
||||
withCoordinates?: boolean;
|
||||
}
|
||||
|
||||
export class TimeBucketAssetDto extends TimeBucketDto {
|
||||
|
|
@ -185,6 +191,22 @@ export class TimeBucketAssetResponseDto {
|
|||
description: 'Array of country names extracted from EXIF GPS data',
|
||||
})
|
||||
country!: (string | null)[];
|
||||
|
||||
@ApiProperty({
|
||||
type: 'array',
|
||||
required: false,
|
||||
items: { type: 'number', nullable: true },
|
||||
description: 'Array of latitude coordinates extracted from EXIF GPS data',
|
||||
})
|
||||
latitude!: number[];
|
||||
|
||||
@ApiProperty({
|
||||
type: 'array',
|
||||
required: false,
|
||||
items: { type: 'number', nullable: true },
|
||||
description: 'Array of longitude coordinates extracted from EXIF GPS data',
|
||||
})
|
||||
longitude!: number[];
|
||||
}
|
||||
|
||||
export class TimeBucketsResponseDto {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ interface AssetBuilderOptions {
|
|||
status?: AssetStatus;
|
||||
assetType?: AssetType;
|
||||
visibility?: AssetVisibility;
|
||||
withCoordinates?: boolean;
|
||||
}
|
||||
|
||||
export interface TimeBucketOptions extends AssetBuilderOptions {
|
||||
|
|
@ -628,6 +629,7 @@ export class AssetRepository {
|
|||
)
|
||||
.as('ratio'),
|
||||
])
|
||||
.$if(!!options.withCoordinates, (qb) => qb.select(['asset_exif.latitude', 'asset_exif.longitude']))
|
||||
.where('asset.deletedAt', options.isTrashed ? 'is not' : 'is', null)
|
||||
.$if(options.visibility == undefined, withDefaultVisibility)
|
||||
.$if(!!options.visibility, (qb) => qb.where('asset.visibility', '=', options.visibility!))
|
||||
|
|
@ -701,6 +703,12 @@ export class AssetRepository {
|
|||
eb.fn.coalesce(eb.fn('array_agg', ['status']), sql.lit('{}')).as('status'),
|
||||
eb.fn.coalesce(eb.fn('array_agg', ['thumbhash']), sql.lit('{}')).as('thumbhash'),
|
||||
])
|
||||
.$if(!!options.withCoordinates, (qb) =>
|
||||
qb.select((eb) => [
|
||||
eb.fn.coalesce(eb.fn('array_agg', ['latitude']), sql.lit('{}')).as('latitude'),
|
||||
eb.fn.coalesce(eb.fn('array_agg', ['longitude']), sql.lit('{}')).as('longitude'),
|
||||
]),
|
||||
)
|
||||
.$if(!!options.withStacked, (qb) =>
|
||||
qb.select((eb) => eb.fn.coalesce(eb.fn('json_agg', ['stack']), sql.lit('[]')).as('stack')),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue