26 lines
954 B
TypeScript
26 lines
954 B
TypeScript
// 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: 150, nullable: false, unique: true })
|
|
name: string;
|
|
|
|
@Column({ type: "int", nullable: false })
|
|
duration: number;
|
|
|
|
@Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() })
|
|
price: Decimal;
|
|
//
|
|
@Column({ type: "boolean", default: true })
|
|
isActive: boolean;
|
|
|
|
@ManyToOne(() => DanakService, (danakService) => danakService.subscriptionPlans, { nullable: false, onDelete: "CASCADE" })
|
|
service: DanakService;
|
|
}
|