feat: implement invoice processing and discount management
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { Column, DeleteDateColumn, Entity, OneToMany } from "typeorm";
|
||||
import { Column, DeleteDateColumn, Entity, ManyToOne, OneToMany } from "typeorm";
|
||||
|
||||
import { UsageDiscount } from "./usage-discount.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { DecimalTransformer } from "../../../common/transformers/decimal.transformer";
|
||||
import { Invoice } from "../../invoices/entities/invoice.entity";
|
||||
import { SubscriptionPlan } from "../../subscriptions/entities/subscription.entity";
|
||||
import { User } from "../../users/entities/user.entity";
|
||||
import { DiscountApplicationType } from "../enums/discount-application-type.enum";
|
||||
import { DiscountType } from "../enums/discount-type.enum";
|
||||
|
||||
@@ -40,7 +41,9 @@ export class Discount extends BaseEntity {
|
||||
@DeleteDateColumn({ nullable: true })
|
||||
deletedAt?: Date;
|
||||
|
||||
// Relations
|
||||
@ManyToOne(() => User, (user) => user.discounts, { nullable: true })
|
||||
user?: User | null;
|
||||
|
||||
@OneToMany(() => UsageDiscount, (usageDiscount) => usageDiscount.discount)
|
||||
usages: UsageDiscount[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user