Skip to content

Commit 9a94148

Browse files
Wingysamollioddi
authored andcommitted
feat: expose createdAt in getAssetInfo (immich-app#21184)
* Expose createdAt in getAssetInfo * Add missing createdAt fields
1 parent c82e68f commit 9a94148

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-1
lines changed

mobile/openapi/lib/model/asset_response_dto.dart

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

open-api/immich-openapi-specs.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10720,6 +10720,12 @@
1072010720
"description": "base64 encoded sha1 hash",
1072110721
"type": "string"
1072210722
},
10723+
"createdAt": {
10724+
"description": "The UTC timestamp when the asset was originally uploaded to Immich.",
10725+
"example": "2024-01-15T20:30:00.000Z",
10726+
"format": "date-time",
10727+
"type": "string"
10728+
},
1072310729
"deviceAssetId": {
1072410730
"type": "string"
1072510731
},
@@ -10855,6 +10861,7 @@
1085510861
},
1085610862
"required": [
1085710863
"checksum",
10864+
"createdAt",
1085810865
"deviceAssetId",
1085910866
"deviceId",
1086010867
"duration",

open-api/typescript-sdk/src/fetch-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ export type TagResponseDto = {
317317
export type AssetResponseDto = {
318318
/** base64 encoded sha1 hash */
319319
checksum: string;
320+
/** The UTC timestamp when the asset was originally uploaded to Immich. */
321+
createdAt: string;
320322
deviceAssetId: string;
321323
deviceId: string;
322324
duplicateId?: string | null;

server/src/dtos/asset-response.dto.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ export class SanitizedAssetResponseDto {
3737
}
3838

3939
export class AssetResponseDto extends SanitizedAssetResponseDto {
40+
@ApiProperty({
41+
type: 'string',
42+
format: 'date-time',
43+
description: 'The UTC timestamp when the asset was originally uploaded to Immich.',
44+
example: '2024-01-15T20:30:00.000Z',
45+
})
46+
createdAt!: Date;
4047
deviceAssetId!: string;
4148
deviceId!: string;
4249
ownerId!: string;
@@ -190,6 +197,7 @@ export function mapAsset(entity: MapAsset, options: AssetMapOptions = {}): Asset
190197

191198
return {
192199
id: entity.id,
200+
createdAt: entity.createdAt,
193201
deviceAssetId: entity.deviceAssetId,
194202
ownerId: entity.ownerId,
195203
owner: entity.owner ? mapUser(entity.owner) : undefined,

server/test/fixtures/shared-link.stub.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const assetInfo: ExifResponseDto = {
4646

4747
const assetResponse: AssetResponseDto = {
4848
id: 'id_1',
49+
createdAt: today,
4950
deviceAssetId: 'device_asset_id_1',
5051
ownerId: 'user_id_1',
5152
deviceId: 'device_id_1',

web/src/test-data/factories/asset-factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Sync } from 'factory.ts';
66

77
export const assetFactory = Sync.makeFactory<AssetResponseDto>({
88
id: Sync.each(() => faker.string.uuid()),
9+
createdAt: Sync.each(() => faker.date.past().toISOString()),
910
deviceAssetId: Sync.each(() => faker.string.uuid()),
1011
ownerId: Sync.each(() => faker.string.uuid()),
1112
deviceId: '',

0 commit comments

Comments
 (0)