From 7b0056f2ae8c9a9c997360f701f62b0c9e859511 Mon Sep 17 00:00:00 2001 From: ilham Date: Thu, 23 Dec 2021 21:43:48 +0700 Subject: [PATCH] fix: product --- src/product/product.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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, }); } }),