diff --git a/src/product/product.service.ts b/src/product/product.service.ts index c585f55..227afa1 100644 --- a/src/product/product.service.ts +++ b/src/product/product.service.ts @@ -12,6 +12,7 @@ import { UsersService } from '../users/users.service'; import { SupplierService } from '../users/supplier/supplier.service'; import { parsingFile } from '../helper/csv-parser'; import { PartnerService } from '../users/partner/partner.service'; +import { isNull } from 'util'; export class ProductService { constructor( @@ -90,6 +91,11 @@ export class ProductService { }); } + if(!dataHistoryPrice){ + console.log(productData,"productnya",partnerData); + return; + } + dataHistoryPrice.endDate = new Date(); await this.productHistoryPrice.save(dataHistoryPrice); @@ -99,7 +105,6 @@ export class ProductService { price: it[3], type: productType.NORMAL, startDate: new Date(), - endDate: null, partner: it[6] != '-' ? partnerData : null, }); } else { @@ -122,7 +127,7 @@ export class ProductService { type: productType.NORMAL, startDate: new Date(), endDate: null, - partner: it[6] != '-' ? partnerData : null, + partner: partnerData, }); } }),