chore: refactor more queries (#25572)

* refactor: asset service queries

* chore: refactor more queries
This commit is contained in:
Daniel Dietzler
2026-02-19 16:48:30 +01:00
committed by GitHub
parent dadd20acfc
commit db4e7abf6d
11 changed files with 188 additions and 62 deletions
+7 -1
View File
@@ -580,11 +580,17 @@ export class AssetService extends BaseService {
throw new BadRequestException('Editing SVG images is not supported');
}
// check that crop parameters will not go out of bounds
const { width: assetWidth, height: assetHeight } = getDimensions(asset);
if (!assetWidth || !assetHeight) {
throw new BadRequestException('Asset dimensions are not available for editing');
}
const cropIndex = dto.edits.findIndex((e) => e.action === AssetEditAction.Crop);
if (cropIndex > 0) {
throw new BadRequestException('Crop action must be the first edit action');
}
const crop = cropIndex === -1 ? null : (dto.edits[cropIndex] as AssetEditActionCrop);
if (crop) {
// check that crop parameters will not go out of bounds