import { Request , Response , NextFunction as Next } from 'express' ; import { IGetOrderById , IGetOrders } from './interfaces' ; import { sendJson } from './utils/sendJson' ; import { expectFound } from './utils/NotFoundError' ; export const getOrders = ( req , res , next ) => ( { ecommerceService } ) => ecommerceService . getOrders ( ) . then ( sendJson ( res ) , next ) ; export const getOrderById = ( { params } , res , next ) => ( { ecommerceService } ) => ecommerceService . getOrderById ( params . id ) . then ( expectFound ( `Order(${ params . id })` ) ) . then ( sendJson ( res ) , next ) ;