Renamed files and classed from *Organisation* to *Organization*📝
ref #117
This commit is contained in:
@@ -5,27 +5,27 @@ import { getConnectionManager, Repository } from 'typeorm';
|
||||
import { config } from '../config';
|
||||
import { InvalidCredentialsError, JwtNotProvidedError } from '../errors/AuthError';
|
||||
import { RunnerEmailNeededError, RunnerNotFoundError } from '../errors/RunnerErrors';
|
||||
import { RunnerOrganisationNotFoundError } from '../errors/RunnerOrganisationErrors';
|
||||
import { RunnerOrganizationNotFoundError } from '../errors/RunnerOrganizationErrors';
|
||||
import { JwtCreator } from '../jwtcreator';
|
||||
import { CreateSelfServiceCitizenRunner } from '../models/actions/create/CreateSelfServiceCitizenRunner';
|
||||
import { CreateSelfServiceRunner } from '../models/actions/create/CreateSelfServiceRunner';
|
||||
import { Runner } from '../models/entities/Runner';
|
||||
import { RunnerGroup } from '../models/entities/RunnerGroup';
|
||||
import { RunnerOrganisation } from '../models/entities/RunnerOrganisation';
|
||||
import { RunnerOrganization } from '../models/entities/RunnerOrganization';
|
||||
import { ResponseSelfServiceRunner } from '../models/responses/ResponseSelfServiceRunner';
|
||||
|
||||
|
||||
@JsonController('/runners')
|
||||
export class RunnerSelfServiceController {
|
||||
private runnerRepository: Repository<Runner>;
|
||||
private orgRepository: Repository<RunnerOrganisation>;
|
||||
private orgRepository: Repository<RunnerOrganization>;
|
||||
|
||||
/**
|
||||
* Gets the repository of this controller's model/entity.
|
||||
*/
|
||||
constructor() {
|
||||
this.runnerRepository = getConnectionManager().get().getRepository(Runner);
|
||||
this.orgRepository = getConnectionManager().get().getRepository(RunnerOrganisation);
|
||||
this.orgRepository = getConnectionManager().get().getRepository(RunnerOrganization);
|
||||
}
|
||||
|
||||
@Get('/me/:jwt')
|
||||
@@ -52,9 +52,9 @@ export class RunnerSelfServiceController {
|
||||
|
||||
@Post('/register/:token')
|
||||
@ResponseSchema(ResponseSelfServiceRunner)
|
||||
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
||||
@ResponseSchema(RunnerOrganizationNotFoundError, { statusCode: 404 })
|
||||
@OpenAPI({ description: 'Create a new selfservice runner in a provided org. <br> The orgs get provided and authorized via api tokens that can be optained via the /organizations endpoint.' })
|
||||
async registerOrganisationRunner(@Param('token') token: string, @Body({ validate: true }) createRunner: CreateSelfServiceRunner) {
|
||||
async registerOrganizationRunner(@Param('token') token: string, @Body({ validate: true }) createRunner: CreateSelfServiceRunner) {
|
||||
const org = await this.getOrgansisation(token);
|
||||
|
||||
let runner = await createRunner.toEntity(org);
|
||||
@@ -91,7 +91,7 @@ export class RunnerSelfServiceController {
|
||||
token = Buffer.from(token, 'base64').toString('utf8');
|
||||
|
||||
const organization = await this.orgRepository.findOne({ key: token });
|
||||
if (!organization) { throw new RunnerOrganisationNotFoundError; }
|
||||
if (!organization) { throw new RunnerOrganizationNotFoundError; }
|
||||
|
||||
return organization;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user