From 73cd236756ebd29e58243bcf11d264d1693e1078 Mon Sep 17 00:00:00 2001 From: Min Idzelis Date: Sat, 3 May 2025 13:33:58 +0000 Subject: [PATCH] date->string --- .../openapi/lib/model/time_bucket_asset_response_dto.dart | 6 ++++-- open-api/immich-openapi-specs.json | 1 - server/src/dtos/time-bucket.dto.ts | 4 ++-- server/src/repositories/asset.repository.ts | 1 + server/src/services/timeline.service.ts | 2 +- server/src/services/timeline.service.types.ts | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart b/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart index 22c82f69ad..4e724437d3 100644 --- a/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart +++ b/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart @@ -48,7 +48,7 @@ class TimeBucketAssetResponseDto { List livePhotoVideoId; - List localDateTime; + List localDateTime; List ownerId; @@ -154,7 +154,9 @@ class TimeBucketAssetResponseDto { livePhotoVideoId: json[r'livePhotoVideoId'] is Iterable ? (json[r'livePhotoVideoId'] as Iterable).cast().toList(growable: false) : const [], - localDateTime: DateTime.listFromJson(json[r'localDateTime']), + localDateTime: json[r'localDateTime'] is Iterable + ? (json[r'localDateTime'] as Iterable).cast().toList(growable: false) + : const [], ownerId: json[r'ownerId'] is Iterable ? (json[r'ownerId'] as Iterable).cast().toList(growable: false) : const [], diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index b96405c413..b99c28c23d 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -13627,7 +13627,6 @@ "localDateTime": { "default": [], "items": { - "format": "date-time", "type": "string" }, "type": "array" diff --git a/server/src/dtos/time-bucket.dto.ts b/server/src/dtos/time-bucket.dto.ts index ced47c00ff..4fddd01b1a 100644 --- a/server/src/dtos/time-bucket.dto.ts +++ b/server/src/dtos/time-bucket.dto.ts @@ -99,8 +99,8 @@ export class TimeBucketAssetResponseDto implements TimeBucketAssets { @ApiProperty({ type: [String] }) thumbhash: (string | null)[] = []; - @ApiProperty() - localDateTime: Date[] = []; + @ApiProperty({ type: [String] }) + localDateTime: string[] = []; @ApiProperty({ type: [String] }) duration: (string | null)[] = []; diff --git a/server/src/repositories/asset.repository.ts b/server/src/repositories/asset.repository.ts index 3e666184d1..d4b93e5cc7 100644 --- a/server/src/repositories/asset.repository.ts +++ b/server/src/repositories/asset.repository.ts @@ -612,6 +612,7 @@ export class AssetRepository { 'exif.city as city', 'exif.country as country', ]) + .select(sql`to_json("localDateTime" at time zone 'UTC')#>>'{}'`.as('localDateTime')) .$if(!!options.albumId, (qb) => qb .innerJoin('albums_assets_assets', 'albums_assets_assets.assetsId', 'assets.id') diff --git a/server/src/services/timeline.service.ts b/server/src/services/timeline.service.ts index 1615537dee..9332f83745 100644 --- a/server/src/services/timeline.service.ts +++ b/server/src/services/timeline.service.ts @@ -20,7 +20,7 @@ export class TimelineService extends BaseService { async getTimeBuckets(auth: AuthDto, dto: TimeBucketDto): Promise { await this.timeBucketChecks(auth, dto); const timeBucketOptions = await this.buildTimeBucketOptions(auth, dto); - return this.assetRepository.getTimeBuckets(timeBucketOptions); + return await this.assetRepository.getTimeBuckets(timeBucketOptions); } async getTimeBucket(auth: AuthDto, dto: TimeBucketAssetDto): Promise { diff --git a/server/src/services/timeline.service.types.ts b/server/src/services/timeline.service.types.ts index 21ecadf847..09a5c0e667 100644 --- a/server/src/services/timeline.service.types.ts +++ b/server/src/services/timeline.service.types.ts @@ -19,7 +19,7 @@ export type TimeBucketAssets = { isVideo: number[]; isImage: number[]; thumbhash: (string | null)[]; - localDateTime: Date[]; + localDateTime: string[]; stack: (TimelineStack | null)[]; duration: (string | null)[]; projectionType: (string | null)[];