mirror of
https://github.com/zebrajr/immich.git
synced 2025-12-06 00:20:20 +01:00
chore(server): clarify asset copy parameters (#23396)
This commit is contained in:
parent
e9038193db
commit
61a2c3ace3
|
|
@ -217,7 +217,7 @@ export class AssetService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack) {
|
if (stack) {
|
||||||
await this.copyStack(sourceAsset, targetAsset);
|
await this.copyStack({ sourceAsset, targetAsset });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (favorite) {
|
if (favorite) {
|
||||||
|
|
@ -225,14 +225,17 @@ export class AssetService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sidecar) {
|
if (sidecar) {
|
||||||
await this.copySidecar(sourceAsset, targetAsset);
|
await this.copySidecar({ sourceAsset, targetAsset });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async copyStack(
|
private async copyStack({
|
||||||
sourceAsset: { id: string; stackId: string | null },
|
sourceAsset,
|
||||||
targetAsset: { id: string; stackId: string | null },
|
targetAsset,
|
||||||
) {
|
}: {
|
||||||
|
sourceAsset: { id: string; stackId: string | null };
|
||||||
|
targetAsset: { id: string; stackId: string | null };
|
||||||
|
}) {
|
||||||
if (!sourceAsset.stackId) {
|
if (!sourceAsset.stackId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -245,21 +248,24 @@ export class AssetService extends BaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async copySidecar(
|
private async copySidecar({
|
||||||
targetAsset: { sidecarPath: string | null },
|
sourceAsset,
|
||||||
sourceAsset: { id: string; sidecarPath: string | null; originalPath: string },
|
targetAsset,
|
||||||
) {
|
}: {
|
||||||
if (!targetAsset.sidecarPath) {
|
sourceAsset: { sidecarPath: string | null };
|
||||||
|
targetAsset: { id: string; sidecarPath: string | null; originalPath: string };
|
||||||
|
}) {
|
||||||
|
if (!sourceAsset.sidecarPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceAsset.sidecarPath) {
|
if (targetAsset.sidecarPath) {
|
||||||
await this.storageRepository.unlink(sourceAsset.sidecarPath);
|
await this.storageRepository.unlink(targetAsset.sidecarPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.storageRepository.copyFile(targetAsset.sidecarPath, `${sourceAsset.originalPath}.xmp`);
|
await this.storageRepository.copyFile(sourceAsset.sidecarPath, `${targetAsset.originalPath}.xmp`);
|
||||||
await this.assetRepository.update({ id: sourceAsset.id, sidecarPath: `${sourceAsset.originalPath}.xmp` });
|
await this.assetRepository.update({ id: targetAsset.id, sidecarPath: `${targetAsset.originalPath}.xmp` });
|
||||||
await this.jobRepository.queue({ name: JobName.AssetExtractMetadata, data: { id: sourceAsset.id } });
|
await this.jobRepository.queue({ name: JobName.AssetExtractMetadata, data: { id: targetAsset.id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnJob({ name: JobName.AssetDeleteCheck, queue: QueueName.BackgroundTask })
|
@OnJob({ name: JobName.AssetDeleteCheck, queue: QueueName.BackgroundTask })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user