parent
2b693917b0
commit
4075276130
@ -1,4 +1,4 @@
|
|||||||
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
|
||||||
import {
|
import {
|
||||||
IsInt,
|
IsInt,
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
@ -6,6 +6,7 @@ import {
|
|||||||
IsPostalCode,
|
IsPostalCode,
|
||||||
IsString,
|
IsString,
|
||||||
} from "class-validator";
|
} from "class-validator";
|
||||||
|
import { Participant } from "./Participant";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a address (to be used for contact information).
|
* Defines a address (to be used for contact information).
|
||||||
@ -70,4 +71,10 @@ export class Address {
|
|||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
country: string;
|
country: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to link the address to participants.
|
||||||
|
*/
|
||||||
|
@OneToMany(() => Participant, participant => participant.address)
|
||||||
|
participants: Participant[];
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
|
import { PrimaryGeneratedColumn, Column, OneToMany, ManyToOne } from "typeorm";
|
||||||
import {
|
import {
|
||||||
IsEmail,
|
IsEmail,
|
||||||
IsInt,
|
IsInt,
|
||||||
@ -53,7 +53,7 @@ export abstract class Participant {
|
|||||||
*/
|
*/
|
||||||
@Column()
|
@Column()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
//TODO: Relationship
|
@ManyToOne(() => Address, address => address.participants)
|
||||||
address?: Address;
|
address?: Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user