import { IDtoConverter } from "../interfaces" ; import { IExchangeOrderBookDto , IOrderBookDto } from "../dtos" ; import { IExchangeOrderBook , IOrderBook } from "../models" ; import { OrderBookDtoConverter } from "./order-book-dto-converter" ; export class ExchangeOrderBookDtoConverter implements IDtoConverter < IExchangeOrderBookDto , IExchangeOrderBook > { private _orderBookDtoConverter : OrderBookDtoConverter = new OrderBookDtoConverter ( ) ; public convertFromDto ( dto ) { let orderBookDto = null ; if ( dto . orderBook ) { orderBookDto = this . _orderBookDtoConverter . convertFromDto ( dto . orderBook ) ; } const result = { exchange : dto . exchange , orderBook : orderBookDto } ; return result ; } public convertToDto ( model ) { let orderBookDto = null ; if ( model . orderBook ) { orderBookDto = this . _orderBookDtoConverter . convertToDto ( model . orderBook ) ; } const result = { exchange : model . exchange , orderBook : orderBookDto } ; return result ; } }