mirror of
https://github.com/immich-app/immich.git
synced 2024-11-24 08:52:28 +02:00
feat(server): track metadata extracted at (#6352)
This commit is contained in:
parent
19e9908ee2
commit
f4edb6c4bd
@ -252,6 +252,11 @@ export class MetadataService {
|
||||
fileCreatedAt: exifData.dateTimeOriginal ?? undefined,
|
||||
});
|
||||
|
||||
await this.assetRepository.upsertJobStatus({
|
||||
assetId: asset.id,
|
||||
metadataExtractedAt: new Date(),
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,4 +12,7 @@ export class AssetJobStatusEntity {
|
||||
|
||||
@Column({ type: 'timestamptz', nullable: true })
|
||||
facesRecognizedAt!: Date | null;
|
||||
|
||||
@Column({ type: 'timestamptz', nullable: true })
|
||||
metadataExtractedAt!: Date | null;
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddMetadataExtractedAt1705094221536 implements MigrationInterface {
|
||||
name = 'AddMetadataExtractedAt1705094221536';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "asset_job_status" ADD "metadataExtractedAt" TIMESTAMP WITH TIME ZONE`);
|
||||
await queryRunner.query(`
|
||||
UPDATE "asset_job_status"
|
||||
SET "metadataExtractedAt" = NOW()
|
||||
FROM "exif"
|
||||
WHERE "exif"."assetId" = "asset_job_status"."assetId";
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "asset_job_status" DROP COLUMN "metadataExtractedAt"`);
|
||||
}
|
||||
}
|
@ -474,11 +474,12 @@ export class AssetRepository implements IAssetRepository {
|
||||
case WithoutProperty.EXIF:
|
||||
relations = {
|
||||
exifInfo: true,
|
||||
jobStatus: true,
|
||||
};
|
||||
where = {
|
||||
isVisible: true,
|
||||
exifInfo: {
|
||||
assetId: IsNull(),
|
||||
jobStatus: {
|
||||
metadataExtractedAt: IsNull(),
|
||||
},
|
||||
};
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user