import { Service } from 'typedi' ; import { OrmRepository } from 'typeorm-typedi-extensions' ; import { Logger , LoggerInterface } from '../../decorators/Logger' ; import { OrderProduct } from '../models/OrderProduct' ; import { OrderProductRepository } from '../repositories/OrderProductRepository' ; @ Service ( ) export class OrderProductService { constructor ( @ OrmRepository ( ) private orderProductRepository , @ Logger ( __filename ) private log ) { } public async createData ( checkoutdata ) { this . log . info ( 'create a order product data' ) ; return this . orderProductRepository . save ( checkoutdata ) ; } public async findData ( productid , orderid , orderProductid ) { this . log . info ( 'find a order product data' ) ; return this . orderProductRepository . find ( { where : { productId : productid , orderId : orderid , orderProductId : orderProductid } } ) ; } public find ( order ) { return this . orderProductRepository . find ( order ) ; } public findOne ( productData ) { return this . orderProductRepository . findOne ( productData ) ; } public List ( limit ) { return this . orderProductRepository . List ( limit ) ; } public findAndCount ( where ) { return this . orderProductRepository . findAndCount ( where ) ; } }