parent
9bb4865b2d
commit
f256dec121
@ -26,7 +26,7 @@ export class RunnerOrganisationController {
|
|||||||
@Get()
|
@Get()
|
||||||
@Authorized("ORGANISATION:GET")
|
@Authorized("ORGANISATION:GET")
|
||||||
@ResponseSchema(ResponseRunnerOrganisation, { isArray: true })
|
@ResponseSchema(ResponseRunnerOrganisation, { isArray: true })
|
||||||
@OpenAPI({ description: 'Lists all runnerOrganisations.' })
|
@OpenAPI({ description: 'Lists all organisations. <br> This includes their address, contact and teams (if existing/associated).' })
|
||||||
async getAll() {
|
async getAll() {
|
||||||
let responseTeams: ResponseRunnerOrganisation[] = new Array<ResponseRunnerOrganisation>();
|
let responseTeams: ResponseRunnerOrganisation[] = new Array<ResponseRunnerOrganisation>();
|
||||||
const runners = await this.runnerOrganisationRepository.find({ relations: ['address', 'contact', 'teams'] });
|
const runners = await this.runnerOrganisationRepository.find({ relations: ['address', 'contact', 'teams'] });
|
||||||
@ -41,7 +41,7 @@ export class RunnerOrganisationController {
|
|||||||
@ResponseSchema(ResponseRunnerOrganisation)
|
@ResponseSchema(ResponseRunnerOrganisation)
|
||||||
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
||||||
@OnUndefined(RunnerOrganisationNotFoundError)
|
@OnUndefined(RunnerOrganisationNotFoundError)
|
||||||
@OpenAPI({ description: 'Returns a runnerOrganisation of a specified id (if it exists)' })
|
@OpenAPI({ description: 'Lists all information about the organisation whose id got provided.' })
|
||||||
async getOne(@Param('id') id: number) {
|
async getOne(@Param('id') id: number) {
|
||||||
let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['address', 'contact', 'teams'] });
|
let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['address', 'contact', 'teams'] });
|
||||||
if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); }
|
if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); }
|
||||||
@ -51,7 +51,7 @@ export class RunnerOrganisationController {
|
|||||||
@Post()
|
@Post()
|
||||||
@Authorized("ORGANISATION:CREATE")
|
@Authorized("ORGANISATION:CREATE")
|
||||||
@ResponseSchema(ResponseRunnerOrganisation)
|
@ResponseSchema(ResponseRunnerOrganisation)
|
||||||
@OpenAPI({ description: 'Create a new runnerOrganisation object (id will be generated automagicly).' })
|
@OpenAPI({ description: 'Create a new organsisation.' })
|
||||||
async post(@Body({ validate: true }) createRunnerOrganisation: CreateRunnerOrganisation) {
|
async post(@Body({ validate: true }) createRunnerOrganisation: CreateRunnerOrganisation) {
|
||||||
let runnerOrganisation;
|
let runnerOrganisation;
|
||||||
try {
|
try {
|
||||||
@ -70,7 +70,7 @@ export class RunnerOrganisationController {
|
|||||||
@ResponseSchema(ResponseRunnerOrganisation)
|
@ResponseSchema(ResponseRunnerOrganisation)
|
||||||
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
||||||
@ResponseSchema(RunnerOrganisationIdsNotMatchingError, { statusCode: 406 })
|
@ResponseSchema(RunnerOrganisationIdsNotMatchingError, { statusCode: 406 })
|
||||||
@OpenAPI({ description: "Update a runnerOrganisation object (id can't be changed)." })
|
@OpenAPI({ description: "Update the organisation whose id you provided. <br> Please remember that id's can't be changed." })
|
||||||
async put(@Param('id') id: number, @Body({ validate: true }) updateOrganisation: UpdateRunnerOrganisation) {
|
async put(@Param('id') id: number, @Body({ validate: true }) updateOrganisation: UpdateRunnerOrganisation) {
|
||||||
let oldRunnerOrganisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
let oldRunnerOrganisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ export class RunnerOrganisationController {
|
|||||||
@ResponseSchema(RunnerOrganisationHasTeamsError, { statusCode: 406 })
|
@ResponseSchema(RunnerOrganisationHasTeamsError, { statusCode: 406 })
|
||||||
@ResponseSchema(RunnerOrganisationHasRunnersError, { statusCode: 406 })
|
@ResponseSchema(RunnerOrganisationHasRunnersError, { statusCode: 406 })
|
||||||
@OnUndefined(204)
|
@OnUndefined(204)
|
||||||
@OpenAPI({ description: 'Delete a specified runnerOrganisation (if it exists).' })
|
@OpenAPI({ description: 'Delete the organsisation whose id you provided. <br> If the organisation still has runners and/or teams associated this will fail. <br> To delete the organisation with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> If no organisation 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 organisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
let organisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
||||||
if (!organisation) { return null; }
|
if (!organisation) { return null; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user