Skip to content

Commit 99c4887

Browse files
committed
Check if entity exists before deleting
1 parent 6fcfff7 commit 99c4887

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

services/apps/alcs/src/alcs/compliance-and-enforcement/compliance-and-enforcement.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export class ComplianceAndEnforcementService {
6464
}
6565

6666
async delete(uuid: string): Promise<DeleteResult> {
67+
const entity = await this.repository.findOneBy({ uuid });
68+
if (entity === null) {
69+
throw new ServiceNotFoundException('A C&E file with this UUID does not exist. Unable to delete.');
70+
}
71+
6772
return await this.repository.delete(uuid);
6873
}
6974
}

0 commit comments

Comments
 (0)