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; }