fix(server): missing metadata extraction job (#2586)

* fix(server): missing metadata extraction job

* format

* fix test

* fix test

* Added source to upload

* fix test

* OK! CODE COVERAGE
This commit is contained in:
Alex 2023-05-27 16:49:57 -05:00 committed by GitHub
parent fd4357cf23
commit fc2455be80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View file

@ -43,7 +43,7 @@ export class AssetCore {
sidecarPath: sidecarFile?.originalPath || null,
});
await this.jobRepository.queue({ name: JobName.GENERATE_JPEG_THUMBNAIL, data: { id: asset.id } });
await this.jobRepository.queue({ name: JobName.METADATA_EXTRACTION, data: { id: asset.id, source: 'upload' } });
if (asset.type === AssetType.VIDEO) {
await this.jobRepository.queue({ name: JobName.VIDEO_CONVERSION, data: { id: asset.id } });
}

View file

@ -328,9 +328,14 @@ describe('AssetService', () => {
});
expect(jobMock.queue.mock.calls).toEqual([
[{ name: JobName.GENERATE_JPEG_THUMBNAIL, data: { id: assetEntityStub.livePhotoMotionAsset.id } }],
[
{
name: JobName.METADATA_EXTRACTION,
data: { id: assetEntityStub.livePhotoMotionAsset.id, source: 'upload' },
},
],
[{ name: JobName.VIDEO_CONVERSION, data: { id: assetEntityStub.livePhotoMotionAsset.id } }],
[{ name: JobName.GENERATE_JPEG_THUMBNAIL, data: { id: assetEntityStub.livePhotoStillAsset.id } }],
[{ name: JobName.METADATA_EXTRACTION, data: { id: assetEntityStub.livePhotoStillAsset.id, source: 'upload' } }],
]);
});
});

View file

@ -19,6 +19,7 @@ export interface IFaceThumbnailJob extends IAssetFaceJob {
export interface IEntityJob extends IBaseJob {
id: string;
source?: string;
}
export interface IBulkEntityJob extends IBaseJob {

View file

@ -110,6 +110,12 @@ export class JobService {
await this.jobRepository.queue({ name: JobName.STORAGE_TEMPLATE_MIGRATION_SINGLE, data: item.data });
break;
case JobName.STORAGE_TEMPLATE_MIGRATION_SINGLE:
if (item.data.source === 'upload') {
await this.jobRepository.queue({ name: JobName.GENERATE_JPEG_THUMBNAIL, data: item.data });
}
break;
case JobName.GENERATE_JPEG_THUMBNAIL: {
await this.jobRepository.queue({ name: JobName.GENERATE_WEBP_THUMBNAIL, data: item.data });
await this.jobRepository.queue({ name: JobName.CLASSIFY_IMAGE, data: item.data });

View file

@ -141,7 +141,7 @@
"./libs/domain/": {
"branches": 80,
"functions": 87,
"lines": 94,
"lines": 93.8,
"statements": 93
}
},