@react-pakistan/util-functions 1.24.69 → 1.24.72
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.
- package/api/stellar-solutions/app-user/index.d.ts +8 -7
- package/api/stellar-solutions/app-user/index.js +60 -24
- package/api/stellar-solutions/bank/index.d.ts +11 -8
- package/api/stellar-solutions/bank/index.js +58 -20
- package/api/stellar-solutions/branch/index.d.ts +11 -8
- package/api/stellar-solutions/branch/index.js +61 -17
- package/api/stellar-solutions/company/index.d.ts +13 -8
- package/api/stellar-solutions/company/index.js +70 -28
- package/api/stellar-solutions/company-report/index.d.ts +1 -1
- package/api/stellar-solutions/contact/index.d.ts +12 -9
- package/api/stellar-solutions/contact/index.js +70 -22
- package/api/stellar-solutions/currency/index.d.ts +11 -8
- package/api/stellar-solutions/currency/index.js +66 -31
- package/api/stellar-solutions/customer/index.d.ts +14 -10
- package/api/stellar-solutions/customer/index.js +80 -35
- package/api/stellar-solutions/expense/index.d.ts +8 -7
- package/api/stellar-solutions/expense/index.js +77 -29
- package/api/stellar-solutions/expense-category/index.d.ts +8 -9
- package/api/stellar-solutions/expense-category/index.js +45 -30
- package/api/stellar-solutions/lead/index.d.ts +6 -5
- package/api/stellar-solutions/lead/index.js +46 -28
- package/api/stellar-solutions/menu-order/index.d.ts +11 -8
- package/api/stellar-solutions/menu-order/index.js +56 -29
- package/api/stellar-solutions/payment/index.d.ts +9 -8
- package/api/stellar-solutions/payment/index.js +56 -39
- package/api/stellar-solutions/payment-mode/index.d.ts +13 -7
- package/api/stellar-solutions/payment-mode/index.js +65 -33
- package/api/stellar-solutions/preference/index.d.ts +4 -4
- package/api/stellar-solutions/preference/index.js +11 -11
- package/api/stellar-solutions/product/index.d.ts +9 -12
- package/api/stellar-solutions/product/index.js +45 -32
- package/api/stellar-solutions/product-category/index.d.ts +8 -9
- package/api/stellar-solutions/product-category/index.js +45 -30
- package/api/stellar-solutions/quote-invoice/index.d.ts +9 -8
- package/api/stellar-solutions/quote-invoice/index.js +40 -25
- package/api/stellar-solutions/quote-invoice-report/index.d.ts +1 -1
- package/api/stellar-solutions/tax/index.d.ts +9 -6
- package/api/stellar-solutions/tax/index.js +44 -21
- package/package.json +1 -1
|
@@ -46,32 +46,57 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
49
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
59
|
exports.deleteTax = exports.updateTax = exports.unitTaxById = exports.listTax = void 0;
|
|
60
|
+
var multi_part_search_1 = require("../../../general/multi-part-search");
|
|
51
61
|
/**
|
|
52
62
|
* Retrieves a paginated list of taxes
|
|
53
63
|
* @param {ListTaxArgs} args - Object containing prisma client, pagination, filtering, and ordering options
|
|
54
64
|
* @returns {Promise<[number, Array<TaxBE>]>} Tuple containing total count and array of taxes
|
|
55
65
|
*/
|
|
56
66
|
var listTax = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
57
|
-
var include, orderBy,
|
|
67
|
+
var include, orderBy, idSearchQuery, nameSearchQuery, emailSearchQuery, where, _c, count, items;
|
|
58
68
|
var _d;
|
|
59
|
-
var
|
|
69
|
+
var currentPage = _b.currentPage, _e = _b.includePreference, includePreference = _e === void 0 ? false : _e, _f = _b.orderByColumn, orderByColumn = _f === void 0 ? 'createdAt' : _f, _g = _b.orderByDirection, orderByDirection = _g === void 0 ? 'desc' : _g, pageLimit = _b.pageLimit, prisma = _b.prisma, _h = _b.searchQuery, searchQuery = _h === void 0 ? '' : _h;
|
|
60
70
|
return __generator(this, function (_j) {
|
|
61
71
|
switch (_j.label) {
|
|
62
72
|
case 0:
|
|
63
|
-
if (currentPage < 1) {
|
|
64
|
-
throw new Error('
|
|
73
|
+
if (!currentPage || currentPage < 1) {
|
|
74
|
+
throw new Error('Valid current page is required');
|
|
65
75
|
}
|
|
66
|
-
if (pageLimit < 1) {
|
|
67
|
-
throw new Error('
|
|
76
|
+
if (!pageLimit || pageLimit < 1) {
|
|
77
|
+
throw new Error('Valid page limit is required');
|
|
68
78
|
}
|
|
69
|
-
include = {
|
|
79
|
+
include = {
|
|
80
|
+
preference: includePreference,
|
|
81
|
+
};
|
|
70
82
|
orderBy = (_d = {},
|
|
71
83
|
_d[orderByColumn] = orderByDirection,
|
|
72
84
|
_d);
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
idSearchQuery = (0, multi_part_search_1.multiPartSearch)({
|
|
86
|
+
columnName: 'id',
|
|
87
|
+
fullText: searchQuery,
|
|
88
|
+
});
|
|
89
|
+
nameSearchQuery = (0, multi_part_search_1.multiPartSearch)({
|
|
90
|
+
columnName: 'name',
|
|
91
|
+
fullText: searchQuery,
|
|
92
|
+
});
|
|
93
|
+
emailSearchQuery = (0, multi_part_search_1.multiPartSearch)({
|
|
94
|
+
columnName: 'email',
|
|
95
|
+
fullText: searchQuery,
|
|
96
|
+
});
|
|
97
|
+
where = {
|
|
98
|
+
OR: __spreadArray(__spreadArray(__spreadArray([], idSearchQuery, true), nameSearchQuery, true), emailSearchQuery, true),
|
|
99
|
+
};
|
|
75
100
|
return [4 /*yield*/, prisma.$transaction([
|
|
76
101
|
prisma.tax.count({
|
|
77
102
|
where: where,
|
|
@@ -79,7 +104,7 @@ var listTax = function (_a) { return __awaiter(void 0, [_a], void 0, function (_
|
|
|
79
104
|
prisma.tax.findMany({
|
|
80
105
|
include: include,
|
|
81
106
|
orderBy: orderBy,
|
|
82
|
-
skip:
|
|
107
|
+
skip: (currentPage - 1) * pageLimit,
|
|
83
108
|
take: pageLimit,
|
|
84
109
|
where: where,
|
|
85
110
|
}),
|
|
@@ -98,14 +123,16 @@ exports.listTax = listTax;
|
|
|
98
123
|
*/
|
|
99
124
|
var unitTaxById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
100
125
|
var include, where, tax;
|
|
101
|
-
var id = _b.id, prisma = _b.prisma;
|
|
102
|
-
return __generator(this, function (
|
|
103
|
-
switch (
|
|
126
|
+
var id = _b.id, _c = _b.includePreference, includePreference = _c === void 0 ? false : _c, prisma = _b.prisma;
|
|
127
|
+
return __generator(this, function (_d) {
|
|
128
|
+
switch (_d.label) {
|
|
104
129
|
case 0:
|
|
105
130
|
if (!id) {
|
|
106
131
|
throw new Error('Tax ID is required');
|
|
107
132
|
}
|
|
108
|
-
include = {
|
|
133
|
+
include = {
|
|
134
|
+
preference: includePreference,
|
|
135
|
+
};
|
|
109
136
|
where = {
|
|
110
137
|
id: id,
|
|
111
138
|
};
|
|
@@ -114,7 +141,7 @@ var unitTaxById = function (_a) { return __awaiter(void 0, [_a], void 0, functio
|
|
|
114
141
|
where: where,
|
|
115
142
|
})];
|
|
116
143
|
case 1:
|
|
117
|
-
tax =
|
|
144
|
+
tax = _d.sent();
|
|
118
145
|
return [2 /*return*/, tax];
|
|
119
146
|
}
|
|
120
147
|
});
|
|
@@ -126,7 +153,7 @@ exports.unitTaxById = unitTaxById;
|
|
|
126
153
|
* @returns {Promise<TaxBE>} Created or updated tax
|
|
127
154
|
*/
|
|
128
155
|
var updateTax = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
129
|
-
var taxData,
|
|
156
|
+
var taxData, where, tax;
|
|
130
157
|
var description = _b.description, enabled = _b.enabled, id = _b.id, isDefault = _b.isDefault, preferenceId = _b.preferenceId, prisma = _b.prisma, taxName = _b.taxName, taxRate = _b.taxRate;
|
|
131
158
|
return __generator(this, function (_c) {
|
|
132
159
|
switch (_c.label) {
|
|
@@ -157,13 +184,11 @@ var updateTax = function (_a) { return __awaiter(void 0, [_a], void 0, function
|
|
|
157
184
|
taxName: taxName,
|
|
158
185
|
taxRate: taxRate,
|
|
159
186
|
};
|
|
160
|
-
include = {};
|
|
161
187
|
where = {
|
|
162
188
|
id: id,
|
|
163
189
|
};
|
|
164
190
|
return [4 /*yield*/, prisma.tax.upsert({
|
|
165
191
|
create: __assign({ id: id }, taxData),
|
|
166
|
-
include: include,
|
|
167
192
|
update: taxData,
|
|
168
193
|
where: where,
|
|
169
194
|
})];
|
|
@@ -180,7 +205,7 @@ exports.updateTax = updateTax;
|
|
|
180
205
|
* @returns {Promise<TaxBE>} Deleted tax
|
|
181
206
|
*/
|
|
182
207
|
var deleteTax = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
183
|
-
var
|
|
208
|
+
var where, tax;
|
|
184
209
|
var id = _b.id, prisma = _b.prisma;
|
|
185
210
|
return __generator(this, function (_c) {
|
|
186
211
|
switch (_c.label) {
|
|
@@ -188,12 +213,10 @@ var deleteTax = function (_a) { return __awaiter(void 0, [_a], void 0, function
|
|
|
188
213
|
if (!id) {
|
|
189
214
|
throw new Error('Tax ID is required');
|
|
190
215
|
}
|
|
191
|
-
include = {};
|
|
192
216
|
where = {
|
|
193
217
|
id: id,
|
|
194
218
|
};
|
|
195
219
|
return [4 /*yield*/, prisma.tax.delete({
|
|
196
|
-
include: include,
|
|
197
220
|
where: where,
|
|
198
221
|
})];
|
|
199
222
|
case 1:
|