@react-pakistan/util-functions 1.24.65 → 1.24.67

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 +48 -31
  32. package/api/stellar-solutions/product/index.js +153 -115
  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 +178 -112
  44. package/api/stellar-solutions/type.js +60 -2
  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,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals, @typescript-eslint/array-type */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -38,11 +37,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
37
  };
39
38
  Object.defineProperty(exports, "__esModule", { value: true });
40
39
  exports.postCompaniesReport = void 0;
40
+ /**
41
+ * Retrieves companies report data with count and full list
42
+ * This is typically used for generating reports without pagination
43
+ * @param {PostCompaniesReportArgs} args - Object containing prisma client and query options
44
+ * @returns {Promise<[number, Array<CompanyBE>]>} Tuple containing total count and array of all matching companies
45
+ */
41
46
  var postCompaniesReport = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
- var companies;
43
- var prisma = _b.prisma, queryWhere = _b.queryWhere, orderBy = _b.orderBy, include = _b.include;
44
- return __generator(this, function (_c) {
45
- switch (_c.label) {
47
+ var _c, count, companies;
48
+ var prisma = _b.prisma, _d = _b.queryWhere, queryWhere = _d === void 0 ? {} : _d, _e = _b.orderBy, orderBy = _e === void 0 ? { createdAt: 'desc' } : _e, _f = _b.include, include = _f === void 0 ? {} : _f;
49
+ return __generator(this, function (_g) {
50
+ switch (_g.label) {
46
51
  case 0: return [4 /*yield*/, prisma.$transaction([
47
52
  prisma.company.count({
48
53
  where: queryWhere,
@@ -54,8 +59,8 @@ var postCompaniesReport = function (_a) { return __awaiter(void 0, [_a], void 0,
54
59
  }),
55
60
  ])];
56
61
  case 1:
57
- companies = _c.sent();
58
- return [2 /*return*/, companies];
62
+ _c = _g.sent(), count = _c[0], companies = _c[1];
63
+ return [2 /*return*/, [count, companies]];
59
64
  }
60
65
  });
61
66
  }); };
@@ -1,42 +1,76 @@
1
1
  import { ContactBE } from '../type';
2
- interface GetContactsArgs {
3
- prisma: any;
4
- }
5
- interface GetContactByIdArgs {
6
- id: string;
7
- prisma: any;
8
- }
9
- interface PostContactsArgs {
2
+ type PrismaClient = any;
3
+ interface ListContactArgs {
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;
12
+ prisma: PrismaClient;
13
+ queryWhere?: {
14
+ [key: string]: any;
15
+ };
16
+ }
17
+ interface UnitContactByIdArgs {
18
+ include?: {
19
+ [key: string]: any;
20
+ };
21
+ prisma: PrismaClient;
19
22
  queryWhere: {
20
23
  [key: string]: any;
21
24
  };
22
25
  }
23
- interface PostContactArgs {
26
+ interface UpdateContactArgs {
24
27
  companyId: string;
25
28
  country: string;
26
29
  email: string;
27
30
  firstName: string;
28
31
  id: string;
32
+ include?: {
33
+ [key: string]: any;
34
+ };
29
35
  lastName: string;
30
36
  phone: string;
31
- prisma: any;
37
+ prisma: PrismaClient;
38
+ queryWhere: {
39
+ [key: string]: any;
40
+ };
32
41
  }
33
42
  interface DeleteContactArgs {
34
- id: string;
35
- prisma: any;
43
+ include?: {
44
+ [key: string]: any;
45
+ };
46
+ prisma: PrismaClient;
47
+ queryWhere: {
48
+ [key: string]: any;
49
+ };
36
50
  }
37
- export declare const getContacts: ({ prisma, }: GetContactsArgs) => Promise<Array<ContactBE>>;
38
- export declare const getContactById: ({ prisma, id }: GetContactByIdArgs) => Promise<ContactBE>;
39
- export declare const postContacts: ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }: PostContactsArgs) => Promise<Array<ContactBE>>;
40
- export declare const postContact: ({ prisma, id, companyId, country, email, firstName, lastName, phone, }: PostContactArgs) => Promise<Array<ContactBE>>;
41
- export declare const deleteContact: ({ prisma, id }: DeleteContactArgs) => Promise<ContactBE>;
51
+ /**
52
+ * Retrieves contacts with pagination and filtering
53
+ * @param {ListContactArgs} args - Object containing prisma client, pagination, and query options
54
+ * @returns {Promise<[number, Array<ContactBE>]>} Tuple containing total count and array of contacts
55
+ */
56
+ export declare const listContact: ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }: ListContactArgs) => Promise<[number, Array<ContactBE>]>;
57
+ /**
58
+ * Retrieves a single contact by ID
59
+ * @param {UnitContactByIdArgs} args - Object containing prisma client and query where conditions
60
+ * @returns {Promise<ContactBE | null>} Contact if found, null otherwise
61
+ */
62
+ export declare const unitContactById: ({ prisma, queryWhere, include, }: UnitContactByIdArgs) => Promise<ContactBE | null>;
63
+ /**
64
+ * Creates or updates a contact
65
+ * @param {UpdateContactArgs} args - Object containing prisma client and contact data
66
+ * @returns {Promise<ContactBE>} Created or updated contact
67
+ */
68
+ export declare const updateContact: ({ prisma, id, queryWhere, companyId, country, email, firstName, lastName, phone, include, }: UpdateContactArgs) => Promise<ContactBE>;
69
+ /**
70
+ * Deletes a contact by ID
71
+ * @param {DeleteContactArgs} args - Object containing prisma client and query where conditions
72
+ * @returns {Promise<ContactBE>} Deleted contact
73
+ * @throws {Error} If contact ID is not provided or contact not found
74
+ */
75
+ export declare const deleteContact: ({ prisma, queryWhere, include, }: DeleteContactArgs) => Promise<ContactBE>;
42
76
  export {};
