coupon
This commit is contained in:
@@ -257,7 +257,7 @@ export class CouponService {
|
||||
return prefix + '-' + result;
|
||||
}
|
||||
|
||||
async generateCouponCode(restId: string): Promise<string> {
|
||||
async generateCouponCode(restId: string){
|
||||
const restaurant = await this.restRepository.findOne({ id: restId });
|
||||
if (!restaurant) {
|
||||
throw new NotFoundException(RestMessage.NOT_FOUND);
|
||||
@@ -266,6 +266,6 @@ export class CouponService {
|
||||
const existing = await this.couponRepository.findOne({ code, restaurant: { id: restId } });
|
||||
|
||||
if (existing) return this.generateCouponCode(restId);
|
||||
return code;
|
||||
return {code};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user