@@ -12,10 +12,11 @@ import { CreateSelfServiceRunner } from '../models/actions/create/CreateSelfServ
 | 
			
		||||
import { Runner } from '../models/entities/Runner';
 | 
			
		||||
import { RunnerGroup } from '../models/entities/RunnerGroup';
 | 
			
		||||
import { RunnerOrganization } from '../models/entities/RunnerOrganization';
 | 
			
		||||
import { ResponseSelfServiceOrganisation } from '../models/responses/ResponseSelfServiceOrganisation';
 | 
			
		||||
import { ResponseSelfServiceRunner } from '../models/responses/ResponseSelfServiceRunner';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@JsonController('/runners')
 | 
			
		||||
@JsonController()
 | 
			
		||||
export class RunnerSelfServiceController {
 | 
			
		||||
	private runnerRepository: Repository<Runner>;
 | 
			
		||||
	private orgRepository: Repository<RunnerOrganization>;
 | 
			
		||||
@@ -28,7 +29,7 @@ export class RunnerSelfServiceController {
 | 
			
		||||
		this.orgRepository = getConnectionManager().get().getRepository(RunnerOrganization);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Get('/me/:jwt')
 | 
			
		||||
	@Get('/runners/me/:jwt')
 | 
			
		||||
	@ResponseSchema(ResponseSelfServiceRunner)
 | 
			
		||||
	@ResponseSchema(RunnerNotFoundError, { statusCode: 404 })
 | 
			
		||||
	@OnUndefined(RunnerNotFoundError)
 | 
			
		||||
@@ -37,7 +38,7 @@ export class RunnerSelfServiceController {
 | 
			
		||||
		return (new ResponseSelfServiceRunner(await this.getRunner(token)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Post('/register')
 | 
			
		||||
	@Post('/runners/register')
 | 
			
		||||
	@ResponseSchema(ResponseSelfServiceRunner)
 | 
			
		||||
	@ResponseSchema(RunnerEmailNeededError, { statusCode: 406 })
 | 
			
		||||
	@OpenAPI({ description: 'Create a new selfservice runner in the citizen org. <br> This endpoint shoud be used to allow "everyday citizen" to register themselves. <br> You have to provide a mail address, b/c the future we\'ll implement email verification.' })
 | 
			
		||||
@@ -50,7 +51,7 @@ export class RunnerSelfServiceController {
 | 
			
		||||
		return response;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Post('/register/:token')
 | 
			
		||||
	@Post('/runners/register/:token')
 | 
			
		||||
	@ResponseSchema(ResponseSelfServiceRunner)
 | 
			
		||||
	@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.' })
 | 
			
		||||
@@ -65,6 +66,17 @@ export class RunnerSelfServiceController {
 | 
			
		||||
		return response;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Get('/organizations/selfservice/:token')
 | 
			
		||||
	@ResponseSchema(ResponseSelfServiceOrganisation, { isArray: false })
 | 
			
		||||
	@ResponseSchema(RunnerOrganizationNotFoundError, { statusCode: 404 })
 | 
			
		||||
	@OpenAPI({ description: 'Get the basic info and teams for a org.' })
 | 
			
		||||
	async getSelfserviceOrg(@Param('token') token: string) {
 | 
			
		||||
		const orgid = (await this.getOrgansisation(token)).id;
 | 
			
		||||
		const org = await this.orgRepository.findOne({ id: orgid }, { relations: ['teams'] })
 | 
			
		||||
 | 
			
		||||
		return new ResponseSelfServiceOrganisation(<RunnerOrganization>org);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get's a runner by a provided jwt token.
 | 
			
		||||
	 * @param token The runner jwt provided by the runner to identitfy themselves.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user