@@ -1,5 +1,15 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
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,127 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
47
  }
38
48
  };
39
49
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.deleteContact = exports.postContact = exports.postContacts = exports.getContactById = exports.getContacts = void 0;
41
- var getContacts = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
- var contacts;
43
- var prisma = _b.prisma;
44
- return __generator(this, function (_c) {
45
- switch (_c.label) {
46
- case 0: return [4 /*yield*/, prisma.contact.findMany({
47
- orderBy: {
48
- createdAt: 'desc',
49
- },
50
- include: {
51
- company: true,
52
- },
53
- })];
50
+ exports.deleteContact = exports.updateContact = exports.unitContactById = exports.listContact = void 0;
51
+ /**
52
+ * Retrieves contacts with pagination and filtering
53
+ * @param {ListContactArgs} args - Object containing prisma client, pagination, and query options
54
+ * @returns {Promise<[number, Array<ContactBE>]>} Tuple containing total count and array of contacts
55
+ */
56
+ var listContact = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
57
+ var _c, count, contacts;
58
+ var currentPage = _b.currentPage, _d = _b.include, include = _d === void 0 ? {} : _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('Valid current page is required');
64
+ }
65
+ if (pageLimit < 1) {
66
+ throw new Error('Valid page limit is required');
67
+ }
68
+ return [4 /*yield*/, prisma.$transaction([
69
+ prisma.contact.count({
70
+ where: queryWhere,
71
+ }),
72
+ prisma.contact.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
- contacts = _c.sent();
56
- return [2 /*return*/, contacts];
81
+ _c = _g.sent(), count = _c[0], contacts = _c[1];
82
+ return [2 /*return*/, [count, contacts]];
57
83
  }
58
84
  });
59
85
  }); };
60
- exports.getContacts = getContacts;
61
- var getContactById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
86
+ exports.listContact = listContact;
87
+ /**
88
+ * Retrieves a single contact by ID
89
+ * @param {UnitContactByIdArgs} args - Object containing prisma client and query where conditions
90
+ * @returns {Promise<ContactBE | null>} Contact if found, null otherwise
91
+ */
92
+ var unitContactById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
62
93
  var contact;
63
- var prisma = _b.prisma, id = _b.id;
64
- return __generator(this, function (_c) {
65
- switch (_c.label) {
66
- case 0: return [4 /*yield*/, prisma.contact.findUnique({
67
- where: {
68
- id: id,
69
- },
70
- include: {
71
- company: true,
72
- },
73
- })];
94
+ var prisma = _b.prisma, queryWhere = _b.queryWhere, _c = _b.include, include = _c === void 0 ? {} : _c;
95
+ return __generator(this, function (_d) {
96
+ switch (_d.label) {
97
+ case 0:
98
+ if (!(queryWhere === null || queryWhere === void 0 ? void 0 : queryWhere.id)) {
99
+ throw new Error('Contact ID is required');
100
+ }
101
+ return [4 /*yield*/, prisma.contact.findUnique({
102
+ include: include,
103
+ where: queryWhere,
104
+ })];
74
105
  case 1:
75
- contact = _c.sent();
106
+ contact = _d.sent();
76
107
  return [2 /*return*/, contact];
77
108
  }
78
109
  });
79
110
  }); };
