import { Body , Controller , Delete , Get , Param , Post } from '@nestjs/common' ; import { Product , ShippingMethod , Item } from '@ngrx-workshop-app/api-interface' ; import { CartService } from './cart.service' ; import { ProductService } from './product.service' ; import { ShippingService } from './shipping.service' ; @ Controller ( ) export class AppController { constructor ( private readonly cartService , private readonly productService , private readonly shippingService ) { } @ Get ( 'shipping' ) getShippingMethods ( ) { return this . shippingService . getShippingMethods ( ) ; } @ Get ( 'products' ) getProducts ( ) { return this . productService . getProducts ( ) ; } @ Get ( 'products/:productId' ) getProduct ( @ Param ( 'productId' ) productId ) { return this . productService . getProduct ( + productId ) ; } @ Get ( 'cart' ) getCartItems ( ) { return this . cartService . getItems ( ) ; } @ Post ( 'cart' ) addToCart ( @ Body ( ) { productId } ) { return this . cartService . addItem ( productId ) ; } @ Delete ( 'cart' ) checkout ( ) { return this . cartService . checkout ( ) ; } }