members-database/entities/membership.ts

30 lines
816 B
TypeScript
Raw Normal View History

2024-08-19 10:47:10 +00:00
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { member } from "./member";
2024-08-23 07:10:40 +00:00
import { membershipStatus } from "./membershipStatus";
2024-08-19 10:47:10 +00:00
@Entity()
export class membership {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
2024-08-19 10:47:10 +00:00
2024-08-23 07:10:40 +00:00
@Column({ type: "varchar", length: 255, unique: true, nullable: true })
internalId?: string;
2024-08-19 10:47:10 +00:00
@Column({ type: "date" })
start: Date;
@Column({ type: "date", nullable: true, default: null })
end?: Date;
@Column({ type: "varchar", length: 255, nullable: true })
2024-08-23 07:10:40 +00:00
terminationReason?: string;
2024-08-19 10:47:10 +00:00
@ManyToOne(() => member, (member) => member.memberships)
@JoinColumn()
member: member;
2024-08-23 07:10:40 +00:00
@ManyToOne(() => membershipStatus, (membershipStatus) => membershipStatus.memberships)
@JoinColumn()
2024-08-23 07:10:40 +00:00
status: membershipStatus;
2024-08-19 10:47:10 +00:00
}