@react-pakistan/util-functions 1.22.80 → 1.22.82
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;
|
|
@@ -107,17 +108,13 @@ products, createdAt, phone, lastName, firstName, email, country, city, address,
|
|
|
107
108
|
products: true,
|
|
108
109
|
},
|
|
109
110
|
});
|
|
110
|
-
products.forEach((
|
|
111
|
+
products === null || products === void 0 ? void 0 : products.forEach((_f) => __awaiter(void 0, [_f], void 0, function* ({ id: _id, productQuantity }) {
|
|
111
112
|
yield prisma.quotesInvoicesOnStellarProducts.create({
|
|
112
113
|
data: {
|
|
113
114
|
quoteInvoiceId: quoteInvoice === null || quoteInvoice === void 0 ? void 0 : quoteInvoice.id,
|
|
114
115
|
productId: _id,
|
|
115
116
|
productQuantity,
|
|
116
117
|
},
|
|
117
|
-
include: {
|
|
118
|
-
product: true,
|
|
119
|
-
quoteInvoice: true,
|
|
120
|
-
},
|
|
121
118
|
});
|
|
122
119
|
}));
|
|
123
120
|
// await prisma.quotesInvoicesOnStellarProducts.create({
|
|
@@ -175,15 +172,13 @@ products, createdAt, phone, lastName, firstName, email, country, city, address,
|
|
|
175
172
|
id,
|
|
176
173
|
},
|
|
177
174
|
});
|
|
178
|
-
const filteredEditServices = services.filter(({ mode: _mode }) => _mode === 'Edit');
|
|
179
|
-
const filteredCreateServices = services
|
|
180
|
-
.filter(({ mode: __mode }) => __mode === 'Create')
|
|
181
|
-
.map((item) => {
|
|
175
|
+
const filteredEditServices = services === null || services === void 0 ? void 0 : services.filter(({ mode: _mode }) => _mode === 'Edit');
|
|
176
|
+
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) => {
|
|
182
177
|
const toReturn = Object.assign({}, item);
|
|
183
178
|
delete toReturn.mode;
|
|
184
179
|
return (Object.assign(Object.assign({}, toReturn), { quoteInvoiceId: id }));
|
|
185
180
|
});
|
|
186
|
-
filteredEditServices.map((item) => __awaiter(void 0, void 0, void 0, function* () {
|
|
181
|
+
filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.map((item) => __awaiter(void 0, void 0, void 0, function* () {
|
|
187
182
|
yield prisma.stellarService.update({
|
|
188
183
|
where: {
|
|
189
184
|
id: item.id,
|
|
@@ -248,7 +243,7 @@ products, createdAt, phone, lastName, firstName, email, country, city, address,
|
|
|
248
243
|
return quoteInvoice;
|
|
249
244
|
});
|
|
250
245
|
exports.postQuoteInvoice = postQuoteInvoice;
|
|
251
|
-
const deleteQuoteInvoice = (
|
|
246
|
+
const deleteQuoteInvoice = (_g) => __awaiter(void 0, [_g], void 0, function* ({ prisma, id, }) {
|
|
252
247
|
const quoteInvoice = yield prisma.quoteInvoice.delete({
|
|
253
248
|
where: {
|
|
254
249
|
id,
|