Skip to content

Commit

Permalink
fix: improve error handling for empty salesorder shipment date
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikZed committed Jun 21, 2023
1 parent fd02fed commit f492c03
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/integration-zoho-entities/src/salesorders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ export class ZohoSalesOrdersSyncService {
},
};

const expectedShippingDate = salesorder.shipment_date
? new Date(salesorder.shipment_date)
: undefined;

// Create or connect the internal order using the salesorder number as identifier
const orderCreateOrConnect: Prisma.OrderUpdateOneRequiredWithoutZohoSalesOrdersNestedInput =
{
Expand All @@ -293,7 +297,7 @@ export class ZohoSalesOrdersSyncService {
id: id.id("order"),
orderNumber: salesorder.salesorder_number,
date: new Date(salesorder.date),
expectedShippingDate: new Date(salesorder.shipment_date),
expectedShippingDate,
carrier,
totalPriceGross: salesorder.total,
invoiceStatus,
Expand Down Expand Up @@ -360,7 +364,7 @@ export class ZohoSalesOrdersSyncService {
order: {
update: {
date: new Date(salesorder.date),
expectedShippingDate: new Date(salesorder.shipment_date),
expectedShippingDate,
customerNote,
carrier,
shipmentStatus: this.parseShipmentStatus(
Expand Down

1 comment on commit f492c03

@vercel
Copy link

@vercel vercel bot commented on f492c03 Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.