clear cart

This commit is contained in:
2025-12-01 15:53:04 +03:30
parent 6a6c8ce91a
commit 288b0529cd
3 changed files with 19 additions and 11 deletions
@@ -83,6 +83,13 @@ export class CartController {
return this.cartService.removeItem(userId, restaurantId, foodId);
}
@Delete()
@ApiOperation({ summary: 'Clear entire cart' })
@ApiResponse({ status: 200, description: 'Cart cleared successfully' })
async clearCart(@UserId() userId: string, @RestId() restaurantId: string) {
return this.cartService.clearCart(userId, restaurantId);
}
@Post('apply-coupon')
@ApiOperation({ summary: 'Apply coupon to cart' })
@ApiBody({ type: ApplyCouponDto })
@@ -71,6 +71,10 @@ export class CartService {
}
return cart;
}
async findOne2(userId: string, restaurantId: string): Promise<Cart | null> {
const cart = await this.getCartByRestaurant(userId, restaurantId);
return cart;
}
/**
* Add item to cart (increment quantity if item exists, otherwise create new)