@react-pakistan/util-functions 1.22.57 → 1.22.59

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.
@@ -32,7 +32,10 @@ interface PostQuoteInvoiceArgs {
32
32
  subTotal: string;
33
33
  taxValue: string;
34
34
  total: string;
35
- productIds: any[];
35
+ products: [{
36
+ id: string;
37
+ productQuantity: string;
38
+ }];
36
39
  phone: string;
37
40
  lastName: string;
38
41
  firstName: string;
@@ -49,6 +52,6 @@ interface DeleteQuoteInvoiceArgs {
49
52
  export declare const getQuotesInvoices: ({ prisma, }: GetQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
50
53
  export declare const getQuoteInvoiceById: ({ prisma, id, }: GetQuoteInvoiceByIdArgs) => Promise<QuoteInvoiceBE>;
51
54
  export declare const postQuotesInvoices: ({ currentPage, pageLimit, prisma, queryWhere, }: PostQuotesInvoicesArgs) => Promise<Array<QuoteInvoiceBE>>;
52
- export declare const postQuoteInvoice: ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, productIds, phone, lastName, firstName, email, country, city, address, prisma, }: PostQuoteInvoiceArgs) => Promise<Array<QuoteInvoiceBE>>;
55
+ export declare const postQuoteInvoice: ({ category, companyId, currency, customerId, date, discount, discountUnit, expiryDate, id, mode, note, ref, services, status, subTotal, taxValue, total, products, phone, lastName, firstName, email, country, city, address, prisma, }: PostQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
53
56
  export declare const deleteQuoteInvoice: ({ prisma, id, }: DeleteQuoteInvoiceArgs) => Promise<QuoteInvoiceBE>;
54
57
  export {};
@@ -60,7 +60,9 @@ const postQuotesInvoices = (_c) => __awaiter(void 0, [_c], void 0, function* ({
60
60
  return quotesInvoices;
61
61
  });
62
62
  exports.postQuotesInvoices = postQuotesInvoices;
63
- 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, productIds, phone, lastName, firstName, email, country, city, address, prisma, }) {
63
+ 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,
64
+ // productIds,
65
+ products, phone, lastName, firstName, email, country, city, address, prisma, }) {
64
66
  let quoteInvoice;
65
67
  if (mode === 'Create') {
66
68
  const mappedServices = services.map((item) => {
@@ -95,16 +97,29 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
95
97
  products: true,
96
98
  },
97
99
  });
98
- yield prisma.quotesInvoicesOnStellarProducts.create({
99
- data: {
100
- quoteInvoiceId: quoteInvoice.id,
101
- productId: productIds[0].id,
102
- },
103
- include: {
104
- product: true,
105
- quoteInvoice: true,
106
- },
107
- });
100
+ products.map((product) => __awaiter(void 0, void 0, void 0, function* () {
101
+ yield prisma.quotesInvoicesOnStellarProducts.create({
102
+ data: {
103
+ quoteInvoiceId: quoteInvoice === null || quoteInvoice === void 0 ? void 0 : quoteInvoice.id,
104
+ productId: product.id,
105
+ productQuantity: product.productQuantity,
106
+ },
107
+ include: {
108
+ product: true,
109
+ quoteInvoice: true,
110
+ },
111
+ });
112
+ }));
113
+ // await prisma.quotesInvoicesOnStellarProducts.create({
114
+ // data: {
115
+ // quoteInvoiceId: quoteInvoice.id,
116
+ // productId: productIds[0].id,
117
+ // },
118
+ // include: {
119
+ // product: true,
120
+ // quoteInvoice: true,
121
+ // },
122
+ // });
108
123
  }
109
124
  else {
110
125
  quoteInvoice = yield prisma.quoteInvoice.create({
@@ -191,9 +206,7 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ca
191
206
  status,
192
207
  subTotal,
193
208
  taxValue,
194
- total, products: {
195
- connect: productIds,
196
- } }),
209
+ total }),
197
210
  });
198
211
  }
199
212
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.57",
3
+ "version": "1.22.59",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {