chore: add invoice and subscription entities
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Column, Entity, ManyToOne } from "typeorm";
|
||||
|
||||
import { SubscriptionPlan } from "./subscription.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { User } from "../../users/entities/user.entity";
|
||||
|
||||
@Entity()
|
||||
export class UserSubscription extends BaseEntity {
|
||||
@ManyToOne(() => User, (user) => user.subscriptions, { nullable: false, onDelete: "CASCADE" })
|
||||
user: User;
|
||||
|
||||
@ManyToOne(() => SubscriptionPlan, { nullable: false, onDelete: "CASCADE" })
|
||||
plan: SubscriptionPlan;
|
||||
|
||||
@Column({ type: "timestamp", nullable: false }) // When the subscription started
|
||||
startDate: Date;
|
||||
|
||||
@Column({ type: "timestamp", nullable: false }) // When it expires
|
||||
endDate: Date;
|
||||
|
||||
@Column({ type: "boolean", default: false }) // Whether the user canceled it
|
||||
isCanceled: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user