Merge branch 'dev' into feature/17-automated_tests

# Conflicts:
#	src/app.ts
#	src/controllers/RunnerController.ts
#	src/controllers/RunnerOrganisationController.ts
#	src/controllers/RunnerTeamController.ts
#	src/models/actions/CreateParticipant.ts
This commit is contained in:
Nicolai Ort 2020-12-10 17:45:23 +01:00
commit 9df86953cf
6 changed files with 32 additions and 36 deletions

View File

@ -1,31 +1,31 @@
import consola from "consola"; import consola from "consola";
import "reflect-metadata"; import "reflect-metadata";
import { createExpressServer } from "routing-controllers"; import { createExpressServer } from "routing-controllers";
import authchecker from "./authchecker"; import authchecker from "./authchecker";
import { config, e as errors } from './config'; import { config, e as errors } from './config';
import loaders from "./loaders/index"; import loaders from "./loaders/index";
import { ErrorHandler } from './middlewares/ErrorHandler'; import { ErrorHandler } from './middlewares/ErrorHandler';
const app = createExpressServer({ const app = createExpressServer({
authorizationChecker: authchecker, authorizationChecker: authchecker,
middlewares: [ErrorHandler], middlewares: [ErrorHandler],
development: config.development, development: config.development,
cors: true, cors: true,
routePrefix: "/api", routePrefix: "/api",
controllers: [__dirname + "/controllers/*.ts"], controllers: [__dirname + "/controllers/*.ts"],
}); });
async function main() { async function main() {
await loaders(app); await loaders(app);
app.listen(config.internal_port, () => { app.listen(config.internal_port, () => {
consola.success( consola.success(
`⚡️[server]: Server is running at http://localhost:${config.internal_port}` `⚡️[server]: Server is running at http://localhost:${config.internal_port}`
); );
}); });
} }
if (errors === 0) { if (errors === 0) {
main(); main();
} else { } else {
console.log("error"); consola.error("error");
// something's wrong // something's wrong
} }

View File

@ -18,7 +18,6 @@ const authchecker = async (action: Action, permissions: string | string[]) => {
try { try {
jwtPayload = <any>jwt.verify(provided_token, config.jwt_secret); jwtPayload = <any>jwt.verify(provided_token, config.jwt_secret);
} catch (error) { } catch (error) {
console.log(error);
throw new IllegalJWTError() throw new IllegalJWTError()
} }
const count = await getConnectionManager().get().getRepository(User).count({ id: jwtPayload["userdetails"]["id"], refreshTokenCount: jwtPayload["userdetails"]["refreshTokenCount"] }) const count = await getConnectionManager().get().getRepository(User).count({ id: jwtPayload["userdetails"]["id"], refreshTokenCount: jwtPayload["userdetails"]["refreshTokenCount"] })

View File

@ -27,7 +27,6 @@ export class RunnerController {
async getAll() { async getAll() {
let responseRunners: ResponseRunner[] = new Array<ResponseRunner>(); let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
const runners = await this.runnerRepository.find({ relations: ['scans', 'group'] }); const runners = await this.runnerRepository.find({ relations: ['scans', 'group'] });
console.log(runners);
runners.forEach(runner => { runners.forEach(runner => {
responseRunners.push(new ResponseRunner(runner)); responseRunners.push(new ResponseRunner(runner));
}); });

View File

@ -29,7 +29,6 @@ export class RunnerOrganisationController {
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'] });
console.log(runners);
runners.forEach(runner => { runners.forEach(runner => {
responseTeams.push(new ResponseRunnerOrganisation(runner)); responseTeams.push(new ResponseRunnerOrganisation(runner));
}); });

View File

@ -28,7 +28,6 @@ export class RunnerTeamController {
async getAll() { async getAll() {
let responseTeams: ResponseRunnerTeam[] = new Array<ResponseRunnerTeam>(); let responseTeams: ResponseRunnerTeam[] = new Array<ResponseRunnerTeam>();
const runners = await this.runnerTeamRepository.find({ relations: ['parentGroup', 'contact'] }); const runners = await this.runnerTeamRepository.find({ relations: ['parentGroup', 'contact'] });
console.log(runners);
runners.forEach(runner => { runners.forEach(runner => {
responseTeams.push(new ResponseRunnerTeam(runner)); responseTeams.push(new ResponseRunnerTeam(runner));
}); });

View File

@ -17,7 +17,7 @@ export abstract class CreateParticipant {
* Optional. * Optional.
*/ */
@IsString() @IsString()
@IsNotEmpty() @IsOptional()
middlename?: string; middlename?: string;
/** /**