mirror of
https://github.com/immich-app/immich.git
synced 2026-03-04 09:57:33 +03:00
fix(server): enforce crop is the first action (#25547)
* fix(server): enforce crop is the first action * chore: test
This commit is contained in:
@@ -2,6 +2,7 @@ import { BadRequestException } from '@nestjs/common';
|
||||
import { DateTime } from 'luxon';
|
||||
import { MapAsset } from 'src/dtos/asset-response.dto';
|
||||
import { AssetJobName, AssetStatsResponseDto } from 'src/dtos/asset.dto';
|
||||
import { AssetEditAction } from 'src/dtos/editing.dto';
|
||||
import { AssetMetadataKey, AssetStatus, AssetType, AssetVisibility, JobName, JobStatus } from 'src/enum';
|
||||
import { AssetStats } from 'src/repositories/asset.repository';
|
||||
import { AssetService } from 'src/services/asset.service';
|
||||
@@ -813,4 +814,25 @@ describe(AssetService.name, () => {
|
||||
expect(mocks.asset.upsertBulkMetadata).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('editAsset', () => {
|
||||
it('should enforce crop first', async () => {
|
||||
await expect(
|
||||
sut.editAsset(authStub.admin, 'asset-1', {
|
||||
edits: [
|
||||
{
|
||||
action: AssetEditAction.Rotate,
|
||||
parameters: { angle: 90 },
|
||||
},
|
||||
{
|
||||
action: AssetEditAction.Crop,
|
||||
parameters: { x: 0, y: 0, width: 100, height: 100 },
|
||||
},
|
||||
],
|
||||
}),
|
||||
).rejects.toBeInstanceOf(BadRequestException);
|
||||
|
||||
expect(mocks.assetEdit.replaceAll).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user