Compare commits
No commits in common. "d5c689d6937288df7dca14ce26fbbd4f46a8752a" and "e8b2e6f26140a18c06b017e4461742d7e7942f08" have entirely different histories.
d5c689d693
...
e8b2e6f261
@ -1,4 +1,4 @@
|
|||||||
import { Authorized, BadRequestError, Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put, QueryParam } from 'routing-controllers';
|
import { Authorized, Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put, QueryParam } from 'routing-controllers';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { RunnerOrganizationHasRunnersError, RunnerOrganizationHasTeamsError, RunnerOrganizationIdsNotMatchingError, RunnerOrganizationNotFoundError } from '../errors/RunnerOrganizationErrors';
|
import { RunnerOrganizationHasRunnersError, RunnerOrganizationHasTeamsError, RunnerOrganizationIdsNotMatchingError, RunnerOrganizationNotFoundError } from '../errors/RunnerOrganizationErrors';
|
||||||
@ -114,10 +114,6 @@ export class RunnerOrganizationController {
|
|||||||
@OnUndefined(204)
|
@OnUndefined(204)
|
||||||
@OpenAPI({ description: 'Delete the organsisation whose id you provided. <br> If the organization still has runners and/or teams associated this will fail. <br> To delete the organization with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> This won\'t delete the associated contact. <br> If no organization with this id exists it will just return 204(no content).' })
|
@OpenAPI({ description: 'Delete the organsisation whose id you provided. <br> If the organization still has runners and/or teams associated this will fail. <br> To delete the organization with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> This won\'t delete the associated contact. <br> If no organization 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) {
|
||||||
if (id == 1) {
|
|
||||||
throw new BadRequestError("You can't delete the citizen runner org.");
|
|
||||||
}
|
|
||||||
|
|
||||||
let organization = await this.runnerOrganizationRepository.findOne({ id: id });
|
let organization = await this.runnerOrganizationRepository.findOne({ id: id });
|
||||||
if (!organization) { return null; }
|
if (!organization) { return null; }
|
||||||
let runnerOrganization = await this.runnerOrganizationRepository.findOne(organization, { relations: ['contact', 'runners', 'teams'] });
|
let runnerOrganization = await this.runnerOrganizationRepository.findOne(organization, { relations: ['contact', 'runners', 'teams'] });
|
||||||
|
@ -22,12 +22,6 @@ describe('deletion (non-existant)', () => {
|
|||||||
expect(res2.status).toEqual(204);
|
expect(res2.status).toEqual(204);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('deletion of citizen sould fail', () => {
|
|
||||||
it('delete', async () => {
|
|
||||||
const res3 = await axios.delete(base + '/api/organizations/1', axios_config);
|
|
||||||
expect(res3.status).toEqual(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// ---------------
|
// ---------------
|
||||||
describe('adding + deletion (successfull)', () => {
|
describe('adding + deletion (successfull)', () => {
|
||||||
let added_org_id
|
let added_org_id
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user