members-database/entities/member.ts

59 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-08-23 07:10:40 +00:00
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
2024-08-19 10:47:10 +00:00
import { Salutation } from "../enums/salutation";
import { membership } from "./membership";
2024-08-23 07:10:40 +00:00
import { memberAwards } from "./memberAwards";
import { memberQualifications } from "./memberQualifications";
import { memberExecutivePositions } from "./memberExecutivePositions";
import { communication } from "./communication";
2024-08-17 14:38:08 +00:00
@Entity()
export class member {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
2024-08-19 10:47:10 +00:00
@Column({ type: "enum", enum: Salutation, default: Salutation.none })
salutation: Salutation;
2024-08-17 14:38:08 +00:00
@Column({ type: "varchar", length: 255 })
firstname: string;
@Column({ type: "varchar", length: 255 })
lastname: string;
@Column({ type: "varchar", length: 255 })
nameaffix: string;
2024-08-17 14:38:08 +00:00
@Column({ type: "date" })
birthdate: Date;
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
2024-08-23 07:10:40 +00:00
sepaMandat?: string;
2024-08-19 10:47:10 +00:00
2024-08-23 07:10:40 +00:00
@OneToMany(() => communication, (communications) => communications.member)
communications: communication;
2024-08-19 10:47:10 +00:00
@OneToOne(() => communication, {
2024-08-19 10:47:10 +00:00
nullable: true,
})
2024-08-23 07:10:40 +00:00
@JoinColumn()
sendNewsletter: communication;
@OneToMany(() => membership, (membership) => membership.member)
memberships: membership[];
2024-08-19 10:47:10 +00:00
2024-08-23 07:10:40 +00:00
@OneToMany(() => memberExecutivePositions, (executivePositions) => executivePositions.member, {
2024-08-17 14:38:08 +00:00
onDelete: "CASCADE",
})
2024-08-23 07:10:40 +00:00
positions: memberExecutivePositions[];
2024-08-17 14:38:08 +00:00
2024-08-23 07:10:40 +00:00
@OneToMany(() => memberQualifications, (qualifications) => qualifications.member, {
2024-08-17 14:38:08 +00:00
onDelete: "CASCADE",
})
2024-08-23 07:10:40 +00:00
qualifications: memberQualifications[];
2024-08-19 10:47:10 +00:00
2024-08-23 07:10:40 +00:00
@OneToMany(() => memberAwards, (awards) => awards.member, {
2024-08-19 10:47:10 +00:00
onDelete: "CASCADE",
})
2024-08-23 07:10:40 +00:00
awards: memberAwards[];
2024-08-17 14:38:08 +00:00
}