parent
3766899c83
commit
7fbe649dc9
@ -1,36 +1,17 @@
|
|||||||
import {
|
import {
|
||||||
IsInt,
|
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
IsOptional,
|
IsOptional,
|
||||||
IsPostalCode,
|
IsPostalCode,
|
||||||
IsString
|
IsString
|
||||||
} from "class-validator";
|
} from "class-validator";
|
||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column } from "typeorm";
|
||||||
import { config } from '../../config';
|
import { config } from '../../config';
|
||||||
import { IAddressUser } from './IAddressUser';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the Address entity.
|
* Defines the Address entity.
|
||||||
* Implemented this way to prevent any formatting differences.
|
* Implemented this way to prevent any formatting differences.
|
||||||
*/
|
*/
|
||||||
@Entity()
|
|
||||||
export class Address {
|
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.
|
* The address's first line.
|
||||||
* Containing the street and house number.
|
* Containing the street and house number.
|
||||||
@ -75,12 +56,6 @@ export class Address {
|
|||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
country: string;
|
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.
|
* Turns this entity into it's response class.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user