address
This commit is contained in:
@@ -3,6 +3,7 @@ import { CartService } from '../providers/cart.service';
|
||||
import { AddItemToCartDto } from '../dto/add-item.dto';
|
||||
import { UpdateItemQuantityDto } from '../dto/update-item.dto';
|
||||
import { ApplyCouponDto } from '../dto/apply-coupon.dto';
|
||||
import { SetAddressDto } from '../dto/set-address.dto';
|
||||
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth, ApiBody, ApiParam } from '@nestjs/swagger';
|
||||
import { AuthGuard } from '../../auth/guards/auth.guard';
|
||||
import { UserId } from 'src/common/decorators/user-id.decorator';
|
||||
@@ -73,4 +74,14 @@ export class CartController {
|
||||
async removeCoupon(@UserId() userId: string, @RestId() restaurantId: string) {
|
||||
return this.cartService.removeCoupon(userId, restaurantId);
|
||||
}
|
||||
|
||||
@Patch('address')
|
||||
@ApiOperation({ summary: 'Set address for cart' })
|
||||
@ApiBody({ type: SetAddressDto })
|
||||
@ApiResponse({ status: 200, description: 'Address set successfully' })
|
||||
@ApiResponse({ status: 400, description: 'Bad request (e.g., address does not belong to user)' })
|
||||
@ApiResponse({ status: 404, description: 'Address not found' })
|
||||
async setAddress(@UserId() userId: string, @RestId() restaurantId: string, @Body() setAddressDto: SetAddressDto) {
|
||||
return this.cartService.setAddress(userId, restaurantId, setAddressDto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user