80
- exports.getContactById = getContactById;
81
- var postContacts = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
82
- var contacts;
83
- var currentPage = _b.currentPage, include = _b.include, orderBy = _b.orderBy, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
111
+ exports.unitContactById = unitContactById;
112
+ /**
113
+ * Creates or updates a contact
114
+ * @param {UpdateContactArgs} args - Object containing prisma client and contact data
115
+ * @returns {Promise<ContactBE>} Created or updated contact
116
+ */
117
+ var updateContact = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
118
+ var contactData, contact;
119
+ var prisma = _b.prisma, id = _b.id, queryWhere = _b.queryWhere, companyId = _b.companyId, country = _b.country, email = _b.email, firstName = _b.firstName, lastName = _b.lastName, phone = _b.phone, include = _b.include;
84
120
  return __generator(this, function (_c) {
85
121
  switch (_c.label) {
86
- case 0: return [4 /*yield*/, prisma.$transaction([
87
- prisma.contact.count({
122
+ case 0:
123
+ if (!id || !(queryWhere === null || queryWhere === void 0 ? void 0 : queryWhere.id)) {
124
+ throw new Error('Contact ID is required');
125
+ }
126
+ if (!companyId || !country || !email || !firstName || !lastName || !phone) {
127
+ throw new Error('Company ID, country, email, first name, last name, and phone are required');
128
+ }
129
+ contactData = {
130
+ companyId: companyId,
131
+ country: country,
132
+ email: email,
133
+ firstName: firstName,
134
+ lastName: lastName,
135
+ phone: phone,
136
+ };
137
+ return [4 /*yield*/, prisma.contact.upsert({
88
138
  where: queryWhere,
89
- }),
90
- prisma.contact.findMany({
91
- orderBy: orderBy,
139
+ update: contactData,
140
+ create: __assign({ id: id }, contactData),
92
141
  include: include,
93
- where: queryWhere,
94
- take: pageLimit,
95
- skip: (currentPage - 1) * pageLimit,
96
- }),
97
- ])];
98
- case 1:
99
- contacts = _c.sent();
100
- return [2 /*return*/, contacts];
101
- }
102
- });
103
- }); };
104
- exports.postContacts = postContacts;
105
- var postContact = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
106
- var contact;
107
- var prisma = _b.prisma, id = _b.id, companyId = _b.companyId, country = _b.country, email = _b.email, firstName = _b.firstName, lastName = _b.lastName, phone = _b.phone;
108
- return __generator(this, function (_c) {
109
- switch (_c.label) {
110
- case 0: return [4 /*yield*/, prisma.contact.upsert({
111
- where: {
112
- id: id,
113
- },
114
- update: {
115
- companyId: companyId,
116
- country: country,
117
- email: email,
118
- firstName: firstName,
119
- lastName: lastName,
120
- phone: phone,
121
- },
122
- create: {
123
- companyId: companyId,
124
- country: country,
125
- email: email,
126
- firstName: firstName,
127
- lastName: lastName,
128
- phone: phone,
129
- },
130
- })];
142
+ })];
131
143
  case 1:
132
144
  contact = _c.sent();
133
145
  return [2 /*return*/, contact];
134
146
  }
135
147
  });
136
148
  }); };
137
- exports.postContact = postContact;
149
+ exports.updateContact = updateContact;
150
+ /**
151
+ * Deletes a contact by ID
152
+ * @param {DeleteContactArgs} args - Object containing prisma client and query where conditions
153
+ * @returns {Promise<ContactBE>} Deleted contact
154
+ * @throws {Error} If contact ID is not provided or contact not found
155
+ */
138
156
  var deleteContact = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
139
157
  var contact;
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.contact.delete({
144
- where: {
145
- id: id,
146
- },
147
- })];
158
+ var prisma = _b.prisma, queryWhere = _b.queryWhere, _c = _b.include, include = _c === void 0 ? {} : _c;
159
+ return __generator(this, function (_d) {
160
+ switch (_d.label) {
161
+ case 0:
162
+ if (!(queryWhere === null || queryWhere === void 0 ? void 0 : queryWhere.id)) {
163
+ throw new Error('Contact ID is required');
164
+ }
165
+ return [4 /*yield*/, prisma.contact.delete({
166
+ include: include,
167
+ where: queryWhere,
168
+ })];
148
169
  case 1:
149
- contact = _c.sent();
170
+ contact = _d.sent();
150
171
  return [2 /*return*/, contact];
151
172
  }
152
173
  });
