import { Controller , Get , UseGuards , Post , Body } from '@nestjs/common' ; import { AuthGuard } from '@nestjs/passport' ; import { User } from '../utilities/user.decorator' ; import { User as UserDocument } from '../types/user' ; import { OrderService } from './order.service' ; import { CreateOrderDTO } from './order.dto' ; @ Controller ( 'order' ) export class OrderController { constructor ( private orderService ) { } @ Get ( ) @ UseGuards ( AuthGuard ( 'jwt' ) ) listOrders ( @ User ( ) { id } ) { return this . orderService . listOrdersByUser ( id ) ; } @ Post ( ) @ UseGuards ( AuthGuard ( 'jwt' ) ) createOrder ( @ Body ( ) order , @ User ( ) { id } ) { return this . orderService . createOrder ( order , id ) ; } }