|
|
|
|
@ -10,7 +10,7 @@ import { mimeTypes } from '../domain.constant';
|
|
|
|
|
import { HumanReadableSize, ImmichFileResponse, usePagination } from '../domain.util';
|
|
|
|
|
import { IAssetDeletionJob, ISidecarWriteJob, JOBS_ASSET_PAGINATION_SIZE, JobName } from '../job';
|
|
|
|
|
import {
|
|
|
|
|
CommunicationEvent,
|
|
|
|
|
ClientEvent,
|
|
|
|
|
IAccessRepository,
|
|
|
|
|
IAssetRepository,
|
|
|
|
|
ICommunicationRepository,
|
|
|
|
|
@ -434,7 +434,7 @@ export class AssetService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await this.assetRepository.updateAll(ids, options);
|
|
|
|
|
this.communicationRepository.send(CommunicationEvent.ASSET_UPDATE, auth.user.id, ids);
|
|
|
|
|
this.communicationRepository.send(ClientEvent.ASSET_UPDATE, auth.user.id, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async handleAssetDeletionCheck() {
|
|
|
|
|
@ -478,7 +478,7 @@ export class AssetService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await this.assetRepository.remove(asset);
|
|
|
|
|
this.communicationRepository.send(CommunicationEvent.ASSET_DELETE, asset.ownerId, id);
|
|
|
|
|
this.communicationRepository.send(ClientEvent.ASSET_DELETE, asset.ownerId, id);
|
|
|
|
|
|
|
|
|
|
// TODO refactor this to use cascades
|
|
|
|
|
if (asset.livePhotoVideoId) {
|
|
|
|
|
@ -508,7 +508,7 @@ export class AssetService {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
await this.assetRepository.softDeleteAll(ids);
|
|
|
|
|
this.communicationRepository.send(CommunicationEvent.ASSET_TRASH, auth.user.id, ids);
|
|
|
|
|
this.communicationRepository.send(ClientEvent.ASSET_TRASH, auth.user.id, ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -521,7 +521,7 @@ export class AssetService {
|
|
|
|
|
for await (const assets of assetPagination) {
|
|
|
|
|
const ids = assets.map((a) => a.id);
|
|
|
|
|
await this.assetRepository.restoreAll(ids);
|
|
|
|
|
this.communicationRepository.send(CommunicationEvent.ASSET_RESTORE, auth.user.id, ids);
|
|
|
|
|
this.communicationRepository.send(ClientEvent.ASSET_RESTORE, auth.user.id, ids);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -540,7 +540,7 @@ export class AssetService {
|
|
|
|
|
const { ids } = dto;
|
|
|
|
|
await this.access.requirePermission(auth, Permission.ASSET_RESTORE, ids);
|
|
|
|
|
await this.assetRepository.restoreAll(ids);
|
|
|
|
|
this.communicationRepository.send(CommunicationEvent.ASSET_RESTORE, auth.user.id, ids);
|
|
|
|
|
this.communicationRepository.send(ClientEvent.ASSET_RESTORE, auth.user.id, ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async updateStackParent(auth: AuthDto, dto: UpdateStackParentDto): Promise<void> {
|
|
|
|
|
@ -556,7 +556,7 @@ export class AssetService {
|
|
|
|
|
childIds.push(...(oldParent.stack?.map((a) => a.id) ?? []));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.communicationRepository.send(CommunicationEvent.ASSET_UPDATE, auth.user.id, [...childIds, newParentId]);
|
|
|
|
|
this.communicationRepository.send(ClientEvent.ASSET_UPDATE, auth.user.id, [...childIds, newParentId]);
|
|
|
|
|
await this.assetRepository.updateAll(childIds, { stackParentId: newParentId });
|
|
|
|
|
// Remove ParentId of new parent if this was previously a child of some other asset
|
|
|
|
|
return this.assetRepository.updateAll([newParentId], { stackParentId: null });
|
|
|
|
|
|