@react-pakistan/util-functions 1.24.65 → 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 +178 -112
- package/api/stellar-solutions/type.js +60 -2
- 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,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,
|
|
44
|
-
return __generator(this, function (
|
|
45
|
-
switch (
|
|
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
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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:
|
|
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
|
|
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:
|
|
37
|
+
prisma: PrismaClient;
|
|
38
|
+
queryWhere: {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
32
41
|
}
|
|
33
42
|
interface DeleteContactArgs {
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
include?: {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
};
|
|
46
|
+
prisma: PrismaClient;
|
|
47
|
+
queryWhere: {
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
};
|
|
36
50
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
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.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
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.
|
|
61
|
-
|
|
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,
|
|
64
|
-
return __generator(this, function (
|
|
65
|
-
switch (
|
|
66
|
-
case 0:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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 =
|
|
106
|
+
contact = _d.sent();
|
|
76
107
|
return [2 /*return*/, contact];
|
|
77
108
|
}
|
|
78
109
|
});
|
|
79
110
|
}); };
|
|
80
|
-
exports.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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:
|
|
87
|
-
|
|
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
|
-
|
|
91
|
-
orderBy: orderBy,
|
|
139
|
+
update: contactData,
|
|
140
|
+
create: __assign({ id: id }, contactData),
|
|
92
141
|
include: include,
|
|
93
|
-
|
|
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.
|
|
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,
|
|
141
|
-
return __generator(this, function (
|
|
142
|
-
switch (
|
|
143
|
-
case 0:
|
|
144
|
-
|
|
145
|
-
|
|
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 =
|
|
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
|
-
|
|
3
|
-
|
|
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
|
|
6
|
-
|
|
7
|
-
|
|
17
|
+
interface UnitCurrencyByIdArgs {
|
|
18
|
+
include?: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
prisma: PrismaClient;
|
|
22
|
+
queryWhere: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
8
25
|
}
|
|
9
|
-
interface
|
|
26
|
+
interface UpdateCurrencyArgs {
|
|
10
27
|
code: string;
|
|
11
28
|
enabled: boolean;
|
|
12
29
|
id: string;
|
|
13
|
-
|
|
30
|
+
include?: {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
isDefault?: boolean;
|
|
14
34
|
label: string;
|
|
15
35
|
preferenceId: string;
|
|
16
|
-
prisma:
|
|
36
|
+
prisma: PrismaClient;
|
|
37
|
+
queryWhere: {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
};
|
|
17
40
|
}
|
|
18
41
|
interface DeleteCurrencyArgs {
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
include?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
prisma: PrismaClient;
|
|
46
|
+
queryWhere: {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
};
|
|
21
49
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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 {};
|