parent
3df1db4ad8
commit
61a17b198f
|
@ -92,15 +92,17 @@ export class DonorController {
|
|||
@OnUndefined(204)
|
||||
@OpenAPI({ description: 'Delete the runner whose id you provided. <br> If no runner with this id exists it will just return 204(no content).' })
|
||||
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
||||
let runner = await this.donorRepository.findOne({ id: id });
|
||||
if (!runner) { return null; }
|
||||
const responseRunner = await this.donorRepository.findOne(runner, { relations: ['scans', 'group'] });
|
||||
let donor = await this.donorRepository.findOne({ id: id });
|
||||
if (!donor) { return null; }
|
||||
const responseDonor = await this.donorRepository.findOne(donor);
|
||||
|
||||
if (!runner) {
|
||||
if (!donor) {
|
||||
throw new RunnerNotFoundError();
|
||||
}
|
||||
|
||||
await this.donorRepository.delete(runner);
|
||||
return new ResponseDonor(responseRunner);
|
||||
//TODO: DELETE DONATIONS AND WARN FOR FORCE
|
||||
|
||||
await this.donorRepository.delete(donor);
|
||||
return new ResponseDonor(responseDonor);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue