mirror of
https://github.com/immich-app/immich.git
synced 2025-05-30 19:54:52 -04:00
fix(server): bulk update location (#15642)
This commit is contained in:
parent
947c053c15
commit
d12b1c907d
@ -416,6 +416,34 @@ describe(AssetService.name, () => {
|
|||||||
await sut.updateAll(authStub.admin, { ids: ['asset-1', 'asset-2'], isArchived: true });
|
await sut.updateAll(authStub.admin, { ids: ['asset-1', 'asset-2'], isArchived: true });
|
||||||
expect(assetMock.updateAll).toHaveBeenCalledWith(['asset-1', 'asset-2'], { isArchived: true });
|
expect(assetMock.updateAll).toHaveBeenCalledWith(['asset-1', 'asset-2'], { isArchived: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not update Assets table if no relevant fields are provided', async () => {
|
||||||
|
accessMock.asset.checkOwnerAccess.mockResolvedValue(new Set(['asset-1']));
|
||||||
|
await sut.updateAll(authStub.admin, {
|
||||||
|
ids: ['asset-1'],
|
||||||
|
latitude: 0,
|
||||||
|
longitude: 0,
|
||||||
|
isArchived: undefined,
|
||||||
|
isFavorite: undefined,
|
||||||
|
duplicateId: undefined,
|
||||||
|
rating: undefined,
|
||||||
|
});
|
||||||
|
expect(assetMock.updateAll).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should update Assets table if isArchived field is provided', async () => {
|
||||||
|
accessMock.asset.checkOwnerAccess.mockResolvedValue(new Set(['asset-1']));
|
||||||
|
await sut.updateAll(authStub.admin, {
|
||||||
|
ids: ['asset-1'],
|
||||||
|
latitude: 0,
|
||||||
|
longitude: 0,
|
||||||
|
isArchived: undefined,
|
||||||
|
isFavorite: false,
|
||||||
|
duplicateId: undefined,
|
||||||
|
rating: undefined,
|
||||||
|
});
|
||||||
|
expect(assetMock.updateAll).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('deleteAll', () => {
|
describe('deleteAll', () => {
|
||||||
|
@ -142,7 +142,14 @@ export class AssetService extends BaseService {
|
|||||||
await this.updateMetadata({ id, dateTimeOriginal, latitude, longitude });
|
await this.updateMetadata({ id, dateTimeOriginal, latitude, longitude });
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.assetRepository.updateAll(ids, options);
|
if (
|
||||||
|
options.isArchived != undefined ||
|
||||||
|
options.isFavorite != undefined ||
|
||||||
|
options.duplicateId != undefined ||
|
||||||
|
options.rating != undefined
|
||||||
|
) {
|
||||||
|
await this.assetRepository.updateAll(ids, options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnJob({ name: JobName.ASSET_DELETION_CHECK, queue: QueueName.BACKGROUND_TASK })
|
@OnJob({ name: JobName.ASSET_DELETION_CHECK, queue: QueueName.BACKGROUND_TASK })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user