chore: add discount logic to apply to the plan price and ...

This commit is contained in:
mahyargdz
2025-04-19 12:36:33 +03:30
parent f9e44fc29a
commit bf3402cc7a
8 changed files with 144 additions and 20 deletions
@@ -20,6 +20,9 @@ export class SubscriptionPlan extends BaseEntity {
@Column({ type: "decimal", precision: 16, scale: 2, nullable: false, transformer: new DecimalTransformer() })
price: Decimal;
@Column({ type: "decimal", precision: 16, scale: 2, nullable: true, transformer: new DecimalTransformer() })
originalPrice?: Decimal;
@Column({ type: "boolean", default: true })
isActive: boolean;
@@ -202,6 +202,7 @@ export class SubscriptionsService {
where: { id: subscribeDto.planId, service: { id: serviceId } },
relations: {
service: true,
directDiscount: true,
},
});