bulk add
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Controller, Get, Post, Body, Patch, Delete, UseGuards, Param } from '@nestjs/common';
|
||||
import { CartService } from '../providers/cart.service';
|
||||
import { AddItemToCartDto } from '../dto/add-item.dto';
|
||||
import { BulkAddItemsToCartDto } from '../dto/bulk-add-items.dto';
|
||||
import { UpdateItemQuantityDto } from '../dto/update-item.dto';
|
||||
import { ApplyCouponDto } from '../dto/apply-coupon.dto';
|
||||
import { SetAddressDto } from '../dto/set-address.dto';
|
||||
@@ -35,6 +36,20 @@ export class CartController {
|
||||
return this.cartService.addItem(userId, restaurantId, addItemDto);
|
||||
}
|
||||
|
||||
@Post('items/bulk')
|
||||
@ApiOperation({ summary: 'Bulk add items to cart (increments quantity if items exist)' })
|
||||
@ApiBody({ type: BulkAddItemsToCartDto })
|
||||
@ApiResponse({ status: 201, description: 'Items added to cart successfully' })
|
||||
@ApiResponse({ status: 400, description: 'Bad request (e.g., insufficient stock, invalid items)' })
|
||||
@ApiResponse({ status: 404, description: 'Food not found' })
|
||||
bulkAddItems(
|
||||
@UserId() userId: string,
|
||||
@RestId() restaurantId: string,
|
||||
@Body() bulkAddItemsDto: BulkAddItemsToCartDto,
|
||||
) {
|
||||
return this.cartService.bulkAddItems(userId, restaurantId, bulkAddItemsDto);
|
||||
}
|
||||
|
||||
@Patch('items/:itemId')
|
||||
@ApiOperation({ summary: 'Update item quantity in cart' })
|
||||
@ApiParam({ name: 'itemId', description: 'Item ID in the cart' })
|
||||
|
||||
Reference in New Issue
Block a user