members-database/entities/member.ts

64 lines
1.6 KiB
TypeScript
Raw Permalink Normal View History

2024-08-17 14:38:08 +00:00
import { Column, Entity, JoinTable, ManyToMany, PrimaryColumn, Unique } from "typeorm";
import { executive_position } from "./executive_position";
import { qualification } from "./qualification";
@Entity()
export class member {
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
id: string;
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
member_id: string;
@Column({ type: "varchar", length: 255 })
firstname: string;
@Column({ type: "varchar", length: 255 })
lastname: string;
@Column({ type: "varchar", length: 255 })
phone: string;
@Column({ type: "varchar", length: 255 })
mobile: string;
@Column({ type: "varchar", length: 255 })
email: string;
@Column({ type: "varchar", length: 255 })
postal_code: string;
@Column({ type: "varchar", length: 255 })
place: string;
@Column({ type: "varchar", length: 255 })
street: string;
@Column({ type: "date" })
birthdate: Date;
@Column({ type: "date" })
accession_date: Date;
@Column({ type: "date", nullable: true, default: null })
leaving_data: Date;
@Column({ type: "boolean", default: true })
active: boolean;
@Column({ type: "boolean", default: false })
push_alert: boolean;
@ManyToMany(() => executive_position, (executive_position) => executive_position.members, {
onDelete: "CASCADE",
})
@JoinTable({ name: "member_executive_position" })
positions: executive_position[];
@ManyToMany(() => qualification, (qualification) => qualification.members, {
onDelete: "CASCADE",
})
@JoinTable({ name: "member_qualification" })
qualifications: qualification[];
}