Skip to content
This repository was archived by the owner on Jan 15, 2022. It is now read-only.

Commit 9ebc01f

Browse files
committed
refactor: shipping packages
1 parent b44b6a8 commit 9ebc01f

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

packages/core/src/services/shipping-packages.service.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
ID,
3-
Order,
4-
Product,
5-
EntityNotFoundError,
6-
patchEntity
7-
} from '@vendure/core';
1+
import { ID, Order, Product, EntityNotFoundError } from '@vendure/core';
82
import { Injectable } from '@nestjs/common';
93
import { InjectConnection } from '@nestjs/typeorm';
104
import { Connection } from 'typeorm';
@@ -45,7 +39,7 @@ export class ShippingPackagesService {
4539
order: order,
4640
packages
4741
});
48-
42+
4943
if (!order.id) {
5044
return newShippingPackages;
5145
}
@@ -55,9 +49,12 @@ export class ShippingPackagesService {
5549
);
5650

5751
// UPDATE
58-
if(currentShippingPackages){
59-
this.connection.manager.merge(currentShippingPackages, { packages });
52+
if (currentShippingPackages) {
53+
this.connection.manager.merge(ShippingPackages, currentShippingPackages, {
54+
packages
55+
});
6056
// Fix the update problem in postgres https://github.com/typeorm/typeorm/issues/4122
57+
// @ts-ignore
6158
delete currentShippingPackages.order;
6259
return this.connection.manager.save(currentShippingPackages);
6360
}

0 commit comments

Comments
 (0)