feature/11-new_classes #15

Merged
niggl merged 55 commits from feature/11-new_classes into dev 2020-12-02 17:48:19 +00:00
2 changed files with 10 additions and 3 deletions
Showing only changes of commit 4075276130 - Show all commits

View File

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
import {
IsInt,
IsNotEmpty,
@ -6,6 +6,7 @@ import {
IsPostalCode,
IsString,
} from "class-validator";
import { Participant } from "./Participant";
/**
* Defines a address (to be used for contact information).
@ -70,4 +71,10 @@ export class Address {
@IsString()
@IsNotEmpty()
country: string;
/**
* Used to link the address to participants.
*/
@OneToMany(() => Participant, participant => participant.address)
participants: Participant[];
}

View File

@ -1,4 +1,4 @@
import { PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
import { PrimaryGeneratedColumn, Column, OneToMany, ManyToOne } from "typeorm";
import {
IsEmail,
IsInt,
@ -53,7 +53,7 @@ export abstract class Participant {
*/
@Column()
@IsOptional()
//TODO: Relationship
@ManyToOne(() => Address, address => address.participants)
address?: Address;
/**