normalize
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user