Switched Address to embedded entity

ref #105
This commit is contained in:
Nicolai Ort 2021-01-16 16:45:49 +01:00
parent 3766899c83
commit 7fbe649dc9
1 changed files with 1 additions and 26 deletions

View File

@ -1,36 +1,17 @@
import {
IsInt,
IsNotEmpty,
IsOptional,
IsPostalCode,
IsString
} from "class-validator";
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Column } from "typeorm";
import { config } from '../../config';
import { IAddressUser } from './IAddressUser';
/**
* Defines the Address entity.
* Implemented this way to prevent any formatting differences.
*/
@Entity()
export class Address {
/**
* Autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsInt()
id: number;
/**
* The address's description.
* Optional and mostly for UX.
*/
@Column({ nullable: true })
@IsString()
@IsOptional()
description?: string;
/**
* The address's first line.
* Containing the street and house number.
@ -75,12 +56,6 @@ export class Address {
@IsNotEmpty()
country: string;
/**
* Used to link the address to participants.
*/
@OneToMany(() => IAddressUser, addressUser => addressUser.address, { nullable: true })
addressUsers: IAddressUser[];
/**
* Turns this entity into it's response class.
*/