82 lines
2.4 KiB
TypeScript
82 lines
2.4 KiB
TypeScript
import {
|
|
Column,
|
|
ColumnType,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
OneToMany,
|
|
OneToOne,
|
|
PrimaryColumn,
|
|
PrimaryGeneratedColumn,
|
|
} from "typeorm";
|
|
import { membership } from "./membership";
|
|
import { memberAwards } from "./memberAwards";
|
|
import { memberQualifications } from "./memberQualifications";
|
|
import { memberExecutivePositions } from "./memberExecutivePositions";
|
|
import { communication } from "./communication";
|
|
import { salutation } from "../../configuration/salutation";
|
|
import { getTypeByORM } from "../../../migrations/ormHelper";
|
|
import { memberEducations } from "./memberEducations";
|
|
|
|
@Entity()
|
|
export class member {
|
|
@PrimaryGeneratedColumn("uuid")
|
|
id: string;
|
|
|
|
@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 })
|
|
birthdate: Date;
|
|
|
|
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
|
|
internalId?: string;
|
|
|
|
@Column({ type: "varchar", length: 255, nullable: true })
|
|
note?: string;
|
|
|
|
@Column()
|
|
salutationId: number;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@ManyToOne(() => salutation, (salutation) => salutation.members, {
|
|
nullable: false,
|
|
onDelete: "RESTRICT",
|
|
onUpdate: "RESTRICT",
|
|
cascade: ["insert"],
|
|
})
|
|
salutation: salutation;
|
|
|
|
@OneToMany(() => communication, (communications) => communications.member, { cascade: ["insert"] })
|
|
communications: communication[];
|
|
|
|
@OneToMany(() => membership, (membership) => membership.member, { cascade: ["insert"] })
|
|
memberships: membership[];
|
|
|
|
@OneToMany(() => memberAwards, (awards) => awards.member, { cascade: ["insert"] })
|
|
awards: memberAwards[];
|
|
|
|
@OneToMany(() => memberExecutivePositions, (executivePositions) => executivePositions.member, { cascade: ["insert"] })
|
|
positions: memberExecutivePositions[];
|
|
|
|
@OneToMany(() => memberQualifications, (qualifications) => qualifications.member, { cascade: ["insert"] })
|
|
qualifications: memberQualifications[];
|
|
|
|
@OneToMany(() => memberEducations, (educations) => educations.member, { cascade: ["insert"] })
|
|
educations: memberEducations[];
|
|
|
|
firstMembershipEntry?: membership;
|
|
lastMembershipEntry?: membership;
|
|
preferredCommunication?: Array<communication>;
|
|
smsAlarming?: Array<communication>;
|
|
sendNewsletter?: communication;
|
|
}
|