import { Injectable } from '@nestjs/common' ; import { Item } from '@ngrx-workshop-app/api-interface' ; @ Injectable ( ) export class CartService { private itemCount = 0 ; private items : Item [ ] = [ ] ; constructor ( ) { } getItems ( ) { return this . items ; } addItem ( productId ) { this . items . push ( { itemId : `${ this . itemCount ++ }` , productId : productId } ) ; return this . items ; } checkout ( ) { this . items = [ ] ; return this . items ; } }