diff --git a/src/modules/coupons/entities/coupon.entity.ts b/src/modules/coupons/entities/coupon.entity.ts index 0ab9bba..f53c06c 100644 --- a/src/modules/coupons/entities/coupon.entity.ts +++ b/src/modules/coupons/entities/coupon.entity.ts @@ -1,6 +1,7 @@ import { Entity, ManyToOne, Property, Enum, Unique } from '@mikro-orm/core'; import { BaseEntity } from '../../../common/entities/base.entity'; import { Restaurant } from '../../restaurants/entities/restaurant.entity'; +import { normalizePhone } from '../../utils/phone.util'; export enum CouponType { PERCENTAGE = 'PERCENTAGE', @@ -58,6 +59,14 @@ export class Coupon extends BaseEntity { @Property({ type: 'json', nullable: true }) foods?: string[]; // Array of food IDs + private _userPhone?: string; + @Property({ nullable: true }) - userPhone?: string; // Phone number of the user who can use this coupon + get userPhone(): string | undefined { + return this._userPhone; + } + + set userPhone(value: string | undefined) { + this._userPhone = value ? normalizePhone(value) : undefined; + } }