@@ -1,26 +1,75 @@
1
1
  import { CurrencyBE } from '../type';
2
- interface GetCurrenciesArgs {
3
- prisma: any;
2
+ type PrismaClient = any;
3
+ interface ListCurrencyArgs {
4
+ currentPage: number;
5
+ include?: {
6
+ [key: string]: any;
7
+ };
8
+ orderBy?: {
9
+ [key: string]: any;
10
+ };
11
+ pageLimit: number;
12
+ prisma: PrismaClient;
13
+ queryWhere?: {
14
+ [key: string]: any;
15
+ };
4
16
  }
5
- interface GetCurrencyByIdArgs {
6
- id: string;
7
- prisma: any;
17
+ interface UnitCurrencyByIdArgs {
18
+ include?: {
19
+ [key: string]: any;
20
+ };
21
+ prisma: PrismaClient;
22
+ queryWhere: {
23
+ [key: string]: any;
24
+ };
8
25
  }
9
- interface PostCurrencyArgs {
26
+ interface UpdateCurrencyArgs {
10
27
  code: string;
11
28
  enabled: boolean;
12
29
  id: string;
13
- isDefault: boolean;
30
+ include?: {
31
+ [key: string]: any;
32
+ };
33
+ isDefault?: boolean;
14
34
  label: string;
15
35
  preferenceId: string;
16
- prisma: any;
36
+ prisma: PrismaClient;
37
+ queryWhere: {
38
+ [key: string]: any;
39
+ };
17
40
  }
18
41
  interface DeleteCurrencyArgs {
19
- id: string;
20
- prisma: any;
42
+ include?: {
43
+ [key: string]: any;
44
+ };
45
+ prisma: PrismaClient;
46
+ queryWhere: {
47
+ [key: string]: any;
48
+ };
21
49
  }
22
- export declare const getCurrencies: ({ prisma, }: GetCurrenciesArgs) => Promise<Array<CurrencyBE>>;
23
- export declare const getCurrencyById: ({ id, prisma, }: GetCurrencyByIdArgs) => Promise<CurrencyBE>;
24
- export declare const postCurrency: ({ code, enabled, id, isDefault, label, preferenceId, prisma, }: PostCurrencyArgs) => Promise<Array<CurrencyBE>>;
25
- export declare const deleteCurrency: ({ id, prisma, }: DeleteCurrencyArgs) => Promise<CurrencyBE>;
50
+ /**
51
+ * Retrieves currencies with pagination and filtering
52
+ * @param {ListCurrencyArgs} args - Object containing prisma client, pagination, and query options
53
+ * @returns {Promise<[number, Array<CurrencyBE>]>} Tuple containing total count and array of currencies
54
+ */
55
+ export declare const listCurrency: ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }: ListCurrencyArgs) => Promise<[number, Array<CurrencyBE>]>;
56
+ /**
57
+ * Retrieves a single currency by ID
58
+ * @param {UnitCurrencyByIdArgs} args - Object containing prisma client and query where conditions
59
+ * @returns {Promise<CurrencyBE | null>} Currency if found, null otherwise
60
+ */
61
+ export declare const unitCurrencyById: ({ prisma, queryWhere, include, }: UnitCurrencyByIdArgs) => Promise<CurrencyBE | null>;
62
+ /**
63
+ * Creates or updates a currency
64
+ * @param {UpdateCurrencyArgs} args - Object containing prisma client and currency data
65
+ * @returns {Promise<CurrencyBE>} Created or updated currency
66
+ */
67
+ export declare const updateCurrency: ({ code, enabled, id, isDefault, label, preferenceId, prisma, queryWhere, include, }: UpdateCurrencyArgs) => Promise<CurrencyBE>;
68
+ /**
69
+ * Deletes a currency by ID
70
+ * @param {DeleteCurrencyArgs} args - Object containing prisma client and query where conditions
71
+ * @returns {Promise<CurrencyBE>} Deleted currency
72
+ * @throws {Error} If currency ID is not provided or currency not found
73
+ */
74
+ export declare const deleteCurrency: ({ prisma, queryWhere, include, }: DeleteCurrencyArgs) => Promise<CurrencyBE>;
26
75
  export {};