members-database/entities/membership.ts

26 lines
695 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";
import { MembershipType } from "../enums/membership_type";
@Entity()
export class membership {
@PrimaryColumn({ generated: "uuid", type: "varchar", length: 36 })
id: string;
@Column({ type: "date" })
start: Date;
@Column({ type: "date", nullable: true, default: null })
end?: Date;
@Column({ type: "enum", enum: MembershipType, default: MembershipType.Active })
type: MembershipType;
@Column({ type: "varchar", length: 255, nullable: true })
reason?: string;
@ManyToOne(() => member, (member) => member.memberships)
@JoinColumn()
member: member;
}