@react-pakistan/util-functions 1.24.17 → 1.24.19

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.
@@ -14,39 +14,6 @@ interface PostQuotesInvoicesArgs {
14
14
  [key: string]: any;
15
15
  };
16
16
  }
17
- interface PostQuoteInvoiceArgs {
18
- address: string;
19
- category: string;
20
- city: string;
21
- companyId: string;
22
- country: string;
23
- createdAt: string;
24
- currency: string;
25
- customerId: string;
26
- date: string;
27
- discount: string;
28
- discountUnit: string;
29
- email: string;
30
- expiryDate: string;
31
- firstName: string;
32
- id: string;
33
- invoiceStatus: string;
34
- lastName: string;
35
- mode: string;
36
- note: string;
37
- phone: string;
38
- prisma: any;
39
- products: [{
40
- id: string;
41
- productQuantity: string;
42
- }] | undefined;
43
- quoteStatus: string;
44
- ref: string;
45
- services: any[] | undefined;
46
- subTotal: string;
47
- taxValue: string;
48
- total: string;
49
- }
50
17
  interface DeleteQuoteInvoiceArgs {
51
18
  prisma: any;
52
19
  id: string;
@@ -54,6 +21,6 @@ interface DeleteQuoteInvoiceArgs {
54
21
  export declare const getQuotesInvoices: ({ prisma, }: GetQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
55
22
  export declare const getQuoteInvoiceById: ({ prisma, id, }: GetQuoteInvoiceByIdArgs) => Promise<QuoteInvoiceBE>;
56
23
  export declare const postQuotesInvoices: ({ currentPage, pageLimit, prisma, queryWhere, }: PostQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
57
- export declare const postQuoteInvoice: ({ address, category, city, companyId, country, currency, customerId, date, discount, discountUnit, email, expiryDate, firstName, id, invoiceStatus, lastName, mode, note, phone, prisma, products, quoteStatus, ref, services, subTotal, taxValue, total, }: PostQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
24
+ export declare const postQuoteInvoice: ({ address, category, city, companyId, country, currency, customerId, date, discount, discountUnit, email, expiryDate, firstName, id, invoiceStatus, lastName, mode, note, phone, prisma, products, quoteStatus, ref, services, subTotal, taxValue, total, }: any) => Promise<QuoteInvoiceBE>;
58
25
  export declare const deleteQuoteInvoice: ({ prisma, id, }: DeleteQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
59
26
  export {};
@@ -131,10 +131,10 @@ var postQuotesInvoices = function (_a) { return __awaiter(void 0, [_a], void 0,
131
131
  exports.postQuotesInvoices = postQuotesInvoices;
132
132
  var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
133
133
  var quoteInvoice, mappedServices, foundQuoteInvoice, filteredEditServices, filteredCreateServices, err_1;
134
- var _c;
134
+ var _c, _d;
135
135
  var address = _b.address, category = _b.category, city = _b.city, companyId = _b.companyId, country = _b.country, currency = _b.currency, customerId = _b.customerId, date = _b.date, discount = _b.discount, discountUnit = _b.discountUnit, email = _b.email, expiryDate = _b.expiryDate, firstName = _b.firstName, id = _b.id, invoiceStatus = _b.invoiceStatus, lastName = _b.lastName, mode = _b.mode, note = _b.note, phone = _b.phone, prisma = _b.prisma, products = _b.products, quoteStatus = _b.quoteStatus, ref = _b.ref, services = _b.services, subTotal = _b.subTotal, taxValue = _b.taxValue, total = _b.total;
136
- return __generator(this, function (_d) {
137
- switch (_d.label) {
136
+ return __generator(this, function (_e) {
137
+ switch (_e.label) {
138
138
  case 0:
139
139
  if (!(mode === 'Create')) return [3 /*break*/, 5];
140
140
  mappedServices = void 0;
@@ -161,8 +161,8 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
161
161
  },
162
162
  })];
163
163
  case 1:
164
- quoteInvoice = _d.sent();
165
- return [4 /*yield*/, (products === null || products === void 0 ? void 0 : products.forEach(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
164
+ quoteInvoice = _e.sent();
165
+ return [4 /*yield*/, ((_c = products === null || products === void 0 ? void 0 : products.filter(function (product) { return product.productId; })) === null || _c === void 0 ? void 0 : _c.forEach(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
166
166
  var _id = _b.id, productQuantity = _b.productQuantity;
167
167
  return __generator(this, function (_c) {
168
168
  switch (_c.label) {
@@ -180,7 +180,7 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
180
180
  });
181
181
  }); }))];
182
182
  case 2:
183
- _d.sent();
183
+ _e.sent();
184
184
  return [3 /*break*/, 5];
185
185
  case 3: return [4 /*yield*/, prisma.quoteInvoice.create({
186
186
  data: {
@@ -218,28 +218,28 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
218
218
  },
219
219
  })];
220
220
  case 4:
221
- quoteInvoice = _d.sent();
222
- _d.label = 5;
221
+ quoteInvoice = _e.sent();
222
+ _e.label = 5;
223
223
  case 5:
224
224
  if (!(mode === 'Edit')) return [3 /*break*/, 12];
225
- _d.label = 6;
225
+ _e.label = 6;
226
226
  case 6:
227
- _d.trys.push([6, 11, , 12]);
227
+ _e.trys.push([6, 11, , 12]);
228
228
  return [4 /*yield*/, prisma.quoteInvoice.findUnique({
229
229
  where: {
230
230
  id: id,
231
231
  },
232
232
  })];
233
233
  case 7:
234
- foundQuoteInvoice = _d.sent();
234
+ foundQuoteInvoice = _e.sent();
235
235
  filteredEditServices = services === null || services === void 0 ? void 0 : services.filter(function (_a) {
236
236
  var _mode = _a.mode;
237
237
  return _mode === 'Edit';
238
238
  });
239
- filteredCreateServices = (_c = services === null || services === void 0 ? void 0 : services.filter(function (_a) {
239
+ filteredCreateServices = (_d = services === null || services === void 0 ? void 0 : services.filter(function (_a) {
240
240
  var __mode = _a.mode;
241
241
  return __mode === 'Create';
242
- })) === null || _c === void 0 ? void 0 : _c.map(function (item) {
242
+ })) === null || _d === void 0 ? void 0 : _d.map(function (item) {
243
243
  var toReturn = __assign({}, item);
244
244
  delete toReturn.mode;
245
245
  return (__assign(__assign({}, toReturn), { quoteInvoiceId: id }));
@@ -273,8 +273,8 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
273
273
  data: filteredCreateServices,
274
274
  })];
275
275
  case 8:
276
- _d.sent();
277
- _d.label = 9;
276
+ _e.sent();
277
+ _e.label = 9;
278
278
  case 9: return [4 /*yield*/, prisma.quoteInvoice.update({
279
279
  where: {
280
280
  id: id,
@@ -282,10 +282,10 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
282
282
  data: __assign(__assign({}, foundQuoteInvoice), { category: category, companyId: companyId, currency: currency, customerId: customerId, date: date, expiryDate: expiryDate, invoiceStatus: invoiceStatus, note: note, quoteStatus: quoteStatus, ref: ref, subTotal: subTotal, taxValue: taxValue, total: total }),
283
283
  })];
284
284
  case 10:
285
- quoteInvoice = _d.sent();
285
+ quoteInvoice = _e.sent();
286
286
  return [3 /*break*/, 12];
287
287
  case 11:
288
- err_1 = _d.sent();
288
+ err_1 = _e.sent();
289
289
  console.log('err lib', err_1);
290
290
  return [3 /*break*/, 12];
291
291
  case 12: return [2 /*return*/, quoteInvoice];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.24.17",
3
+ "version": "1.24.19",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {