Merge branch 'dev' into feature/13-runner_controllers
This commit is contained in:
commit
429041fef1
@ -1,4 +1,4 @@
|
||||
import { config } from 'dotenv-safe';
|
||||
import { config } from 'dotenv';
|
||||
config();
|
||||
|
||||
export default {
|
||||
|
@ -29,6 +29,7 @@
|
||||
"class-validator-jsonschema": "^2.0.3",
|
||||
"consola": "^2.15.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"helmet": "^4.2.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
@ -45,14 +46,13 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.8",
|
||||
"@types/dotenv-safe": "^8.1.1",
|
||||
"@types/dotenv": "^8.2.0",
|
||||
"@types/express": "^4.17.9",
|
||||
"@types/jsonwebtoken": "^8.5.0",
|
||||
"@types/multer": "^1.4.4",
|
||||
"@types/node": "^14.14.9",
|
||||
"@types/swagger-ui-express": "^4.1.2",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"dotenv-safe": "^8.2.0",
|
||||
"nodemon": "^2.0.6",
|
||||
"sqlite3": "^5.0.0",
|
||||
"ts-node": "^9.0.0",
|
||||
|
@ -2,7 +2,7 @@ import consola from "consola";
|
||||
import "reflect-metadata";
|
||||
import { createExpressServer } from "routing-controllers";
|
||||
import authchecker from "./authchecker";
|
||||
import { config } from './config';
|
||||
import { config, e as errors } from './config';
|
||||
import loaders from "./loaders/index";
|
||||
import { ErrorHandler } from './middlewares/ErrorHandler';
|
||||
|
||||
@ -23,4 +23,9 @@ async function main() {
|
||||
);
|
||||
});
|
||||
}
|
||||
if (errors === 0) {
|
||||
main();
|
||||
} else {
|
||||
console.log("error");
|
||||
// something's wrong
|
||||
}
|
||||
|
@ -1,7 +1,22 @@
|
||||
import * as dotenvSafe from "dotenv-safe";
|
||||
dotenvSafe.config();
|
||||
import { config as configDotenv } from 'dotenv';
|
||||
configDotenv();
|
||||
export const config = {
|
||||
internal_port: process.env.APP_PORT || 4010,
|
||||
internal_port: parseInt(process.env.APP_PORT) || 4010,
|
||||
development: process.env.NODE_ENV === "production",
|
||||
jwt_secret: process.env.JWT_SECRET || "secretjwtsecret"
|
||||
jwt_secret: process.env.JWT_SECRET || "secretjwtsecret",
|
||||
phone_validation_countrycode: process.env.PHONE_COUNTRYCODE || "ZZ"
|
||||
}
|
||||
let errors = 0
|
||||
if (typeof config.internal_port !== "number") {
|
||||
errors++
|
||||
}
|
||||
if (typeof config.phone_validation_countrycode !== "string") {
|
||||
errors++
|
||||
}
|
||||
if (config.phone_validation_countrycode.length !== 2) {
|
||||
errors++
|
||||
}
|
||||
if (typeof config.development !== "boolean") {
|
||||
errors++
|
||||
}
|
||||
export let e = errors
|
@ -1,5 +1,6 @@
|
||||
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { config } from '../../config';
|
||||
import { AddressNotFoundError, AddressWrongTypeError } from '../../errors/AddressErrors';
|
||||
import { Address } from '../entities/Address';
|
||||
import { GroupContact } from '../entities/GroupContact';
|
||||
@ -40,7 +41,7 @@ export class CreateGroupContact {
|
||||
* Optional
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsPhoneNumber("DE")
|
||||
@IsPhoneNumber(config.phone_validation_countrycode)
|
||||
phone?: string;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { config } from '../../config';
|
||||
import { AddressNotFoundError, AddressWrongTypeError } from '../../errors/AddressErrors';
|
||||
import { Address } from '../entities/Address';
|
||||
|
||||
@ -32,7 +33,7 @@ export abstract class CreateParticipant {
|
||||
*/
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@IsPhoneNumber("ZZ")
|
||||
@IsPhoneNumber(config.phone_validation_countrycode)
|
||||
phone?: string;
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ import * as argon2 from "argon2";
|
||||
import { IsEmail, IsOptional, IsPhoneNumber, IsString } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import * as uuid from 'uuid';
|
||||
import { config } from '../../config';
|
||||
import { UsernameOrEmailNeededError } from '../../errors/UserErrors';
|
||||
import { UserGroupNotFoundError } from '../../errors/UserGroupErrors';
|
||||
import { User } from '../entities/User';
|
||||
@ -49,7 +50,7 @@ export class CreateUser {
|
||||
* The new user's phone number.
|
||||
* Optional
|
||||
*/
|
||||
@IsPhoneNumber("ZZ")
|
||||
@IsPhoneNumber(config.phone_validation_countrycode)
|
||||
@IsOptional()
|
||||
phone?: string;
|
||||
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
IsString
|
||||
} from "class-validator";
|
||||
import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { config } from '../../config';
|
||||
import { Address } from "./Address";
|
||||
import { RunnerGroup } from "./RunnerGroup";
|
||||
|
||||
@ -62,7 +63,7 @@ export class GroupContact {
|
||||
*/
|
||||
@Column({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsPhoneNumber("DE")
|
||||
@IsPhoneNumber(config.phone_validation_countrycode)
|
||||
phone?: string;
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
IsString
|
||||
} from "class-validator";
|
||||
import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
|
||||
import { config } from '../../config';
|
||||
import { Address } from "./Address";
|
||||
import { Donation } from "./Donation";
|
||||
|
||||
@ -62,7 +63,7 @@ export abstract class Participant {
|
||||
*/
|
||||
@Column({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsPhoneNumber("DE")
|
||||
@IsPhoneNumber(config.phone_validation_countrycode)
|
||||
phone?: string;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, IsUUID } from "class-validator";
|
||||
import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import { config } from '../../config';
|
||||
import { Permission } from './Permission';
|
||||
import { UserAction } from './UserAction';
|
||||
import { UserGroup } from './UserGroup';
|
||||
@ -35,7 +36,7 @@ export class User {
|
||||
*/
|
||||
@Column({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsPhoneNumber("ZZ")
|
||||
@IsPhoneNumber(config.phone_validation_countrycode)
|
||||
phone?: string;
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user