parent
36b2e82f4e
commit
330cbd5f57
@ -1,31 +1,70 @@
|
|||||||
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsPositive, IsString } from 'class-validator';
|
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString } from 'class-validator';
|
||||||
|
import { getConnectionManager } from 'typeorm';
|
||||||
|
import { RunnerGroupNeededError, RunnerGroupNotFoundError, RunnerOnlyOneGroupAllowedError } from '../../errors/RunnerErrors';
|
||||||
import { Runner } from '../entities/Runner';
|
import { Runner } from '../entities/Runner';
|
||||||
import { getConnectionManager, Repository } from 'typeorm';
|
|
||||||
import { group } from 'console';
|
|
||||||
import { RunnerOnlyOneGroupAllowedError, RunnerGroupNeededError, RunnerGroupNotFoundError } from '../../errors/RunnerErrors';
|
|
||||||
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
||||||
import { RunnerTeam } from '../entities/RunnerTeam';
|
import { RunnerTeam } from '../entities/RunnerTeam';
|
||||||
import { RunnerGroup } from '../entities/RunnerGroup';
|
|
||||||
import { Address } from 'cluster';
|
|
||||||
|
|
||||||
export class CreateRunner {
|
export class CreateRunner {
|
||||||
|
/**
|
||||||
|
* The new runner's first name.
|
||||||
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
firstname: string;
|
firstname: string;
|
||||||
@IsString()
|
|
||||||
middlename?: string;
|
|
||||||
@IsString()
|
|
||||||
lastname: string;
|
|
||||||
@IsString()
|
|
||||||
phone?: string;
|
|
||||||
@IsString()
|
|
||||||
email?: string;
|
|
||||||
@IsInt()
|
|
||||||
@IsOptional()
|
|
||||||
teamId?: number
|
|
||||||
@IsInt()
|
|
||||||
@IsOptional()
|
|
||||||
orgId?: number
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The new runner's middle name.
|
||||||
|
* Optional.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
middlename?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The new runner's last name.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
lastname: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The new runner's phone number.
|
||||||
|
* Optional.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
@IsPhoneNumber("ZZ")
|
||||||
|
phone?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The new runner's e-mail address.
|
||||||
|
* Optional.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
@IsEmail()
|
||||||
|
email?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The new runner's team's id.
|
||||||
|
* Either provide this or his organisation's id.
|
||||||
|
*/
|
||||||
|
@IsInt()
|
||||||
|
@IsOptional()
|
||||||
|
teamId?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The new runner's organisation's id.
|
||||||
|
* Either provide this or his teams's id.
|
||||||
|
*/
|
||||||
|
@IsInt()
|
||||||
|
@IsOptional()
|
||||||
|
orgId?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Runner entity from this.
|
||||||
|
*/
|
||||||
public async toRunner(): Promise<Runner> {
|
public async toRunner(): Promise<Runner> {
|
||||||
let newRunner: Runner = new Runner();
|
let newRunner: Runner = new Runner();
|
||||||
|
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
import { IsString } from 'class-validator';
|
import { IsNotEmpty, IsString } from 'class-validator';
|
||||||
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
import { RunnerOrganisation } from '../entities/RunnerOrganisation';
|
||||||
|
|
||||||
export class CreateRunnerOrganisation {
|
export class CreateRunnerOrganisation {
|
||||||
|
/**
|
||||||
|
* The Organisation's name.
|
||||||
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a RunnerOrganisation entity from this.
|
||||||
|
*/
|
||||||
public async toRunnerOrganisation(): Promise<RunnerOrganisation> {
|
public async toRunnerOrganisation(): Promise<RunnerOrganisation> {
|
||||||
let newRunnerOrganisation: RunnerOrganisation = new RunnerOrganisation();
|
let newRunnerOrganisation: RunnerOrganisation = new RunnerOrganisation();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user