parent
f3000f14cd
commit
02877ece9c
@ -47,7 +47,7 @@ export abstract class CreateParticipant {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The new participant's address.
|
* The new participant's address.
|
||||||
* Must be of type number (address id), createAddress (new address) or address (existing address)
|
* Must be of type number (address id).
|
||||||
* Optional.
|
* Optional.
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
|
@ -10,8 +10,7 @@ import { CreateParticipant } from './CreateParticipant';
|
|||||||
export class CreateRunner extends CreateParticipant {
|
export class CreateRunner extends CreateParticipant {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new runner's team's id.
|
* The new runner's group's id.
|
||||||
* Either provide this or his organisation's id.
|
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
group: number;
|
group: number;
|
||||||
|
@ -20,16 +20,16 @@ export abstract class CreateRunnerGroup {
|
|||||||
contact?: number;
|
contact?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deals with the contact for groups this.
|
* Get's this group's contact from this.address.
|
||||||
*/
|
*/
|
||||||
public async getContact(): Promise<GroupContact> {
|
public async getContact(): Promise<GroupContact> {
|
||||||
if (this.contact === undefined) {
|
if (this.contact === undefined) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!isNaN(this.contact)) {
|
if (!isNaN(this.contact)) {
|
||||||
let address = await getConnectionManager().get().getRepository(GroupContact).findOne({ id: this.contact });
|
let contact = await getConnectionManager().get().getRepository(GroupContact).findOne({ id: this.contact });
|
||||||
if (!address) { throw new GroupContactNotFoundError; }
|
if (!contact) { throw new GroupContactNotFoundError; }
|
||||||
return address;
|
return contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new GroupContactWrongTypeError;
|
throw new GroupContactWrongTypeError;
|
||||||
|
@ -8,7 +8,7 @@ import { CreateRunnerGroup } from './CreateRunnerGroup';
|
|||||||
export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
||||||
/**
|
/**
|
||||||
* The new organisation's address.
|
* The new organisation's address.
|
||||||
* Must be of type number (address id), createAddress (new address) or address (existing address)
|
* Must be of type number (address id).
|
||||||
* Optional.
|
* Optional.
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@ -16,7 +16,7 @@ export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
|||||||
address?: number;
|
address?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Participant entity from this.
|
* Get's this org's address from this.address.
|
||||||
*/
|
*/
|
||||||
public async getAddress(): Promise<Address> {
|
public async getAddress(): Promise<Address> {
|
||||||
if (this.address === undefined) {
|
if (this.address === undefined) {
|
||||||
|
@ -10,7 +10,7 @@ export class CreateTrack {
|
|||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The track's distance in meters (must be greater 0).
|
* The track's distance in meters (must be greater than 0).
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsPositive()
|
@IsPositive()
|
||||||
|
@ -10,15 +10,13 @@ import { CreateParticipant } from './CreateParticipant';
|
|||||||
export class UpdateRunner extends CreateParticipant {
|
export class UpdateRunner extends CreateParticipant {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new runner's team's id.
|
* The updated runner's id.
|
||||||
* Either provide this or his organisation's id.
|
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new runner's team's id.
|
* The updated runner's new team/org.
|
||||||
* Either provide this or his organisation's id.
|
|
||||||
*/
|
*/
|
||||||
@IsObject()
|
@IsObject()
|
||||||
group: RunnerGroup;
|
group: RunnerGroup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user