New Feature: Donor endpoints feature/65-donor_controllers #69

Merged
niggl merged 30 commits from feature/65-donor_controllers into dev 2021-01-02 21:06:11 +00:00
Showing only changes of commit 61a17b198f - Show all commits

View File

@ -92,15 +92,17 @@ export class DonorController {
@OnUndefined(204) @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).' }) @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) { async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
let runner = await this.donorRepository.findOne({ id: id }); let donor = await this.donorRepository.findOne({ id: id });
if (!runner) { return null; } if (!donor) { return null; }
const responseRunner = await this.donorRepository.findOne(runner, { relations: ['scans', 'group'] }); const responseDonor = await this.donorRepository.findOne(donor);
if (!runner) { if (!donor) {
throw new RunnerNotFoundError(); throw new RunnerNotFoundError();
} }
await this.donorRepository.delete(runner); //TODO: DELETE DONATIONS AND WARN FOR FORCE
return new ResponseDonor(responseRunner);
await this.donorRepository.delete(donor);
return new ResponseDonor(responseDonor);
} }
} }