fix: bug in repositry of subscriptions
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
// eslint-disable-next-line import/no-named-as-default
|
||||
import Decimal from "decimal.js";
|
||||
import { Column, Entity, ManyToOne } from "typeorm";
|
||||
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { DecimalTransformer } from "../../../common/transformers/decimal.transformer";
|
||||
import { DanakService } from "../../danak-services/entities/danak-service.entity";
|
||||
|
||||
@Entity()
|
||||
export class SubscriptionPlan extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 100, nullable: false })
|
||||
@Column({ type: "varchar", length: 150, nullable: false })
|
||||
name: string;
|
||||
|
||||
@Column({ type: "int", nullable: false })
|
||||
duration: number;
|
||||
|
||||
@Column({ type: "decimal", precision: 10, scale: 2, nullable: false })
|
||||
price: number;
|
||||
|
||||
@Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() })
|
||||
price: Decimal;
|
||||
//
|
||||
@Column({ type: "boolean", default: true })
|
||||
isActive: boolean;
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@ export class UserSubscription extends BaseEntity {
|
||||
@ManyToOne(() => SubscriptionPlan, { nullable: false, onDelete: "CASCADE" })
|
||||
plan: SubscriptionPlan;
|
||||
|
||||
@Column({ type: "timestamp", nullable: false }) // When the subscription started
|
||||
@Column({ type: "timestamp", nullable: false })
|
||||
startDate: Date;
|
||||
|
||||
@Column({ type: "timestamp", nullable: false }) // When it expires
|
||||
@Column({ type: "timestamp", nullable: false })
|
||||
endDate: Date;
|
||||
|
||||
@Column({ type: "boolean", default: false }) // Whether the user canceled it
|
||||
@Column({ type: "boolean", default: false })
|
||||
isCanceled: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user