parent
3766899c83
commit
7fbe649dc9
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue