coupon
This commit is contained in:
@@ -61,6 +61,9 @@ export class CouponService {
|
||||
endDate: createCouponDto.endDate ? new Date(createCouponDto.endDate) : undefined,
|
||||
isActive: createCouponDto.isActive ?? true,
|
||||
usedCount: 0,
|
||||
foodCategories: createCouponDto.foodCategories,
|
||||
foods: createCouponDto.foods,
|
||||
userPhone: createCouponDto.userPhone,
|
||||
};
|
||||
|
||||
const coupon = this.couponRepository.create(data);
|
||||
@@ -134,6 +137,9 @@ export class CouponService {
|
||||
if (dto.startDate !== undefined) coupon.startDate = dto.startDate ? new Date(dto.startDate) : undefined;
|
||||
if (dto.endDate !== undefined) coupon.endDate = dto.endDate ? new Date(dto.endDate) : undefined;
|
||||
if (dto.isActive !== undefined) coupon.isActive = dto.isActive;
|
||||
if (dto.foodCategories !== undefined) coupon.foodCategories = dto.foodCategories;
|
||||
if (dto.foods !== undefined) coupon.foods = dto.foods;
|
||||
if (dto.userPhone !== undefined) coupon.userPhone = dto.userPhone;
|
||||
|
||||
await this.em.persistAndFlush(coupon);
|
||||
return coupon;
|
||||
|
||||
Reference in New Issue
Block a user