This commit is contained in:
2025-12-06 22:05:56 +03:30
parent e342c00e25
commit f36125764d
5 changed files with 140 additions and 6 deletions
@@ -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;