members-database/entities/membership.ts

27 lines
725 B
TypeScript
Raw Permalink Normal View History

2024-08-19 10:47:10 +00:00
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { member } from "./member";
import { membership_status } from "./membership_status";
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
@Column({ type: "date" })
start: Date;
@Column({ type: "date", nullable: true, default: null })
end?: Date;
@Column({ type: "varchar", length: 255, nullable: true })
termination_reason?: string;
2024-08-19 10:47:10 +00:00
@ManyToOne(() => member, (member) => member.memberships)
@JoinColumn()
member: member;
@ManyToOne(() => membership_status, (membership_status) => membership_status.memberships)
@JoinColumn()
status: membership_status;
2024-08-19 10:47:10 +00:00
}