@react-pakistan/util-functions 1.22.79 → 1.22.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,7 @@ interface PostQuoteInvoiceArgs {
27
27
  mode: string;
28
28
  note: string;
29
29
  ref: string;
30
- services: any[];
30
+ services: any[] | undefined;
31
31
  status: string;
32
32
  subTotal: string;
33
33
  taxValue: string;
@@ -35,7 +35,7 @@ interface PostQuoteInvoiceArgs {
35
35
  products: [{
36
36
  id: string;
37
37
  productQuantity: string;
38
- }];
38
+ }] | undefined;
39
39
  createdAt: string;
40
40
  phone: string;
41
41
  lastName: string;
@@ -70,6 +70,7 @@ exports.postQuotesInvoices = postQuotesInvoices;
70
70
  const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total,
71
71
  // productIds,
72
72
  products, createdAt, phone, lastName, firstName, email, country, city, address, prisma, }) {
73
+ var _e;
73
74
  let quoteInvoice;
74
75
  if (mode === 'Create') {
75
76
  let mappedServices;
@@ -82,8 +83,7 @@ products, createdAt, phone, lastName, firstName, email, country, city, address,
82
83
  }
83
84
  if (customerId || companyId) {
84
85
  quoteInvoice = yield prisma.quoteInvoice.create({
85
- data: {
86
- category,
86
+ data: Object.assign({ category,
87
87
  companyId,
88
88
  currency,
89
89
  customerId,
@@ -97,21 +97,18 @@ products, createdAt, phone, lastName, firstName, email, country, city, address,
97
97
  subTotal,
98
98
  taxValue,
99
99
  total,
100
- createdAt,
100
+ createdAt }, (mappedServices && {
101
101
  services: {
102
102
  createMany: {
103
103
  data: mappedServices,
104
104
  },
105
105
  },
106
- // products: {
107
- // connect: products,
108
- // },
109
- },
106
+ })),
110
107
  include: {
111
108
  products: true,
112
109
  },
113
110
  });
114
- products.forEach((_e) => __awaiter(void 0, [_e], void 0, function* ({ id: _id, productQuantity }) {
111
+ products === null || products === void 0 ? void 0 : products.forEach((_f) => __awaiter(void 0, [_f], void 0, function* ({ id: _id, productQuantity }) {
115
112
  yield prisma.quotesInvoicesOnStellarProducts.create({
116
113
  data: {
117
114
  quoteInvoiceId: quoteInvoice === null || quoteInvoice === void 0 ? void 0 : quoteInvoice.id,
@@ -179,15 +176,13 @@ products, createdAt, phone, lastName, firstName, email, country, city, address,
179
176
  id,
180
177
  },
181
178
  });
182
- const filteredEditServices = services.filter(({ mode: _mode }) => _mode === 'Edit');
183
- const filteredCreateServices = services
184
- .filter(({ mode: __mode }) => __mode === 'Create')
185
- .map((item) => {
179
+ const filteredEditServices = services === null || services === void 0 ? void 0 : services.filter(({ mode: _mode }) => _mode === 'Edit');
180
+ const filteredCreateServices = (_e = services === null || services === void 0 ? void 0 : services.filter(({ mode: __mode }) => __mode === 'Create')) === null || _e === void 0 ? void 0 : _e.map((item) => {
186
181
  const toReturn = Object.assign({}, item);
187
182
  delete toReturn.mode;
188
183
  return (Object.assign(Object.assign({}, toReturn), { quoteInvoiceId: id }));
189
184
  });
190
- filteredEditServices.map((item) => __awaiter(void 0, void 0, void 0, function* () {
185
+ filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.map((item) => __awaiter(void 0, void 0, void 0, function* () {
191
186
  yield prisma.stellarService.update({
192
187
  where: {
193
188
  id: item.id,
@@ -252,7 +247,7 @@ products, createdAt, phone, lastName, firstName, email, country, city, address,
252
247
  return quoteInvoice;
253
248
  });
254
249
  exports.postQuoteInvoice = postQuoteInvoice;
255
- const deleteQuoteInvoice = (_f) => __awaiter(void 0, [_f], void 0, function* ({ prisma, id, }) {
250
+ const deleteQuoteInvoice = (_g) => __awaiter(void 0, [_g], void 0, function* ({ prisma, id, }) {
256
251
  const quoteInvoice = yield prisma.quoteInvoice.delete({
257
252
  where: {
258
253
  id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.79",
3
+ "version": "1.22.81",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {