|
|
@ -11,8 +11,16 @@ export class CartController { |
|
|
|
const result = await this.cartService.addToCart(userId, productId, quantity); |
|
|
|
const result = await this.cartService.addToCart(userId, productId, quantity); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
@Get(':userId') |
|
|
|
@Get(":userId") |
|
|
|
async getUserCart(@Param('userId') userId: number) { |
|
|
|
async getUserCart(@Param("userId") userId: number) { |
|
|
|
return this.cartService.getUserCart(userId); |
|
|
|
return this.cartService.getUserCart(userId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Delete(":userId/:productId") |
|
|
|
|
|
|
|
async removeFromCart( |
|
|
|
|
|
|
|
@Param("userId") userId: number, |
|
|
|
|
|
|
|
@Param("productId") productId: number,
|
|
|
|
|
|
|
|
): Promise<{ message: string }> { |
|
|
|
|
|
|
|
return this.cartService.removeFromCart(userId, productId); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|