refactor: clean up

This commit is contained in:
Jason Rasmussen
2023-11-29 00:31:09 -05:00
parent a315234f3c
commit d97981c9c3
4 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export interface IAssetFaceJob extends IBaseJob {
export interface IEntityJob extends IBaseJob { export interface IEntityJob extends IBaseJob {
id: string; id: string;
source?: 'upload'; source?: 'upload' | 'sidecar-write';
} }
export interface IAssetDeletionJob extends IEntityJob { export interface IAssetDeletionJob extends IEntityJob {
+11 -4
View File
@@ -165,13 +165,20 @@ export class JobService {
await this.jobRepository.queue({ name: JobName.METADATA_EXTRACTION, data: item.data }); await this.jobRepository.queue({ name: JobName.METADATA_EXTRACTION, data: item.data });
break; break;
case JobName.SIDECAR_WRITE:
await this.jobRepository.queue({
name: JobName.METADATA_EXTRACTION,
data: { id: item.data.id, source: 'sidecar-write' },
});
case JobName.METADATA_EXTRACTION: case JobName.METADATA_EXTRACTION:
const [asset] = await this.assetRepository.getByIds([item.data.id]); if (item.data.source === 'sidecar-write') {
if (asset) { const [asset] = await this.assetRepository.getByIds([item.data.id]);
this.communicationRepository.send(CommunicationEvent.ASSET_UPDATE, asset.ownerId, mapAsset(asset)); if (asset) {
this.communicationRepository.send(CommunicationEvent.ASSET_UPDATE, asset.ownerId, mapAsset(asset));
}
} }
await this.jobRepository.queue({ name: JobName.LINK_LIVE_PHOTOS, data: item.data }); await this.jobRepository.queue({ name: JobName.LINK_LIVE_PHOTOS, data: item.data });
break; break;
case JobName.LINK_LIVE_PHOTOS: case JobName.LINK_LIVE_PHOTOS:
@@ -80,7 +80,6 @@ export class MetadataService {
private logger = new Logger(MetadataService.name); private logger = new Logger(MetadataService.name);
private storageCore: StorageCore; private storageCore: StorageCore;
private configCore: SystemConfigCore; private configCore: SystemConfigCore;
private oldCities?: string;
private subscription: Subscription | null = null; private subscription: Subscription | null = null;
constructor( constructor(
@@ -273,8 +272,6 @@ export class MetadataService {
await this.assetRepository.save({ id, sidecarPath }); await this.assetRepository.save({ id, sidecarPath });
} }
await this.jobRepository.queue({ name: JobName.METADATA_EXTRACTION, data: { id } });
return true; return true;
} }
@@ -55,11 +55,11 @@ export type JobItem =
| { name: JobName.QUEUE_METADATA_EXTRACTION; data: IBaseJob } | { name: JobName.QUEUE_METADATA_EXTRACTION; data: IBaseJob }
| { name: JobName.METADATA_EXTRACTION; data: IEntityJob } | { name: JobName.METADATA_EXTRACTION; data: IEntityJob }
| { name: JobName.LINK_LIVE_PHOTOS; data: IEntityJob } | { name: JobName.LINK_LIVE_PHOTOS; data: IEntityJob }
| { name: JobName.SIDECAR_WRITE; data: ISidecarWriteJob }
// Sidecar Scanning // Sidecar Scanning
| { name: JobName.QUEUE_SIDECAR; data: IBaseJob } | { name: JobName.QUEUE_SIDECAR; data: IBaseJob }
| { name: JobName.SIDECAR_DISCOVERY; data: IEntityJob } | { name: JobName.SIDECAR_DISCOVERY; data: IEntityJob }
| { name: JobName.SIDECAR_SYNC; data: IEntityJob } | { name: JobName.SIDECAR_SYNC; data: IEntityJob }
| { name: JobName.SIDECAR_WRITE; data: ISidecarWriteJob }
// Object Tagging // Object Tagging
| { name: JobName.QUEUE_OBJECT_TAGGING; data: IBaseJob } | { name: JobName.QUEUE_OBJECT_TAGGING; data: IBaseJob }