@react-pakistan/util-functions 1.24.67 → 1.24.69
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 -31
- package/api/stellar-solutions/app-user/index.js +26 -24
- package/api/stellar-solutions/bank/index.d.ts +9 -32
- package/api/stellar-solutions/bank/index.js +19 -25
- package/api/stellar-solutions/branch/index.d.ts +9 -32
- package/api/stellar-solutions/branch/index.js +19 -25
- package/api/stellar-solutions/company/index.d.ts +9 -32
- package/api/stellar-solutions/company/index.js +29 -27
- package/api/stellar-solutions/company-report/index.d.ts +5 -12
- package/api/stellar-solutions/company-report/index.js +23 -16
- package/api/stellar-solutions/contact/index.d.ts +8 -31
- package/api/stellar-solutions/contact/index.js +19 -25
- package/api/stellar-solutions/currency/index.d.ts +8 -31
- package/api/stellar-solutions/currency/index.js +30 -27
- package/api/stellar-solutions/customer/index.d.ts +9 -35
- package/api/stellar-solutions/customer/index.js +31 -30
- package/api/stellar-solutions/expense/index.d.ts +11 -32
- package/api/stellar-solutions/expense/index.js +41 -50
- package/api/stellar-solutions/expense-category/index.d.ts +13 -34
- package/api/stellar-solutions/expense-category/index.js +64 -52
- package/api/stellar-solutions/lead/index.d.ts +35 -19
- package/api/stellar-solutions/lead/index.js +117 -82
- package/api/stellar-solutions/menu-order/index.d.ts +19 -15
- package/api/stellar-solutions/menu-order/index.js +43 -33
- package/api/stellar-solutions/payment/index.d.ts +30 -47
- package/api/stellar-solutions/payment/index.js +64 -65
- package/api/stellar-solutions/payment-mode/index.d.ts +6 -13
- package/api/stellar-solutions/payment-mode/index.js +28 -46
- package/api/stellar-solutions/preference/index.d.ts +11 -9
- package/api/stellar-solutions/preference/index.js +38 -42
- package/api/stellar-solutions/product-category/index.d.ts +10 -13
- package/api/stellar-solutions/product-category/index.js +58 -49
- package/api/stellar-solutions/profile/index.d.ts +6 -5
- package/api/stellar-solutions/profile/index.js +17 -18
- package/api/stellar-solutions/quote-invoice/index.d.ts +41 -31
- package/api/stellar-solutions/quote-invoice/index.js +116 -124
- package/api/stellar-solutions/quote-invoice-report/index.d.ts +7 -14
- package/api/stellar-solutions/quote-invoice-report/index.js +27 -20
- package/api/stellar-solutions/tax/index.d.ts +11 -18
- package/api/stellar-solutions/tax/index.js +49 -40
- package/package.json +1 -1
|
@@ -54,10 +54,11 @@ exports.deleteExpenseCategory = exports.updateExpenseCategory = exports.unitExpe
|
|
|
54
54
|
* @returns {Promise<[number, Array<ExpenseCategoryBE>]>} Tuple containing total count and array of expense categories
|
|
55
55
|
*/
|
|
56
56
|
var listExpenseCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
57
|
-
var _c, count,
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
var include, orderBy, skip, where, _c, count, items;
|
|
58
|
+
var _d;
|
|
59
|
+
var _e = _b.currentPage, currentPage = _e === void 0 ? 1 : _e, _f = _b.includeExpenses, includeExpenses = _f === void 0 ? false : _f, _g = _b.orderByColumn, orderByColumn = _g === void 0 ? 'createdAt' : _g, _h = _b.orderByDirection, orderByDirection = _h === void 0 ? 'desc' : _h, _j = _b.pageLimit, pageLimit = _j === void 0 ? 10 : _j, prisma = _b.prisma;
|
|
60
|
+
return __generator(this, function (_k) {
|
|
61
|
+
switch (_k.label) {
|
|
61
62
|
case 0:
|
|
62
63
|
if (currentPage < 1) {
|
|
63
64
|
throw new Error('Current page must be greater than or equal to 1');
|
|
@@ -65,21 +66,29 @@ var listExpenseCategory = function (_a) { return __awaiter(void 0, [_a], void 0,
|
|
|
65
66
|
if (pageLimit < 1) {
|
|
66
67
|
throw new Error('Page limit must be greater than or equal to 1');
|
|
67
68
|
}
|
|
69
|
+
include = {
|
|
70
|
+
expenses: includeExpenses,
|
|
71
|
+
};
|
|
72
|
+
orderBy = (_d = {},
|
|
73
|
+
_d[orderByColumn] = orderByDirection,
|
|
74
|
+
_d);
|
|
75
|
+
skip = (currentPage - 1) * pageLimit;
|
|
76
|
+
where = {};
|
|
68
77
|
return [4 /*yield*/, prisma.$transaction([
|
|
69
78
|
prisma.expenseCategory.count({
|
|
70
|
-
where:
|
|
79
|
+
where: where,
|
|
71
80
|
}),
|
|
72
81
|
prisma.expenseCategory.findMany({
|
|
73
|
-
orderBy: orderBy,
|
|
74
82
|
include: include,
|
|
75
|
-
|
|
83
|
+
orderBy: orderBy,
|
|
84
|
+
skip: skip,
|
|
76
85
|
take: pageLimit,
|
|
77
|
-
|
|
86
|
+
where: where,
|
|
78
87
|
}),
|
|
79
88
|
])];
|
|
80
89
|
case 1:
|
|
81
|
-
_c =
|
|
82
|
-
return [2 /*return*/, [count,
|
|
90
|
+
_c = _k.sent(), count = _c[0], items = _c[1];
|
|
91
|
+
return [2 /*return*/, [count, items]];
|
|
83
92
|
}
|
|
84
93
|
});
|
|
85
94
|
}); };
|
|
@@ -90,23 +99,26 @@ exports.listExpenseCategory = listExpenseCategory;
|
|
|
90
99
|
* @returns {Promise<ExpenseCategoryBE | null>} Expense category with optional relations if found, null otherwise
|
|
91
100
|
*/
|
|
92
101
|
var unitExpenseCategoryById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
93
|
-
var expenseCategory;
|
|
94
|
-
var id = _b.id, _c = _b.
|
|
95
|
-
return __generator(this, function (
|
|
96
|
-
switch (
|
|
102
|
+
var include, where, expenseCategory;
|
|
103
|
+
var id = _b.id, _c = _b.includeExpenses, includeExpenses = _c === void 0 ? false : _c, prisma = _b.prisma;
|
|
104
|
+
return __generator(this, function (_d) {
|
|
105
|
+
switch (_d.label) {
|
|
97
106
|
case 0:
|
|
98
107
|
if (!id) {
|
|
99
108
|
throw new Error('Expense category ID is required');
|
|
100
109
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
110
|
+
include = {
|
|
111
|
+
expenses: includeExpenses,
|
|
112
|
+
};
|
|
113
|
+
where = {
|
|
114
|
+
id: id,
|
|
115
|
+
};
|
|
104
116
|
return [4 /*yield*/, prisma.expenseCategory.findUnique({
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
include: include,
|
|
118
|
+
where: where,
|
|
107
119
|
})];
|
|
108
120
|
case 1:
|
|
109
|
-
expenseCategory =
|
|
121
|
+
expenseCategory = _d.sent();
|
|
110
122
|
return [2 /*return*/, expenseCategory];
|
|
111
123
|
}
|
|
112
124
|
});
|
|
@@ -118,39 +130,36 @@ exports.unitExpenseCategoryById = unitExpenseCategoryById;
|
|
|
118
130
|
* @returns {Promise<ExpenseCategoryBE>} Created or updated expense category
|
|
119
131
|
*/
|
|
120
132
|
var updateExpenseCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
121
|
-
var expenseCategoryData,
|
|
122
|
-
var color = _b.color, description = _b.description, id = _b.id, _c = _b.
|
|
123
|
-
return __generator(this, function (
|
|
124
|
-
switch (
|
|
133
|
+
var expenseCategoryData, include, where, expenseCategory;
|
|
134
|
+
var color = _b.color, description = _b.description, id = _b.id, _c = _b.includeExpenses, includeExpenses = _c === void 0 ? true : _c, name = _b.name, prisma = _b.prisma;
|
|
135
|
+
return __generator(this, function (_d) {
|
|
136
|
+
switch (_d.label) {
|
|
125
137
|
case 0:
|
|
138
|
+
if (!id) {
|
|
139
|
+
throw new Error('Expense category ID is required');
|
|
140
|
+
}
|
|
126
141
|
if (!color || !name) {
|
|
127
142
|
throw new Error('Color and name are required');
|
|
128
143
|
}
|
|
129
|
-
if (id && (queryWhere === null || queryWhere === void 0 ? void 0 : queryWhere.id) && queryWhere.id !== id) {
|
|
130
|
-
throw new Error('ID mismatch between parameter and queryWhere');
|
|
131
|
-
}
|
|
132
144
|
expenseCategoryData = {
|
|
133
145
|
color: color,
|
|
134
146
|
description: description || null,
|
|
135
147
|
name: name,
|
|
136
148
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
149
|
+
include = {
|
|
150
|
+
expenses: includeExpenses,
|
|
151
|
+
};
|
|
152
|
+
where = {
|
|
153
|
+
id: id,
|
|
154
|
+
};
|
|
155
|
+
return [4 /*yield*/, prisma.expenseCategory.upsert({
|
|
156
|
+
create: __assign({ id: id }, expenseCategoryData),
|
|
157
|
+
include: include,
|
|
158
|
+
update: expenseCategoryData,
|
|
159
|
+
where: where,
|
|
142
160
|
})];
|
|
143
161
|
case 1:
|
|
144
|
-
|
|
145
|
-
return [2 /*return*/, expenseCategory_1];
|
|
146
|
-
case 2: return [4 /*yield*/, prisma.expenseCategory.upsert({
|
|
147
|
-
where: __assign({ id: expenseCategoryId }, queryWhere),
|
|
148
|
-
update: expenseCategoryData,
|
|
149
|
-
create: __assign({ id: expenseCategoryId }, expenseCategoryData),
|
|
150
|
-
include: include || undefined,
|
|
151
|
-
})];
|
|
152
|
-
case 3:
|
|
153
|
-
expenseCategory = _e.sent();
|
|
162
|
+
expenseCategory = _d.sent();
|
|
154
163
|
return [2 /*return*/, expenseCategory];
|
|
155
164
|
}
|
|
156
165
|
});
|
|
@@ -163,23 +172,26 @@ exports.updateExpenseCategory = updateExpenseCategory;
|
|
|
163
172
|
* @throws {Error} If expense category ID is not provided or expense category not found
|
|
164
173
|
*/
|
|
165
174
|
var deleteExpenseCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
166
|
-
var expenseCategory;
|
|
167
|
-
var id = _b.id, _c = _b.
|
|
168
|
-
return __generator(this, function (
|
|
169
|
-
switch (
|
|
175
|
+
var include, where, expenseCategory;
|
|
176
|
+
var id = _b.id, _c = _b.includeExpenses, includeExpenses = _c === void 0 ? true : _c, prisma = _b.prisma;
|
|
177
|
+
return __generator(this, function (_d) {
|
|
178
|
+
switch (_d.label) {
|
|
170
179
|
case 0:
|
|
171
180
|
if (!id) {
|
|
172
181
|
throw new Error('Expense category ID is required');
|
|
173
182
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
183
|
+
include = {
|
|
184
|
+
expenses: includeExpenses,
|
|
185
|
+
};
|
|
186
|
+
where = {
|
|
187
|
+
id: id,
|
|
188
|
+
};
|
|
177
189
|
return [4 /*yield*/, prisma.expenseCategory.delete({
|
|
178
|
-
|
|
179
|
-
|
|
190
|
+
include: include,
|
|
191
|
+
where: where,
|
|
180
192
|
})];
|
|
181
193
|
case 1:
|
|
182
|
-
expenseCategory =
|
|
194
|
+
expenseCategory = _d.sent();
|
|
183
195
|
return [2 /*return*/, expenseCategory];
|
|
184
196
|
}
|
|
185
197
|
});
|
|
@@ -1,34 +1,50 @@
|
|
|
1
1
|
import { LeadBE } from '../type';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type PrismaClient = any;
|
|
3
|
+
interface ListLeadArgs {
|
|
4
|
+
currentPage?: number;
|
|
5
|
+
orderByColumn?: string;
|
|
6
|
+
orderByDirection?: 'asc' | 'desc';
|
|
7
|
+
pageLimit?: number;
|
|
8
|
+
prisma: PrismaClient;
|
|
4
9
|
}
|
|
5
|
-
interface
|
|
10
|
+
interface UnitLeadByIdArgs {
|
|
6
11
|
id: string;
|
|
7
|
-
prisma:
|
|
12
|
+
prisma: PrismaClient;
|
|
8
13
|
}
|
|
9
|
-
interface
|
|
10
|
-
currentPage: number;
|
|
11
|
-
pageLimit: number;
|
|
12
|
-
prisma: any;
|
|
13
|
-
queryWhere: {
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
interface PostLeadArgs {
|
|
14
|
+
interface UpdateLeadArgs {
|
|
18
15
|
id: string;
|
|
19
16
|
notes: string;
|
|
20
|
-
prisma:
|
|
17
|
+
prisma: PrismaClient;
|
|
21
18
|
source: string;
|
|
22
19
|
status: string;
|
|
23
20
|
type: string;
|
|
24
21
|
}
|
|
25
22
|
interface DeleteLeadArgs {
|
|
26
|
-
prisma: any;
|
|
27
23
|
id: string;
|
|
24
|
+
prisma: PrismaClient;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves a paginated list of leads
|
|
28
|
+
* @param {ListLeadArgs} args - Object containing prisma client, pagination, filtering, and ordering options
|
|
29
|
+
* @returns {Promise<[number, Array<LeadBE>]>} Tuple containing total count and array of leads
|
|
30
|
+
*/
|
|
31
|
+
export declare const listLead: ({ currentPage, orderByColumn, orderByDirection, pageLimit, prisma, }: ListLeadArgs) => Promise<[number, Array<LeadBE>]>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves a single lead by its ID
|
|
34
|
+
* @param {UnitLeadByIdArgs} args - Object containing prisma client and lead ID
|
|
35
|
+
* @returns {Promise<LeadBE | null>} Lead or null if not found
|
|
36
|
+
*/
|
|
37
|
+
export declare const unitLeadById: ({ id, prisma, }: UnitLeadByIdArgs) => Promise<LeadBE | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Updates an existing lead using upsert
|
|
40
|
+
* @param {UpdateLeadArgs} args - Object containing prisma client and lead data
|
|
41
|
+
* @returns {Promise<LeadBE>} Updated lead
|
|
42
|
+
*/
|
|
43
|
+
export declare const updateLead: ({ id, notes, prisma, source, status, type, }: UpdateLeadArgs) => Promise<LeadBE>;
|
|
44
|
+
/**
|
|
45
|
+
* Deletes a lead by ID
|
|
46
|
+
* @param {DeleteLeadArgs} args - Object containing prisma client and lead ID
|
|
47
|
+
* @returns {Promise<LeadBE>} Deleted lead
|
|
48
|
+
*/
|
|
33
49
|
export declare const deleteLead: ({ id, prisma, }: DeleteLeadArgs) => Promise<LeadBE>;
|
|
34
50
|
export {};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -36,114 +47,138 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
47
|
}
|
|
37
48
|
};
|
|
38
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.deleteLead = exports.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
exports.deleteLead = exports.updateLead = exports.unitLeadById = exports.listLead = void 0;
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves a paginated list of leads
|
|
53
|
+
* @param {ListLeadArgs} args - Object containing prisma client, pagination, filtering, and ordering options
|
|
54
|
+
* @returns {Promise<[number, Array<LeadBE>]>} Tuple containing total count and array of leads
|
|
55
|
+
*/
|
|
56
|
+
var listLead = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
57
|
+
var include, orderBy, skip, where, _c, count, items;
|
|
58
|
+
var _d;
|
|
59
|
+
var _e = _b.currentPage, currentPage = _e === void 0 ? 1 : _e, _f = _b.orderByColumn, orderByColumn = _f === void 0 ? 'createdAt' : _f, _g = _b.orderByDirection, orderByDirection = _g === void 0 ? 'desc' : _g, _h = _b.pageLimit, pageLimit = _h === void 0 ? 10 : _h, prisma = _b.prisma;
|
|
60
|
+
return __generator(this, function (_j) {
|
|
61
|
+
switch (_j.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
if (currentPage < 1) {
|
|
64
|
+
throw new Error('Current page must be greater than 0');
|
|
65
|
+
}
|
|
66
|
+
if (pageLimit < 1) {
|
|
67
|
+
throw new Error('Page limit must be greater than 0');
|
|
68
|
+
}
|
|
69
|
+
include = {};
|
|
70
|
+
orderBy = (_d = {},
|
|
71
|
+
_d[orderByColumn] = orderByDirection,
|
|
72
|
+
_d);
|
|
73
|
+
skip = (currentPage - 1) * pageLimit;
|
|
74
|
+
where = {};
|
|
75
|
+
return [4 /*yield*/, prisma.$transaction([
|
|
76
|
+
prisma.lead.count({
|
|
77
|
+
where: where,
|
|
78
|
+
}),
|
|
79
|
+
prisma.lead.findMany({
|
|
80
|
+
include: include,
|
|
81
|
+
orderBy: orderBy,
|
|
82
|
+
skip: skip,
|
|
83
|
+
take: pageLimit,
|
|
84
|
+
where: where,
|
|
85
|
+
}),
|
|
86
|
+
])];
|
|
53
87
|
case 1:
|
|
54
|
-
|
|
55
|
-
return [2 /*return*/,
|
|
88
|
+
_c = _j.sent(), count = _c[0], items = _c[1];
|
|
89
|
+
return [2 /*return*/, [count, items]];
|
|
56
90
|
}
|
|
57
91
|
});
|
|
58
92
|
}); };
|
|
59
|
-
exports.
|
|
60
|
-
|
|
61
|
-
|
|
93
|
+
exports.listLead = listLead;
|
|
94
|
+
/**
|
|
95
|
+
* Retrieves a single lead by its ID
|
|
96
|
+
* @param {UnitLeadByIdArgs} args - Object containing prisma client and lead ID
|
|
97
|
+
* @returns {Promise<LeadBE | null>} Lead or null if not found
|
|
98
|
+
*/
|
|
99
|
+
var unitLeadById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
100
|
+
var include, lead;
|
|
62
101
|
var id = _b.id, prisma = _b.prisma;
|
|
63
102
|
return __generator(this, function (_c) {
|
|
64
103
|
switch (_c.label) {
|
|
65
|
-
case 0:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
104
|
+
case 0:
|
|
105
|
+
if (!id) {
|
|
106
|
+
throw new Error('Lead ID is required');
|
|
107
|
+
}
|
|
108
|
+
include = {};
|
|
109
|
+
return [4 /*yield*/, prisma.lead.findUnique({
|
|
110
|
+
include: include,
|
|
111
|
+
where: {
|
|
112
|
+
id: id,
|
|
113
|
+
},
|
|
114
|
+
})];
|
|
73
115
|
case 1:
|
|
74
116
|
lead = _c.sent();
|
|
75
117
|
return [2 /*return*/, lead];
|
|
76
118
|
}
|
|
77
119
|
});
|
|
78
120
|
}); };
|
|
79
|
-
exports.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
where: queryWhere,
|
|
88
|
-
}),
|
|
89
|
-
prisma.lead.findMany({
|
|
90
|
-
orderBy: {
|
|
91
|
-
createdAt: 'desc',
|
|
92
|
-
},
|
|
93
|
-
include: {
|
|
94
|
-
leadCategory: true,
|
|
95
|
-
},
|
|
96
|
-
where: queryWhere,
|
|
97
|
-
take: pageLimit,
|
|
98
|
-
skip: (currentPage - 1) * pageLimit,
|
|
99
|
-
}),
|
|
100
|
-
])];
|
|
101
|
-
case 1:
|
|
102
|
-
leads = _c.sent();
|
|
103
|
-
return [2 /*return*/, leads];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}); };
|
|
107
|
-
exports.postLeads = postLeads;
|
|
108
|
-
var postLead = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
109
|
-
var lead;
|
|
121
|
+
exports.unitLeadById = unitLeadById;
|
|
122
|
+
/**
|
|
123
|
+
* Updates an existing lead using upsert
|
|
124
|
+
* @param {UpdateLeadArgs} args - Object containing prisma client and lead data
|
|
125
|
+
* @returns {Promise<LeadBE>} Updated lead
|
|
126
|
+
*/
|
|
127
|
+
var updateLead = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
128
|
+
var include, leadData, lead;
|
|
110
129
|
var id = _b.id, notes = _b.notes, prisma = _b.prisma, source = _b.source, status = _b.status, type = _b.type;
|
|
111
130
|
return __generator(this, function (_c) {
|
|
112
131
|
switch (_c.label) {
|
|
113
|
-
case 0:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
case 0:
|
|
133
|
+
if (!id) {
|
|
134
|
+
throw new Error('Lead ID is required');
|
|
135
|
+
}
|
|
136
|
+
if (!notes || !source || !status || !type) {
|
|
137
|
+
throw new Error('Notes, source, status, and type are required');
|
|
138
|
+
}
|
|
139
|
+
include = {};
|
|
140
|
+
leadData = {
|
|
141
|
+
notes: notes,
|
|
142
|
+
source: source,
|
|
143
|
+
status: status,
|
|
144
|
+
type: type,
|
|
145
|
+
};
|
|
146
|
+
return [4 /*yield*/, prisma.lead.upsert({
|
|
147
|
+
create: __assign({ id: id }, leadData),
|
|
148
|
+
include: include,
|
|
149
|
+
update: leadData,
|
|
150
|
+
where: {
|
|
151
|
+
id: id,
|
|
152
|
+
},
|
|
153
|
+
})];
|
|
130
154
|
case 1:
|
|
131
155
|
lead = _c.sent();
|
|
132
156
|
return [2 /*return*/, lead];
|
|
133
157
|
}
|
|
134
158
|
});
|
|
135
159
|
}); };
|
|
136
|
-
exports.
|
|
160
|
+
exports.updateLead = updateLead;
|
|
161
|
+
/**
|
|
162
|
+
* Deletes a lead by ID
|
|
163
|
+
* @param {DeleteLeadArgs} args - Object containing prisma client and lead ID
|
|
164
|
+
* @returns {Promise<LeadBE>} Deleted lead
|
|
165
|
+
*/
|
|
137
166
|
var deleteLead = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
138
|
-
var lead;
|
|
167
|
+
var include, lead;
|
|
139
168
|
var id = _b.id, prisma = _b.prisma;
|
|
140
169
|
return __generator(this, function (_c) {
|
|
141
170
|
switch (_c.label) {
|
|
142
|
-
case 0:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
171
|
+
case 0:
|
|
172
|
+
if (!id) {
|
|
173
|
+
throw new Error('Lead ID is required');
|
|
174
|
+
}
|
|
175
|
+
include = {};
|
|
176
|
+
return [4 /*yield*/, prisma.lead.delete({
|
|
177
|
+
include: include,
|
|
178
|
+
where: {
|
|
179
|
+
id: id,
|
|
180
|
+
},
|
|
181
|
+
})];
|
|
147
182
|
case 1:
|
|
148
183
|
lead = _c.sent();
|
|
149
184
|
return [2 /*return*/, lead];
|
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { MenuOrderBE } from '../type';
|
|
2
2
|
type PrismaClient = any;
|
|
3
|
-
interface
|
|
3
|
+
interface ListMenuOrderArgs {
|
|
4
|
+
currentPage: number;
|
|
5
|
+
orderByColumn?: string;
|
|
6
|
+
orderByDirection?: 'asc' | 'desc';
|
|
7
|
+
pageLimit: number;
|
|
4
8
|
prisma: PrismaClient;
|
|
5
9
|
}
|
|
6
|
-
interface
|
|
10
|
+
interface UnitMenuOrderByIdArgs {
|
|
7
11
|
id: string;
|
|
8
12
|
prisma: PrismaClient;
|
|
9
13
|
}
|
|
10
|
-
interface
|
|
11
|
-
id
|
|
14
|
+
interface UpdateMenuOrderArgs {
|
|
15
|
+
id: string;
|
|
12
16
|
label: string;
|
|
13
17
|
order: number;
|
|
14
18
|
preferenceId: string;
|
|
15
19
|
prisma: PrismaClient;
|
|
16
20
|
}
|
|
17
21
|
interface DeleteMenuOrderArgs {
|
|
18
|
-
prisma: PrismaClient;
|
|
19
22
|
id: string;
|
|
23
|
+
prisma: PrismaClient;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
|
-
* Retrieves
|
|
23
|
-
* @param {
|
|
24
|
-
* @returns {Promise<Array<MenuOrderBE
|
|
26
|
+
* Retrieves paginated menu orders with count
|
|
27
|
+
* @param {ListMenuOrderArgs} args - Object containing prisma client and pagination parameters
|
|
28
|
+
* @returns {Promise<[number, Array<MenuOrderBE>]>} Tuple of total count and menu orders array
|
|
25
29
|
*/
|
|
26
|
-
export declare const
|
|
30
|
+
export declare const listMenuOrder: ({ currentPage, orderByColumn, orderByDirection, pageLimit, prisma, }: ListMenuOrderArgs) => Promise<[number, Array<MenuOrderBE>]>;
|
|
27
31
|
/**
|
|
28
32
|
* Retrieves a single menu order by ID
|
|
29
|
-
* @param {
|
|
33
|
+
* @param {UnitMenuOrderByIdArgs} args - Object containing prisma client and menu order id
|
|
30
34
|
* @returns {Promise<MenuOrderBE | null>} Menu order if found, null otherwise
|
|
31
35
|
*/
|
|
32
|
-
export declare const
|
|
36
|
+
export declare const unitMenuOrderById: ({ id, prisma, }: UnitMenuOrderByIdArgs) => Promise<MenuOrderBE | null>;
|
|
33
37
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {
|
|
36
|
-
* @returns {Promise<MenuOrderBE>}
|
|
38
|
+
* Updates an existing menu order
|
|
39
|
+
* @param {UpdateMenuOrderArgs} args - Object containing prisma client and menu order data
|
|
40
|
+
* @returns {Promise<MenuOrderBE>} Updated menu order
|
|
37
41
|
*/
|
|
38
|
-
export declare const
|
|
42
|
+
export declare const updateMenuOrder: ({ id, label, order, preferenceId, prisma, }: UpdateMenuOrderArgs) => Promise<MenuOrderBE>;
|
|
39
43
|
/**
|
|
40
44
|
* Deletes a menu order by ID
|
|
41
45
|
* @param {DeleteMenuOrderArgs} args - Object containing prisma client and menu order id
|