@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.
Files changed (110) hide show
  1. package/README.md +6 -3
  2. package/api/stellar-solutions/app-user/index.d.ts +63 -14
  3. package/api/stellar-solutions/app-user/index.js +106 -52
  4. package/api/stellar-solutions/bank/index.d.ts +65 -16
  5. package/api/stellar-solutions/bank/index.js +115 -65
  6. package/api/stellar-solutions/branch/index.d.ts +64 -15
  7. package/api/stellar-solutions/branch/index.js +119 -65
  8. package/api/stellar-solutions/company/index.d.ts +58 -24
  9. package/api/stellar-solutions/company/index.js +106 -78
  10. package/api/stellar-solutions/company-report/index.d.ts +12 -5
  11. package/api/stellar-solutions/company-report/index.js +12 -7
  12. package/api/stellar-solutions/contact/index.d.ts +54 -20
  13. package/api/stellar-solutions/contact/index.js +109 -88
  14. package/api/stellar-solutions/currency/index.d.ts +63 -14
  15. package/api/stellar-solutions/currency/index.js +113 -61
  16. package/api/stellar-solutions/customer/index.d.ts +70 -28
  17. package/api/stellar-solutions/customer/index.js +131 -101
  18. package/api/stellar-solutions/expense/index.d.ts +58 -22
  19. package/api/stellar-solutions/expense/index.js +128 -92
  20. package/api/stellar-solutions/expense-category/index.d.ts +58 -22
  21. package/api/stellar-solutions/expense-category/index.js +125 -86
  22. package/api/stellar-solutions/lead/index.js +0 -1
  23. package/api/stellar-solutions/menu-order/index.d.ts +29 -7
  24. package/api/stellar-solutions/menu-order/index.js +74 -27
  25. package/api/stellar-solutions/payment/index.d.ts +62 -27
  26. package/api/stellar-solutions/payment/index.js +144 -123
  27. package/api/stellar-solutions/payment-mode/index.d.ts +44 -12
  28. package/api/stellar-solutions/payment-mode/index.js +115 -49
  29. package/api/stellar-solutions/preference/index.d.ts +14 -3
  30. package/api/stellar-solutions/preference/index.js +44 -14
  31. package/api/stellar-solutions/product/index.d.ts +46 -31
  32. package/api/stellar-solutions/product/index.js +142 -113
  33. package/api/stellar-solutions/product-category/index.d.ts +44 -27
  34. package/api/stellar-solutions/product-category/index.js +123 -87
  35. package/api/stellar-solutions/profile/index.d.ts +48 -17
  36. package/api/stellar-solutions/profile/index.js +124 -65
  37. package/api/stellar-solutions/quote-invoice/index.d.ts +67 -8
  38. package/api/stellar-solutions/quote-invoice/index.js +123 -57
  39. package/api/stellar-solutions/quote-invoice-report/index.d.ts +12 -5
  40. package/api/stellar-solutions/quote-invoice-report/index.js +10 -5
  41. package/api/stellar-solutions/tax/index.d.ts +46 -14
  42. package/api/stellar-solutions/tax/index.js +135 -63
  43. package/api/stellar-solutions/type.d.ts +292 -177
  44. package/api/stellar-solutions/type.js +93 -1
  45. package/constants/countries-timezones.js +0 -1
  46. package/constants/currencies.js +0 -1
  47. package/general/basic-get.js +22 -21
  48. package/general/basic-post.js +19 -18
  49. package/general/calculate-pages.js +3 -1
  50. package/general/check-even-odd-length.js +3 -2
  51. package/general/delete-image-from-private-supabase.js +0 -1
  52. package/general/delete-image-from-public-supabase.js +0 -1
  53. package/general/dynamic-page-limit.js +3 -2
  54. package/general/enum-to-text.js +7 -4
  55. package/general/fetch-data.js +0 -1
  56. package/general/fetch-supabase-image.js +0 -1
  57. package/general/fetch-supabase-private-assets.js +15 -14
  58. package/general/format-date.js +8 -8
  59. package/general/format-number.js +3 -2
  60. package/general/format-time.js +3 -2
  61. package/general/full-year-range.js +2 -2
  62. package/general/generate-blog-schema.d.ts +3 -3
  63. package/general/generate-blog-schema.js +20 -13
  64. package/general/generate-breadcrumb-schema.d.ts +4 -4
  65. package/general/generate-breadcrumb-schema.js +9 -10
  66. package/general/generate-faq-schema.d.ts +5 -5
  67. package/general/generate-faq-schema.js +18 -11
  68. package/general/generate-grid.js +0 -1
  69. package/general/generate-organization-schema.d.ts +3 -3
  70. package/general/generate-organization-schema.js +25 -18
  71. package/general/get-available-page-limit.js +2 -2
  72. package/general/get-calendar-dates.js +14 -3
  73. package/general/get-full-name.d.ts +1 -1
  74. package/general/get-number-of-days-in-month.d.ts +1 -1
  75. package/general/get-pathname.js +4 -1
  76. package/general/is-odd.js +1 -1
  77. package/general/is-previous-button-disabled.js +3 -1
  78. package/general/parse-frontmatter.js +0 -1
  79. package/general/remove-data-image-prefix.js +3 -2
  80. package/general/repeat-times.js +0 -1
  81. package/general/resolve-current-date.js +1 -2
  82. package/general/resolve-grid.js +3 -2
  83. package/general/slugify.js +11 -9
  84. package/general/text-to-enum.js +6 -1
  85. package/general/text-to-sentence-case.js +3 -1
  86. package/general/time-out.js +5 -4
  87. package/general/truncate-text.js +3 -1
  88. package/general/upload-blob-to-private-supabase.js +2 -2
  89. package/general/upload-blob-to-public-supabase.js +2 -2
  90. package/general/upload-image-to-private-supabase.js +2 -2
  91. package/general/upload-image-to-public-supabase.js +2 -2
  92. package/general/validate-email.js +1 -1
  93. package/hooks/use-fetch.js +11 -12
  94. package/hooks/use-module-entity.js +5 -6
  95. package/hooks/use-sticky.js +0 -1
  96. package/hooks/with-seo.d.ts +1 -1
  97. package/hooks/with-seo.js +3 -4
  98. package/local-storage/get-storage-value.js +0 -1
  99. package/package.json +22 -13
  100. package/setupTests.js +1 -2
  101. package/storybook/generate-sitemap.js +0 -1
  102. package/storybook/preview.js +1 -4
  103. package/storybook/react-design-story-script.js +0 -2
  104. package/storybook/react-emoji-collection.js +8 -6
  105. package/storybook/react-emoji-story-script.js +0 -2
  106. package/storybook/react-icon-collection.js +4 -3
  107. package/storybook/react-icon-story-script.js +0 -2
  108. package/storybook/react-logo-collection.js +4 -3
  109. package/storybook/react-logo-story-script.js +0 -2
  110. package/storybook/responsive-component.js +14 -7
