latest work #20
@ -8,5 +8,5 @@ export default {
|
|||||||
username: process.env.DB_USER,
|
username: process.env.DB_USER,
|
||||||
password: process.env.DB_PASSWORD,
|
password: process.env.DB_PASSWORD,
|
||||||
database: process.env.DB_NAME,
|
database: process.env.DB_NAME,
|
||||||
entities: ["src/models/*.ts"]
|
entities: ["src/models/entities/*.ts"]
|
||||||
};
|
};
|
||||||
|
@ -2,9 +2,9 @@ import { JsonController, Param, Body, Get, Post, Put, Delete, OnUndefined } from
|
|||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { Runner } from '../models/Runner';
|
import { Runner } from '../models/entities/Runner';
|
||||||
import { RunnerGroupNeededError, RunnerGroupNotFoundError, RunnerIdsNotMatchingError, RunnerNotFoundError, RunnerOnlyOneGroupAllowedError } from '../errors/RunnerErrors';
|
import { RunnerGroupNeededError, RunnerGroupNotFoundError, RunnerIdsNotMatchingError, RunnerNotFoundError, RunnerOnlyOneGroupAllowedError } from '../errors/RunnerErrors';
|
||||||
import { CreateRunner } from '../models/CreateRunner';
|
import { CreateRunner } from '../models/creation/CreateRunner';
|
||||||
|
|
||||||
|
|
||||||
@JsonController('/runners')
|
@JsonController('/runners')
|
||||||
|
@ -2,10 +2,10 @@ import { JsonController, Param, Body, Get, Post, Put, Delete, OnUndefined } from
|
|||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { RunnerOrganisation } from '../models/RunnerOrganisation';
|
import { RunnerOrganisation } from '../models/entities/RunnerOrganisation';
|
||||||
import { RunnerOrganisationIdsNotMatchingError, RunnerOrganisationNotFoundError } from '../errors/RunnerOrganisationErrors';
|
import { RunnerOrganisationIdsNotMatchingError, RunnerOrganisationNotFoundError } from '../errors/RunnerOrganisationErrors';
|
||||||
import { CreateRunnerOrganisation } from '../models/CreateRunnerOrganisation';
|
import { CreateRunnerOrganisation } from '../models/creation/CreateRunnerOrganisation';
|
||||||
import { RunnerGroup } from '../models/RunnerGroup';
|
import { RunnerGroup } from '../models/entities/RunnerGroup';
|
||||||
|
|
||||||
|
|
||||||
@JsonController('/organisations')
|
@JsonController('/organisations')
|
||||||
|
@ -2,10 +2,10 @@ import { JsonController, Param, Body, Get, Post, Put, Delete, NotFoundError, OnU
|
|||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { Track } from '../models/Track';
|
import { Track } from '../models/entities/Track';
|
||||||
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
||||||
import { TrackIdsNotMatchingError, TrackNotFoundError } from "../errors/TrackErrors";
|
import { TrackIdsNotMatchingError, TrackNotFoundError } from "../errors/TrackErrors";
|
||||||
import { CreateTrack } from '../models/CreateTrack';
|
import { CreateTrack } from '../models/creation/CreateTrack';
|
||||||
|
|
||||||
@JsonController('/tracks')
|
@JsonController('/tracks')
|
||||||
//@Authorized("TRACKS:read")
|
//@Authorized("TRACKS:read")
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsPositive, IsString } from 'class-validator';
|
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsPositive, IsString } from 'class-validator';
|
||||||
import { Runner } from '../models/Runner';
|
import { Runner } from '../entities/Runner';
|
||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { getConnectionManager, Repository } from 'typeorm';
|
||||||
import { group } from 'console';
|
import { group } from 'console';
|
||||||
import { RunnerOnlyOneGroupAllowedError, RunnerGroupNeededError, RunnerGroupNotFoundError } from '../errors/RunnerErrors';
|
import { RunnerOnlyOneGroupAllowedError, RunnerGroupNeededError, RunnerGroupNotFoundError } from '../../errors/RunnerErrors';
|
||||||
import { RunnerOrganisation } from './RunnerOrganisation';
|
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
||||||
import { RunnerTeam } from './RunnerTeam';
|
import { RunnerTeam } from '../entities/RunnerTeam';
|
||||||
import { RunnerGroup } from './RunnerGroup';
|
import { RunnerGroup } from '../entities/RunnerGroup';
|
||||||
import { Address } from 'cluster';
|
import { Address } from 'cluster';
|
||||||
|
|
||||||
export class CreateRunner {
|
export class CreateRunner {
|
@ -1,5 +1,5 @@
|
|||||||
import { IsString } from 'class-validator';
|
import { IsString } from 'class-validator';
|
||||||
import { RunnerOrganisation } from './RunnerOrganisation';
|
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
||||||
|
|
||||||
export class CreateRunnerOrganisation {
|
export class CreateRunnerOrganisation {
|
||||||
@IsString()
|
@IsString()
|
@ -1,5 +1,5 @@
|
|||||||
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
|
||||||
import { Track } from './Track';
|
import { Track } from '../entities/Track';
|
||||||
|
|
||||||
export class CreateTrack {
|
export class CreateTrack {
|
||||||
/**
|
/**
|
@ -1,6 +1,7 @@
|
|||||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from "typeorm";
|
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany } from "typeorm";
|
||||||
import {
|
import {
|
||||||
IsBoolean,
|
IsBoolean,
|
||||||
|
IsEAN,
|
||||||
IsInt,
|
IsInt,
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
IsOptional,
|
IsOptional,
|
||||||
@ -32,12 +33,12 @@ export class RunnerCard {
|
|||||||
/**
|
/**
|
||||||
* The card's code.
|
* The card's code.
|
||||||
* This has to be able to being converted to something barcode compatible.
|
* This has to be able to being converted to something barcode compatible.
|
||||||
* Probably gonna be autogenerated.
|
* could theoretically be autogenerated
|
||||||
*/
|
*/
|
||||||
@Column()
|
@Column()
|
||||||
|
@IsEAN()
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
//TODO: Generate this
|
|
||||||
code: string;
|
code: string;
|
||||||
|
|
||||||
/**
|
/**
|
@ -43,4 +43,12 @@ export abstract class Scan {
|
|||||||
@Column()
|
@Column()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
valid: boolean = true;
|
valid: boolean = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* seconds since last scan
|
||||||
|
*/
|
||||||
|
@IsInt()
|
||||||
|
@IsOptional()
|
||||||
|
secondsSinceLastScan: number;
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { Entity, Column, OneToMany, ManyToOne, PrimaryGeneratedColumn, Generated, Unique, JoinTable, ManyToMany } from "typeorm";
|
import { Entity, Column, OneToMany, ManyToOne, PrimaryGeneratedColumn, Generated, Unique, JoinTable, ManyToMany } from "typeorm";
|
||||||
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsString, isUUID, } from "class-validator";
|
import { IsBoolean, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString, isUUID, } from "class-validator";
|
||||||
import { UserGroup } from './UserGroup';
|
import { UserGroup } from './UserGroup';
|
||||||
import { Permission } from './Permission';
|
import { Permission } from './Permission';
|
||||||
import { UserAction } from './UserAction';
|
import { UserAction } from './UserAction';
|
||||||
@ -31,6 +31,13 @@ export class User {
|
|||||||
@IsEmail()
|
@IsEmail()
|
||||||
email: string;
|
email: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* user phone
|
||||||
|
*/
|
||||||
|
@IsPhoneNumber("ZZ")
|
||||||
|
@IsOptional()
|
||||||
|
phone: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* username
|
* username
|
||||||
*/
|
*/
|
Loading…
x
Reference in New Issue
Block a user