@react-pakistan/util-functions 1.24.64 → 1.24.66
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/README.md +6 -3
- package/api/stellar-solutions/app-user/index.d.ts +63 -14
- package/api/stellar-solutions/app-user/index.js +106 -52
- package/api/stellar-solutions/bank/index.d.ts +65 -16
- package/api/stellar-solutions/bank/index.js +115 -65
- package/api/stellar-solutions/branch/index.d.ts +64 -15
- package/api/stellar-solutions/branch/index.js +119 -65
- package/api/stellar-solutions/company/index.d.ts +58 -24
- package/api/stellar-solutions/company/index.js +106 -78
- package/api/stellar-solutions/company-report/index.d.ts +12 -5
- package/api/stellar-solutions/company-report/index.js +12 -7
- package/api/stellar-solutions/contact/index.d.ts +54 -20
- package/api/stellar-solutions/contact/index.js +109 -88
- package/api/stellar-solutions/currency/index.d.ts +63 -14
- package/api/stellar-solutions/currency/index.js +113 -61
- package/api/stellar-solutions/customer/index.d.ts +70 -28
- package/api/stellar-solutions/customer/index.js +131 -101
- package/api/stellar-solutions/expense/index.d.ts +58 -22
- package/api/stellar-solutions/expense/index.js +128 -92
- package/api/stellar-solutions/expense-category/index.d.ts +58 -22
- package/api/stellar-solutions/expense-category/index.js +125 -86
- package/api/stellar-solutions/lead/index.js +0 -1
- package/api/stellar-solutions/menu-order/index.d.ts +29 -7
- package/api/stellar-solutions/menu-order/index.js +74 -27
- package/api/stellar-solutions/payment/index.d.ts +62 -27
- package/api/stellar-solutions/payment/index.js +144 -123
- package/api/stellar-solutions/payment-mode/index.d.ts +44 -12
- package/api/stellar-solutions/payment-mode/index.js +115 -49
- package/api/stellar-solutions/preference/index.d.ts +14 -3
- package/api/stellar-solutions/preference/index.js +44 -14
- package/api/stellar-solutions/product/index.d.ts +46 -31
- package/api/stellar-solutions/product/index.js +142 -113
- package/api/stellar-solutions/product-category/index.d.ts +44 -27
- package/api/stellar-solutions/product-category/index.js +123 -87
- package/api/stellar-solutions/profile/index.d.ts +48 -17
- package/api/stellar-solutions/profile/index.js +124 -65
- package/api/stellar-solutions/quote-invoice/index.d.ts +67 -8
- package/api/stellar-solutions/quote-invoice/index.js +123 -57
- package/api/stellar-solutions/quote-invoice-report/index.d.ts +12 -5
- package/api/stellar-solutions/quote-invoice-report/index.js +10 -5
- package/api/stellar-solutions/tax/index.d.ts +46 -14
- package/api/stellar-solutions/tax/index.js +135 -63
- package/api/stellar-solutions/type.d.ts +292 -177
- package/api/stellar-solutions/type.js +93 -1
- package/constants/countries-timezones.js +0 -1
- package/constants/currencies.js +0 -1
- package/general/basic-get.js +22 -21
- package/general/basic-post.js +19 -18
- package/general/calculate-pages.js +3 -1
- package/general/check-even-odd-length.js +3 -2
- package/general/delete-image-from-private-supabase.js +0 -1
- package/general/delete-image-from-public-supabase.js +0 -1
- package/general/dynamic-page-limit.js +3 -2
- package/general/enum-to-text.js +7 -4
- package/general/fetch-data.js +0 -1
- package/general/fetch-supabase-image.js +0 -1
- package/general/fetch-supabase-private-assets.js +15 -14
- package/general/format-date.js +8 -8
- package/general/format-number.js +3 -2
- package/general/format-time.js +3 -2
- package/general/full-year-range.js +2 -2
- package/general/generate-blog-schema.d.ts +3 -3
- package/general/generate-blog-schema.js +20 -13
- package/general/generate-breadcrumb-schema.d.ts +4 -4
- package/general/generate-breadcrumb-schema.js +9 -10
- package/general/generate-faq-schema.d.ts +5 -5
- package/general/generate-faq-schema.js +18 -11
- package/general/generate-grid.js +0 -1
- package/general/generate-organization-schema.d.ts +3 -3
- package/general/generate-organization-schema.js +25 -18
- package/general/get-available-page-limit.js +2 -2
- package/general/get-calendar-dates.js +14 -3
- package/general/get-full-name.d.ts +1 -1
- package/general/get-number-of-days-in-month.d.ts +1 -1
- package/general/get-pathname.js +4 -1
- package/general/is-odd.js +1 -1
- package/general/is-previous-button-disabled.js +3 -1
- package/general/parse-frontmatter.js +0 -1
- package/general/remove-data-image-prefix.js +3 -2
- package/general/repeat-times.js +0 -1
- package/general/resolve-current-date.js +1 -2
- package/general/resolve-grid.js +3 -2
- package/general/slugify.js +11 -9
- package/general/text-to-enum.js +6 -1
- package/general/text-to-sentence-case.js +3 -1
- package/general/time-out.js +5 -4
- package/general/truncate-text.js +3 -1
- package/general/upload-blob-to-private-supabase.js +2 -2
- package/general/upload-blob-to-public-supabase.js +2 -2
- package/general/upload-image-to-private-supabase.js +2 -2
- package/general/upload-image-to-public-supabase.js +2 -2
- package/general/validate-email.js +1 -1
- package/hooks/use-fetch.js +11 -12
- package/hooks/use-module-entity.js +5 -6
- package/hooks/use-sticky.js +0 -1
- package/hooks/with-seo.d.ts +1 -1
- package/hooks/with-seo.js +3 -4
- package/local-storage/get-storage-value.js +0 -1
- package/package.json +22 -13
- package/setupTests.js +1 -2
- package/storybook/generate-sitemap.js +0 -1
- package/storybook/preview.js +1 -4
- package/storybook/react-design-story-script.js +0 -2
- package/storybook/react-emoji-collection.js +8 -6
- package/storybook/react-emoji-story-script.js +0 -2
- package/storybook/react-icon-collection.js +4 -3
- package/storybook/react-icon-story-script.js +0 -2
- package/storybook/react-logo-collection.js +4 -3
- package/storybook/react-logo-story-script.js +0 -2
- package/storybook/responsive-component.js +14 -7
|
@@ -1,42 +1,78 @@
|
|
|
1
1
|
import { ExpenseBE } from '../type';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
interface GetExpenseByIdArgs {
|
|
6
|
-
id: string;
|
|
7
|
-
prisma: any;
|
|
8
|
-
}
|
|
9
|
-
interface PostExpensesArgs {
|
|
2
|
+
type PrismaClient = any;
|
|
3
|
+
interface ListExpenseArgs {
|
|
10
4
|
currentPage: number;
|
|
11
|
-
include
|
|
5
|
+
include?: {
|
|
12
6
|
[key: string]: any;
|
|
13
7
|
};
|
|
14
|
-
orderBy
|
|
8
|
+
orderBy?: {
|
|
15
9
|
[key: string]: any;
|
|
16
10
|
};
|
|
17
11
|
pageLimit: number;
|
|
18
|
-
prisma:
|
|
19
|
-
queryWhere
|
|
12
|
+
prisma: PrismaClient;
|
|
13
|
+
queryWhere?: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface UnitExpenseByIdArgs {
|
|
18
|
+
id: string;
|
|
19
|
+
include?: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
prisma: PrismaClient;
|
|
23
|
+
queryWhere?: {
|
|
20
24
|
[key: string]: any;
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
|
-
interface
|
|
27
|
+
interface UpdateExpenseArgs {
|
|
24
28
|
currency: string;
|
|
25
29
|
description: string;
|
|
26
30
|
expenseCategoryId: string;
|
|
27
|
-
id
|
|
31
|
+
id?: string;
|
|
32
|
+
include?: {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
28
35
|
name: string;
|
|
29
|
-
prisma:
|
|
30
|
-
|
|
36
|
+
prisma: PrismaClient;
|
|
37
|
+
queryWhere?: {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
};
|
|
40
|
+
ref?: string;
|
|
31
41
|
total: string;
|
|
32
42
|
}
|
|
33
43
|
interface DeleteExpenseArgs {
|
|
34
|
-
prisma: any;
|
|
35
44
|
id: string;
|
|
45
|
+
include?: {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
prisma: PrismaClient;
|
|
49
|
+
queryWhere?: {
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
};
|
|
36
52
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves expenses with pagination and filtering
|
|
55
|
+
* @param {ListExpenseArgs} args - Object containing prisma client, pagination, and query options
|
|
56
|
+
* @returns {Promise<[number, Array<ExpenseBE>]>} Tuple containing total count and array of expenses
|
|
57
|
+
*/
|
|
58
|
+
export declare const listExpense: ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }: ListExpenseArgs) => Promise<[number, Array<ExpenseBE>]>;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieves a single expense by ID
|
|
61
|
+
* @param {UnitExpenseByIdArgs} args - Object containing prisma client, expense id, and optional query parameters
|
|
62
|
+
* @returns {Promise<ExpenseBE | null>} Expense with optional relations if found, null otherwise
|
|
63
|
+
*/
|
|
64
|
+
export declare const unitExpenseById: ({ id, include, prisma, queryWhere, }: UnitExpenseByIdArgs) => Promise<ExpenseBE | null>;
|
|
65
|
+
/**
|
|
66
|
+
* Creates or updates an expense using upsert
|
|
67
|
+
* @param {UpdateExpenseArgs} args - Object containing prisma client and expense data
|
|
68
|
+
* @returns {Promise<ExpenseBE>} Created or updated expense
|
|
69
|
+
*/
|
|
70
|
+
export declare const updateExpense: ({ currency, description, expenseCategoryId, id, include, name, prisma, queryWhere, ref, total, }: UpdateExpenseArgs) => Promise<ExpenseBE>;
|
|
71
|
+
/**
|
|
72
|
+
* Deletes an expense by ID
|
|
73
|
+
* @param {DeleteExpenseArgs} args - Object containing prisma client, expense id, and optional query parameters
|
|
74
|
+
* @returns {Promise<ExpenseBE>} Deleted expense
|
|
75
|
+
* @throws {Error} If expense ID is not provided or expense not found
|
|
76
|
+
*/
|
|
77
|
+
export declare const deleteExpense: ({ id, include, prisma, queryWhere, }: DeleteExpenseArgs) => Promise<ExpenseBE>;
|
|
42
78
|
export {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
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
|
+
};
|
|
3
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -37,116 +47,142 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
47
|
}
|
|
38
48
|
};
|
|
39
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.deleteExpense = exports.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
exports.deleteExpense = exports.updateExpense = exports.unitExpenseById = exports.listExpense = void 0;
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves expenses with pagination and filtering
|
|
53
|
+
* @param {ListExpenseArgs} args - Object containing prisma client, pagination, and query options
|
|
54
|
+
* @returns {Promise<[number, Array<ExpenseBE>]>} Tuple containing total count and array of expenses
|
|
55
|
+
*/
|
|
56
|
+
var listExpense = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
57
|
+
var _c, count, expenses;
|
|
58
|
+
var currentPage = _b.currentPage, _d = _b.include, include = _d === void 0 ? { expenseCategory: true } : _d, _e = _b.orderBy, orderBy = _e === void 0 ? { createdAt: 'desc' } : _e, pageLimit = _b.pageLimit, prisma = _b.prisma, _f = _b.queryWhere, queryWhere = _f === void 0 ? {} : _f;
|
|
59
|
+
return __generator(this, function (_g) {
|
|
60
|
+
switch (_g.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
if (currentPage < 1) {
|
|
63
|
+
throw new Error('Current page must be greater than or equal to 1');
|
|
64
|
+
}
|
|
65
|
+
if (pageLimit < 1) {
|
|
66
|
+
throw new Error('Page limit must be greater than or equal to 1');
|
|
67
|
+
}
|
|
68
|
+
return [4 /*yield*/, prisma.$transaction([
|
|
69
|
+
prisma.expense.count({
|
|
70
|
+
where: queryWhere,
|
|
71
|
+
}),
|
|
72
|
+
prisma.expense.findMany({
|
|
73
|
+
orderBy: orderBy,
|
|
74
|
+
include: include,
|
|
75
|
+
where: queryWhere,
|
|
76
|
+
take: pageLimit,
|
|
77
|
+
skip: (currentPage - 1) * pageLimit,
|
|
78
|
+
}),
|
|
79
|
+
])];
|
|
54
80
|
case 1:
|
|
55
|
-
|
|
56
|
-
return [2 /*return*/, expenses];
|
|
81
|
+
_c = _g.sent(), count = _c[0], expenses = _c[1];
|
|
82
|
+
return [2 /*return*/, [count, expenses]];
|
|
57
83
|
}
|
|
58
84
|
});
|
|
59
85
|
}); };
|
|
60
|
-
exports.
|
|
61
|
-
|
|
86
|
+
exports.listExpense = listExpense;
|
|
87
|
+
/**
|
|
88
|
+
* Retrieves a single expense by ID
|
|
89
|
+
* @param {UnitExpenseByIdArgs} args - Object containing prisma client, expense id, and optional query parameters
|
|
90
|
+
* @returns {Promise<ExpenseBE | null>} Expense with optional relations if found, null otherwise
|
|
91
|
+
*/
|
|
92
|
+
var unitExpenseById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
62
93
|
var expense;
|
|
63
|
-
var id = _b.id, prisma = _b.prisma;
|
|
64
|
-
return __generator(this, function (
|
|
65
|
-
switch (
|
|
66
|
-
case 0:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
var id = _b.id, _c = _b.include, include = _c === void 0 ? { expenseCategory: true } : _c, prisma = _b.prisma, _d = _b.queryWhere, queryWhere = _d === void 0 ? {} : _d;
|
|
95
|
+
return __generator(this, function (_e) {
|
|
96
|
+
switch (_e.label) {
|
|
97
|
+
case 0:
|
|
98
|
+
if (!id) {
|
|
99
|
+
throw new Error('Expense ID is required');
|
|
100
|
+
}
|
|
101
|
+
if ((queryWhere === null || queryWhere === void 0 ? void 0 : queryWhere.id) && queryWhere.id !== id) {
|
|
102
|
+
throw new Error('ID mismatch between parameter and queryWhere');
|
|
103
|
+
}
|
|
104
|
+
return [4 /*yield*/, prisma.expense.findUnique({
|
|
105
|
+
where: __assign({ id: id }, queryWhere),
|
|
106
|
+
include: include || undefined,
|
|
107
|
+
})];
|
|
74
108
|
case 1:
|
|
75
|
-
expense =
|
|
109
|
+
expense = _e.sent();
|
|
76
110
|
return [2 /*return*/, expense];
|
|
77
111
|
}
|
|
78
112
|
});
|
|
79
113
|
}); };
|
|
80
|
-
exports.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
114
|
+
exports.unitExpenseById = unitExpenseById;
|
|
115
|
+
/**
|
|
116
|
+
* Creates or updates an expense using upsert
|
|
117
|
+
* @param {UpdateExpenseArgs} args - Object containing prisma client and expense data
|
|
118
|
+
* @returns {Promise<ExpenseBE>} Created or updated expense
|
|
119
|
+
*/
|
|
120
|
+
var updateExpense = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
121
|
+
var expenseData, expenseId, expense_1, expense;
|
|
122
|
+
var currency = _b.currency, description = _b.description, expenseCategoryId = _b.expenseCategoryId, id = _b.id, _c = _b.include, include = _c === void 0 ? { expenseCategory: true } : _c, name = _b.name, prisma = _b.prisma, _d = _b.queryWhere, queryWhere = _d === void 0 ? {} : _d, ref = _b.ref, total = _b.total;
|
|
123
|
+
return __generator(this, function (_e) {
|
|
124
|
+
switch (_e.label) {
|
|
125
|
+
case 0:
|
|
126
|
+
if (!currency || !description || !expenseCategoryId || !name || !total) {
|
|
127
|
+
throw new Error('Currency, description, expense category ID, name, and total are required');
|
|
128
|
+
}
|
|
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
|
+
expenseData = {
|
|
133
|
+
currency: currency,
|
|
134
|
+
description: description,
|
|
135
|
+
expenseCategoryId: expenseCategoryId,
|
|
136
|
+
name: name,
|
|
137
|
+
ref: ref || null,
|
|
138
|
+
total: total,
|
|
139
|
+
};
|
|
140
|
+
expenseId = id || (queryWhere === null || queryWhere === void 0 ? void 0 : queryWhere.id);
|
|
141
|
+
if (!!expenseId) return [3 /*break*/, 2];
|
|
142
|
+
return [4 /*yield*/, prisma.expense.create({
|
|
143
|
+
data: expenseData,
|
|
144
|
+
include: include || undefined,
|
|
145
|
+
})];
|
|
98
146
|
case 1:
|
|
99
|
-
|
|
100
|
-
return [2 /*return*/,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var expense;
|
|
107
|
-
var currency = _b.currency, description = _b.description, expenseCategoryId = _b.expenseCategoryId, id = _b.id, name = _b.name, prisma = _b.prisma, ref = _b.ref, total = _b.total;
|
|
108
|
-
return __generator(this, function (_c) {
|
|
109
|
-
switch (_c.label) {
|
|
110
|
-
case 0: return [4 /*yield*/, prisma.expense.upsert({
|
|
111
|
-
where: {
|
|
112
|
-
id: id,
|
|
113
|
-
},
|
|
114
|
-
update: {
|
|
115
|
-
currency: currency,
|
|
116
|
-
description: description,
|
|
117
|
-
expenseCategoryId: expenseCategoryId,
|
|
118
|
-
name: name,
|
|
119
|
-
ref: ref,
|
|
120
|
-
total: total,
|
|
121
|
-
},
|
|
122
|
-
create: {
|
|
123
|
-
currency: currency,
|
|
124
|
-
description: description,
|
|
125
|
-
expenseCategoryId: expenseCategoryId,
|
|
126
|
-
name: name,
|
|
127
|
-
ref: ref,
|
|
128
|
-
total: total,
|
|
129
|
-
},
|
|
147
|
+
expense_1 = _e.sent();
|
|
148
|
+
return [2 /*return*/, expense_1];
|
|
149
|
+
case 2: return [4 /*yield*/, prisma.expense.upsert({
|
|
150
|
+
where: __assign({ id: expenseId }, queryWhere),
|
|
151
|
+
update: expenseData,
|
|
152
|
+
create: __assign({ id: expenseId }, expenseData),
|
|
153
|
+
include: include || undefined,
|
|
130
154
|
})];
|
|
131
|
-
case
|
|
132
|
-
expense =
|
|
155
|
+
case 3:
|
|
156
|
+
expense = _e.sent();
|
|
133
157
|
return [2 /*return*/, expense];
|
|
134
158
|
}
|
|
135
159
|
});
|
|
136
160
|
}); };
|
|
137
|
-
exports.
|
|
161
|
+
exports.updateExpense = updateExpense;
|
|
162
|
+
/**
|
|
163
|
+
* Deletes an expense by ID
|
|
164
|
+
* @param {DeleteExpenseArgs} args - Object containing prisma client, expense id, and optional query parameters
|
|
165
|
+
* @returns {Promise<ExpenseBE>} Deleted expense
|
|
166
|
+
* @throws {Error} If expense ID is not provided or expense not found
|
|
167
|
+
*/
|
|
138
168
|
var deleteExpense = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
139
169
|
var expense;
|
|
140
|
-
var prisma = _b.prisma,
|
|
141
|
-
return __generator(this, function (
|
|
142
|
-
switch (
|
|
143
|
-
case 0:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
170
|
+
var id = _b.id, _c = _b.include, include = _c === void 0 ? { expenseCategory: true } : _c, prisma = _b.prisma, _d = _b.queryWhere, queryWhere = _d === void 0 ? {} : _d;
|
|
171
|
+
return __generator(this, function (_e) {
|
|
172
|
+
switch (_e.label) {
|
|
173
|
+
case 0:
|
|
174
|
+
if (!id) {
|
|
175
|
+
throw new Error('Expense ID is required');
|
|
176
|
+
}
|
|
177
|
+
if ((queryWhere === null || queryWhere === void 0 ? void 0 : queryWhere.id) && queryWhere.id !== id) {
|
|
178
|
+
throw new Error('ID mismatch between parameter and queryWhere');
|
|
179
|
+
}
|
|
180
|
+
return [4 /*yield*/, prisma.expense.delete({
|
|
181
|
+
where: __assign({ id: id }, queryWhere),
|
|
182
|
+
include: include || undefined,
|
|
183
|
+
})];
|
|
148
184
|
case 1:
|
|
149
|
-
expense =
|
|
185
|
+
expense = _e.sent();
|
|
150
186
|
return [2 /*return*/, expense];
|
|
151
187
|
}
|
|
152
188
|
});
|
|
@@ -1,39 +1,75 @@
|
|
|
1
1
|
import { ExpenseCategoryBE } from '../type';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
interface GetExpenseCategoryByIdArgs {
|
|
6
|
-
id: string;
|
|
7
|
-
prisma: any;
|
|
8
|
-
}
|
|
9
|
-
interface PostExpenseCategoriesArgs {
|
|
2
|
+
type PrismaClient = any;
|
|
3
|
+
interface ListExpenseCategoryArgs {
|
|
10
4
|
currentPage: number;
|
|
11
|
-
include
|
|
5
|
+
include?: {
|
|
12
6
|
[key: string]: any;
|
|
13
7
|
};
|
|
14
|
-
orderBy
|
|
8
|
+
orderBy?: {
|
|
15
9
|
[key: string]: any;
|
|
16
10
|
};
|
|
17
11
|
pageLimit: number;
|
|
18
|
-
prisma:
|
|
19
|
-
queryWhere
|
|
12
|
+
prisma: PrismaClient;
|
|
13
|
+
queryWhere?: {
|
|
20
14
|
[key: string]: any;
|
|
21
15
|
};
|
|
22
16
|
}
|
|
23
|
-
interface
|
|
24
|
-
color: string;
|
|
25
|
-
description: string;
|
|
17
|
+
interface UnitExpenseCategoryByIdArgs {
|
|
26
18
|
id: string;
|
|
19
|
+
include?: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
prisma: PrismaClient;
|
|
23
|
+
queryWhere?: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface UpdateExpenseCategoryArgs {
|
|
28
|
+
color: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
id?: string;
|
|
31
|
+
include?: {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
27
34
|
name: string;
|
|
28
|
-
prisma:
|
|
35
|
+
prisma: PrismaClient;
|
|
36
|
+
queryWhere?: {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
29
39
|
}
|
|
30
40
|
interface DeleteExpenseCategoryArgs {
|
|
31
|
-
prisma: any;
|
|
32
41
|
id: string;
|
|
42
|
+
include?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
prisma: PrismaClient;
|
|
46
|
+
queryWhere?: {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
};
|
|
33
49
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves expense categories with pagination and filtering
|
|
52
|
+
* @param {ListExpenseCategoryArgs} args - Object containing prisma client, pagination, and query options
|
|
53
|
+
* @returns {Promise<[number, Array<ExpenseCategoryBE>]>} Tuple containing total count and array of expense categories
|
|
54
|
+
*/
|
|
55
|
+
export declare const listExpenseCategory: ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }: ListExpenseCategoryArgs) => Promise<[number, Array<ExpenseCategoryBE>]>;
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves a single expense category by ID
|
|
58
|
+
* @param {UnitExpenseCategoryByIdArgs} args - Object containing prisma client, expense category id, and optional query parameters
|
|
59
|
+
* @returns {Promise<ExpenseCategoryBE | null>} Expense category with optional relations if found, null otherwise
|
|
60
|
+
*/
|
|
61
|
+
export declare const unitExpenseCategoryById: ({ id, include, prisma, queryWhere, }: UnitExpenseCategoryByIdArgs) => Promise<ExpenseCategoryBE | null>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates or updates an expense category using upsert
|
|
64
|
+
* @param {UpdateExpenseCategoryArgs} args - Object containing prisma client and expense category data
|
|
65
|
+
* @returns {Promise<ExpenseCategoryBE>} Created or updated expense category
|
|
66
|
+
*/
|
|
67
|
+
export declare const updateExpenseCategory: ({ color, description, id, include, name, prisma, queryWhere, }: UpdateExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
|
|
68
|
+
/**
|
|
69
|
+
* Deletes an expense category by ID
|
|
70
|
+
* @param {DeleteExpenseCategoryArgs} args - Object containing prisma client, expense category id, and optional query parameters
|
|
71
|
+
* @returns {Promise<ExpenseCategoryBE>} Deleted expense category
|
|
72
|
+
* @throws {Error} If expense category ID is not provided or expense category not found
|
|
73
|
+
*/
|
|
74
|
+
export declare const deleteExpenseCategory: ({ id, include, prisma, queryWhere, }: DeleteExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
|
|
39
75
|
export {};
|