Compare commits

..

No commits in common. "9df86953cfc77f6d4d2fb40bc0a8f37cb687d108" and "47862f2e1dd3ab958b81242def40fda1fc6c8343" have entirely different histories.

6 changed files with 36 additions and 32 deletions

View File

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

View File

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

View File

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

View File

@ -29,6 +29,7 @@ export class RunnerOrganisationController {
async getAll() {
let responseTeams: ResponseRunnerOrganisation[] = new Array<ResponseRunnerOrganisation>();
const runners = await this.runnerOrganisationRepository.find({ relations: ['address', 'contact', 'teams'] });
console.log(runners);
runners.forEach(runner => {
responseTeams.push(new ResponseRunnerOrganisation(runner));
});

View File

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

View File

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