ff-admin-server/src/entity/club/member/member.ts

62 lines
2.1 KiB
TypeScript
Raw Normal View History

import { Column, ColumnType, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, PrimaryColumn } from "typeorm";
2024-09-14 11:32:34 +02:00
import { membership } from "./membership";
import { memberAwards } from "./memberAwards";
import { memberQualifications } from "./memberQualifications";
import { memberExecutivePositions } from "./memberExecutivePositions";
import { communication } from "./communication";
2025-02-15 10:59:54 +01:00
import { salutation } from "../../configuration/salutation";
import { getTypeByORM } from "../../../migrations/ormHelper";
2024-09-14 11:32:34 +02:00
@Entity()
export class member {
2025-01-29 08:53:49 +01:00
@PrimaryColumn({ generated: "uuid", type: "varchar" })
id: string;
2024-09-14 11:32:34 +02:00
@Column({ type: "varchar", length: 255 })
firstname: string;
@Column({ type: "varchar", length: 255 })
lastname: string;
@Column({ type: "varchar", length: 255 })
nameaffix: string;
@Column({ type: getTypeByORM("date").type as ColumnType })
2024-09-14 11:32:34 +02:00
birthdate: Date;
2025-01-02 17:08:53 +01:00
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
internalId?: string;
2025-01-25 10:20:57 +01:00
@Column()
salutationId: number;
2025-01-28 11:09:42 +01:00
@ManyToOne(() => salutation, (salutation) => salutation.members, {
nullable: false,
onDelete: "RESTRICT",
onUpdate: "RESTRICT",
2025-01-29 16:49:34 +01:00
cascade: ["insert"],
2025-01-28 11:09:42 +01:00
})
2025-01-25 10:20:57 +01:00
salutation: salutation;
2025-01-29 16:49:34 +01:00
@OneToMany(() => communication, (communications) => communications.member, { cascade: ["insert"] })
communications: communication[];
@OneToMany(() => membership, (membership) => membership.member, { cascade: ["insert"] })
2024-09-14 11:32:34 +02:00
memberships: membership[];
2025-01-29 16:49:34 +01:00
@OneToMany(() => memberAwards, (awards) => awards.member, { cascade: ["insert"] })
2024-09-14 11:32:34 +02:00
awards: memberAwards[];
2025-01-29 16:49:34 +01:00
@OneToMany(() => memberExecutivePositions, (executivePositions) => executivePositions.member, { cascade: ["insert"] })
2024-09-14 11:32:34 +02:00
positions: memberExecutivePositions[];
2025-01-29 16:49:34 +01:00
@OneToMany(() => memberQualifications, (qualifications) => qualifications.member, { cascade: ["insert"] })
2024-09-14 11:32:34 +02:00
qualifications: memberQualifications[];
2024-09-16 15:55:41 +02:00
firstMembershipEntry?: membership;
lastMembershipEntry?: membership;
2024-09-17 16:44:39 +02:00
preferredCommunication?: Array<communication>;
2024-11-27 10:07:59 +01:00
smsAlarming?: Array<communication>;
sendNewsletter?: communication;
2024-09-14 11:32:34 +02:00
}