@@ -1,42 +1,78 @@
1
1
  import { ExpenseBE } from '../type';
2
- interface GetExpensesArgs {
3
- prisma: any;
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: any;
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 PostExpenseArgs {
27
+ interface UpdateExpenseArgs {
24
28
  currency: string;
25
29
  description: string;
26
30
  expenseCategoryId: string;
27
- id: string;
31
+ id?: string;
32
+ include?: {
33
+ [key: string]: any;
34
+ };
28
35
  name: string;
29
- prisma: any;
30
- ref: string;
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
- export declare const getExpenses: ({ prisma, }: GetExpensesArgs) => Promise<Array<ExpenseBE>>;
38
- export declare const getExpenseById: ({ id, prisma, }: GetExpenseByIdArgs) => Promise<ExpenseBE>;
39
- export declare const postExpenses: ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }: PostExpensesArgs) => Promise<Array<ExpenseBE>>;
40
- export declare const postExpense: ({ currency, description, expenseCategoryId, id, name, prisma, ref, total, }: PostExpenseArgs) => Promise<ExpenseBE>;
41
- export declare const deleteExpense: ({ prisma, id, }: DeleteExpenseArgs) => Promise<ExpenseBE>;
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
- /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals */
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.postExpense = exports.postExpenses = exports.getExpenseById = exports.getExpenses = void 0;
41
- var getExpenses = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
- var expenses;
43
- var prisma = _b.prisma;
44
- return __generator(this, function (_c) {
45
- switch (_c.label) {
46
- case 0: return [4 /*yield*/, prisma.expense.findMany({
47
- orderBy: {
48
- createdAt: 'desc',
49
- },
50
- include: {
51
- expenseCategory: true,
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
- expenses = _c.sent();
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.getExpenses = getExpenses;
61
- var getExpenseById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
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 (_c) {
65
- switch (_c.label) {
66
- case 0: return [4 /*yield*/, prisma.expense.findUnique({
67
- where: {
68
- id: id,
69
- },
70
- include: {
71
- expenseCategory: true,
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 = _c.sent();
109
+ expense = _e.sent();
76
110
  return [2 /*return*/, expense];
77
111
  }
78
112
  });
79
113
  }); };
80
- exports.getExpenseById = getExpenseById;
81
- var postExpenses = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
82
- var expenses;
83
- var currentPage = _b.currentPage, include = _b.include, orderBy = _b.orderBy, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
84
- return __generator(this, function (_c) {
85
- switch (_c.label) {
86
- case 0: return [4 /*yield*/, prisma.$transaction([
87
- prisma.expense.count({
88
- where: queryWhere,
89
- }),
90
- prisma.expense.findMany({
91
- orderBy: orderBy,
92
- include: include,
93
- where: queryWhere,
94
- take: pageLimit,
95
- skip: (currentPage - 1) * pageLimit,
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
- expenses = _c.sent();
100
- return [2 /*return*/, expenses];
101
- }
102
- });
103
- }); };
104
- exports.postExpenses = postExpenses;
105
- var postExpense = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
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 1:
132
- expense = _c.sent();
155
+ case 3:
156
+ expense = _e.sent();
133
157
  return [2 /*return*/, expense];
134
158
  }
135
159
  });
136
160
  }); };
137
- exports.postExpense = postExpense;
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, id = _b.id;
141
- return __generator(this, function (_c) {
142
- switch (_c.label) {
143
- case 0: return [4 /*yield*/, prisma.expense.delete({
144
- where: {
145
- id: id,
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 = _c.sent();
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
- interface GetExpenseCategoriesArgs {
3
- prisma: any;
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: any;
19
- queryWhere: {
12
+ prisma: PrismaClient;
13
+ queryWhere?: {
20
14
  [key: string]: any;
21
15
  };
22
16
  }
23
- interface PostExpenseCategoryArgs {
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: any;
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
- export declare const getExpenseCategories: ({ prisma, }: GetExpenseCategoriesArgs) => Promise<Array<ExpenseCategoryBE>>;
35
- export declare const getExpenseCategoryById: ({ id, prisma, }: GetExpenseCategoryByIdArgs) => Promise<ExpenseCategoryBE>;
36
- export declare const postExpenseCategories: ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }: PostExpenseCategoriesArgs) => Promise<Array<ExpenseCategoryBE>>;
37
- export declare const postExpenseCategory: ({ color, description, id, name, prisma, }: PostExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
38
- export declare const deleteExpenseCategory: ({ id, prisma, }: DeleteExpenseCategoryArgs) => Promise<ExpenseCategoryBE>;
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 {};