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; @Column({ type: "varchar", length: 255, unique: true, nullable: true }) sepaMandat?: string; @OneToMany(() => communication, (communications) => communications.member) communications: communication; @OneToOne(() => communication, { nullable: true, }) @JoinColumn() sendNewsletter: communication; @OneToMany(() => membership, (membership) => membership.member) memberships: membership[]; @OneToMany(() => memberExecutivePositions, (executivePositions) => executivePositions.member, { onDelete: "CASCADE", }) positions: memberExecutivePositions[]; @OneToMany(() => memberQualifications, (qualifications) => qualifications.member, { onDelete: "CASCADE", }) qualifications: memberQualifications[]; @OneToMany(() => memberAwards, (awards) => awards.member, { onDelete: "CASCADE", }) awards: memberAwards[]; }