cart and coupon

This commit is contained in:
2025-12-06 20:26:37 +03:30
parent a7d28ab882
commit e342c00e25
9 changed files with 114 additions and 122 deletions
+3 -13
View File
@@ -12,7 +12,7 @@ import {
} from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { PaymentStatusEnum } from '../../payments/interface/payment';
import { OrderStatus } from '../interface/order-status';
import { OrderCouponDetail, OrderStatus } from '../interface/order-status';
import { User } from '../../users/entities/user.entity';
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
import { UserAddress } from '../../users/entities/user-address.entity';
@@ -51,17 +51,7 @@ export class Order extends BaseEntity {
couponDiscount: number = 0;
@Property({ type: 'jsonb', nullable: true })
couponDetail: {
couponId: string;
couponName: string;
couponCode: string;
type: 'PERCENTAGE' | 'FIXED' | 'DELIVERY' | 'ITEM';
value: number;
maxDiscount?: number;
calculatedDiscount: number;
ruleVersion?: string;
} | null = null;
couponDetail?: OrderCouponDetail | null;
@Property({ type: 'decimal', precision: 10, scale: 0, default: 0 })
itemsDiscount: number = 0;
@@ -76,7 +66,7 @@ export class Order extends BaseEntity {
tax: number = 0;
@Property({ type: 'decimal', precision: 10, scale: 0, default: 0 })
shipmentFee: number = 0;
deliveryFee: number = 0;
@Property({ type: 'decimal', precision: 10, scale: 0 })
total!: number;