feat: expose createdAt in getAssetInfo (#21184)

* Expose createdAt in getAssetInfo

* Add missing createdAt fields
This commit is contained in:
Wingy 2025-08-25 11:27:21 -04:00 committed by GitHub
parent c2313f7a99
commit 5fb8d651ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 19 additions and 0 deletions

Binary file not shown.

View file

@ -10720,6 +10720,12 @@
"description": "base64 encoded sha1 hash", "description": "base64 encoded sha1 hash",
"type": "string" "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": { "deviceAssetId": {
"type": "string" "type": "string"
}, },
@ -10855,6 +10861,7 @@
}, },
"required": [ "required": [
"checksum", "checksum",
"createdAt",
"deviceAssetId", "deviceAssetId",
"deviceId", "deviceId",
"duration", "duration",

View file

@ -317,6 +317,8 @@ export type TagResponseDto = {
export type AssetResponseDto = { export type AssetResponseDto = {
/** base64 encoded sha1 hash */ /** base64 encoded sha1 hash */
checksum: string; checksum: string;
/** The UTC timestamp when the asset was originally uploaded to Immich. */
createdAt: string;
deviceAssetId: string; deviceAssetId: string;
deviceId: string; deviceId: string;
duplicateId?: string | null; duplicateId?: string | null;

View file

@ -37,6 +37,13 @@ export class SanitizedAssetResponseDto {
} }
export class AssetResponseDto extends 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; deviceAssetId!: string;
deviceId!: string; deviceId!: string;
ownerId!: string; ownerId!: string;
@ -190,6 +197,7 @@ export function mapAsset(entity: MapAsset, options: AssetMapOptions = {}): Asset
return { return {
id: entity.id, id: entity.id,
createdAt: entity.createdAt,
deviceAssetId: entity.deviceAssetId, deviceAssetId: entity.deviceAssetId,
ownerId: entity.ownerId, ownerId: entity.ownerId,
owner: entity.owner ? mapUser(entity.owner) : undefined, owner: entity.owner ? mapUser(entity.owner) : undefined,

View file

@ -46,6 +46,7 @@ const assetInfo: ExifResponseDto = {
const assetResponse: AssetResponseDto = { const assetResponse: AssetResponseDto = {
id: 'id_1', id: 'id_1',
createdAt: today,
deviceAssetId: 'device_asset_id_1', deviceAssetId: 'device_asset_id_1',
ownerId: 'user_id_1', ownerId: 'user_id_1',
deviceId: 'device_id_1', deviceId: 'device_id_1',

View file

@ -6,6 +6,7 @@ import { Sync } from 'factory.ts';
export const assetFactory = Sync.makeFactory<AssetResponseDto>({ export const assetFactory = Sync.makeFactory<AssetResponseDto>({
id: Sync.each(() => faker.string.uuid()), id: Sync.each(() => faker.string.uuid()),
createdAt: Sync.each(() => faker.date.past().toISOString()),
deviceAssetId: Sync.each(() => faker.string.uuid()), deviceAssetId: Sync.each(() => faker.string.uuid()),
ownerId: Sync.each(() => faker.string.uuid()), ownerId: Sync.each(() => faker.string.uuid()),
deviceId: '', deviceId: '',