52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
|
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
|
||
|
import { Salutation } from "../enums/salutation";
|
||
|
import { membership } from "./membership";
|
||
|
import { memberAwards } from "./memberAwards";
|
||
|
import { memberQualifications } from "./memberQualifications";
|
||
|
import { memberExecutivePositions } from "./memberExecutivePositions";
|
||
|
import { communication } from "./communication";
|
||
|
|
||
|
@Entity()
|
||
|
export class member {
|
||
|
@PrimaryColumn({ generated: "increment", type: "int" })
|
||
|
id: number;
|
||
|
|
||
|
@Column({ type: "enum", enum: Salutation, default: Salutation.none })
|
||
|
salutation: Salutation;
|
||
|
|
||
|
@Column({ type: "varchar", length: 255 })
|
||
|
firstname: string;
|
||
|
|
||
|
@Column({ type: "varchar", length: 255 })
|
||
|
lastname: string;
|
||
|
|
||
|
@Column({ type: "varchar", length: 255 })
|
||
|
nameaffix: string;
|
||
|
|
||
|
@Column({ type: "date" })
|
||
|
birthdate: Date;
|
||
|
|
||
|
@OneToMany(() => communication, (communications) => communications.member)
|
||
|
communications: communication;
|
||
|
|
||
|
@OneToOne(() => communication, {
|
||
|
nullable: true,
|
||
|
onDelete: "SET NULL",
|
||
|
onUpdate: "RESTRICT",
|
||
|
})
|
||
|
@JoinColumn()
|
||
|
sendNewsletter?: communication;
|
||
|
|
||
|
@OneToMany(() => membership, (membership) => membership.member)
|
||
|
memberships: membership[];
|
||
|
|
||
|
@OneToMany(() => memberAwards, (awards) => awards.member)
|
||
|
awards: memberAwards[];
|
||
|
|
||
|
@OneToMany(() => memberExecutivePositions, (executivePositions) => executivePositions.member)
|
||
|
positions: memberExecutivePositions[];
|
||
|
|
||
|
@OneToMany(() => memberQualifications, (qualifications) => qualifications.member)
|
||
|
qualifications: memberQualifications[];
|
||
|
}
|