From 5fb8d651ecbac621ae1216f29cbc1e1465d46222 Mon Sep 17 00:00:00 2001 From: Wingy Date: Mon, 25 Aug 2025 11:27:21 -0400 Subject: [PATCH] feat: expose createdAt in getAssetInfo (#21184) * Expose createdAt in getAssetInfo * Add missing createdAt fields --- .../openapi/lib/model/asset_response_dto.dart | Bin 14383 -> 14738 bytes open-api/immich-openapi-specs.json | 7 +++++++ open-api/typescript-sdk/src/fetch-client.ts | 2 ++ server/src/dtos/asset-response.dto.ts | 8 ++++++++ server/test/fixtures/shared-link.stub.ts | 1 + web/src/test-data/factories/asset-factory.ts | 1 + 6 files changed, 19 insertions(+) diff --git a/mobile/openapi/lib/model/asset_response_dto.dart b/mobile/openapi/lib/model/asset_response_dto.dart index e2f60937f8e41fb01f471ec289558fa4db03807b..dc957b3bfc38095e7eaf86b35477820567988847 100644 GIT binary patch delta 236 zcmZ2qFsXRMI!5N?qSVQ2S)?YPXJp&Fg)y3$U0+{cAtWPp@<%oa+r;AH)DngA#A1c~ zqRjNnyu_TGN`=yboczR;)D(r1dK-7w8Um1@pKjuxI$YMICFEkv@J72Mm<)+R-q&#vsf>Aa=e1! g<}Gr~Twp`;3}nD`uYts7bInD(oCp&xn#C~!0BEI8<^TWy delta 51 zcmV-30L=fAbFXl)t^u>l0bv8PjRg!1v%M1c1hdZavxzFA J4YNErRsk$f6chje diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index d9d10e0d6..eb9b6ac5a 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -10720,6 +10720,12 @@ "description": "base64 encoded sha1 hash", "type": "string" }, + "createdAt": { + "description": "The UTC timestamp when the asset was originally uploaded to Immich.", + "example": "2024-01-15T20:30:00.000Z", + "format": "date-time", + "type": "string" + }, "deviceAssetId": { "type": "string" }, @@ -10855,6 +10861,7 @@ }, "required": [ "checksum", + "createdAt", "deviceAssetId", "deviceId", "duration", diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 8d83f9d11..08fa71482 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -317,6 +317,8 @@ export type TagResponseDto = { export type AssetResponseDto = { /** base64 encoded sha1 hash */ checksum: string; + /** The UTC timestamp when the asset was originally uploaded to Immich. */ + createdAt: string; deviceAssetId: string; deviceId: string; duplicateId?: string | null; diff --git a/server/src/dtos/asset-response.dto.ts b/server/src/dtos/asset-response.dto.ts index 98ed8669f..f60f2a882 100644 --- a/server/src/dtos/asset-response.dto.ts +++ b/server/src/dtos/asset-response.dto.ts @@ -37,6 +37,13 @@ export class SanitizedAssetResponseDto { } export class AssetResponseDto extends SanitizedAssetResponseDto { + @ApiProperty({ + type: 'string', + format: 'date-time', + description: 'The UTC timestamp when the asset was originally uploaded to Immich.', + example: '2024-01-15T20:30:00.000Z', + }) + createdAt!: Date; deviceAssetId!: string; deviceId!: string; ownerId!: string; @@ -190,6 +197,7 @@ export function mapAsset(entity: MapAsset, options: AssetMapOptions = {}): Asset return { id: entity.id, + createdAt: entity.createdAt, deviceAssetId: entity.deviceAssetId, ownerId: entity.ownerId, owner: entity.owner ? mapUser(entity.owner) : undefined, diff --git a/server/test/fixtures/shared-link.stub.ts b/server/test/fixtures/shared-link.stub.ts index 1cd36f1f2..19a62ad19 100644 --- a/server/test/fixtures/shared-link.stub.ts +++ b/server/test/fixtures/shared-link.stub.ts @@ -46,6 +46,7 @@ const assetInfo: ExifResponseDto = { const assetResponse: AssetResponseDto = { id: 'id_1', + createdAt: today, deviceAssetId: 'device_asset_id_1', ownerId: 'user_id_1', deviceId: 'device_id_1', diff --git a/web/src/test-data/factories/asset-factory.ts b/web/src/test-data/factories/asset-factory.ts index c2f03f9c6..8d328ddcc 100644 --- a/web/src/test-data/factories/asset-factory.ts +++ b/web/src/test-data/factories/asset-factory.ts @@ -6,6 +6,7 @@ import { Sync } from 'factory.ts'; export const assetFactory = Sync.makeFactory({ id: Sync.each(() => faker.string.uuid()), + createdAt: Sync.each(() => faker.date.past().toISOString()), deviceAssetId: Sync.each(() => faker.string.uuid()), ownerId: Sync.each(() => faker.string.uuid()), deviceId: '',