@react-pakistan/util-functions 1.22.37 → 1.22.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/stellar-solutions/contact/index.d.ts +46 -0
- package/api/stellar-solutions/contact/index.js +91 -0
- package/api/stellar-solutions/currency/index.d.ts +35 -0
- package/api/stellar-solutions/currency/index.js +63 -0
- package/api/stellar-solutions/customer/index.js +6 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface ContactBE {
|
|
2
|
+
companyId: string;
|
|
3
|
+
country: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
email: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
id: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
phone: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}
|
|
12
|
+
interface GetContactsArgs {
|
|
13
|
+
prisma: any;
|
|
14
|
+
}
|
|
15
|
+
interface GetContactByIdArgs {
|
|
16
|
+
id: string;
|
|
17
|
+
prisma: any;
|
|
18
|
+
}
|
|
19
|
+
interface PostContactsArgs {
|
|
20
|
+
currentPage: number;
|
|
21
|
+
pageLimit: number;
|
|
22
|
+
prisma: any;
|
|
23
|
+
queryWhere: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
interface PostContactArgs {
|
|
28
|
+
companyId: string;
|
|
29
|
+
country: string;
|
|
30
|
+
email: string;
|
|
31
|
+
firstName: string;
|
|
32
|
+
id: string;
|
|
33
|
+
lastName: string;
|
|
34
|
+
phone: string;
|
|
35
|
+
prisma: any;
|
|
36
|
+
}
|
|
37
|
+
interface DeleteContactArgs {
|
|
38
|
+
id: string;
|
|
39
|
+
prisma: any;
|
|
40
|
+
}
|
|
41
|
+
export declare const getContacts: ({ prisma }: GetContactsArgs) => Promise<Array<ContactBE>>;
|
|
42
|
+
export declare const getContactById: ({ prisma, id }: GetContactByIdArgs) => Promise<ContactBE>;
|
|
43
|
+
export declare const postContacts: ({ currentPage, pageLimit, prisma, queryWhere, }: PostContactsArgs) => Promise<Array<ContactBE>>;
|
|
44
|
+
export declare const postContact: ({ prisma, id, companyId, country, email, firstName, lastName, phone, }: PostContactArgs) => Promise<Array<ContactBE>>;
|
|
45
|
+
export declare const deleteContact: ({ prisma, id }: DeleteContactArgs) => Promise<ContactBE>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.deleteContact = exports.postContact = exports.postContacts = exports.getContactById = exports.getContacts = void 0;
|
|
14
|
+
const getContacts = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
|
|
15
|
+
const contacts = yield prisma.stellarContact.findMany({
|
|
16
|
+
orderBy: {
|
|
17
|
+
createdAt: 'desc',
|
|
18
|
+
},
|
|
19
|
+
include: {
|
|
20
|
+
company: true,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return contacts;
|
|
24
|
+
});
|
|
25
|
+
exports.getContacts = getContacts;
|
|
26
|
+
const getContactById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
|
|
27
|
+
const contact = yield prisma.stellarContact.findUnique({
|
|
28
|
+
where: {
|
|
29
|
+
id,
|
|
30
|
+
},
|
|
31
|
+
include: {
|
|
32
|
+
company: true,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return contact;
|
|
36
|
+
});
|
|
37
|
+
exports.getContactById = getContactById;
|
|
38
|
+
const postContacts = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
|
|
39
|
+
const contacts = yield prisma.$transaction([
|
|
40
|
+
prisma.stellarContact.count({
|
|
41
|
+
where: queryWhere,
|
|
42
|
+
}),
|
|
43
|
+
prisma.stellarContact.findMany({
|
|
44
|
+
orderBy: {
|
|
45
|
+
createdAt: 'desc',
|
|
46
|
+
},
|
|
47
|
+
include: {
|
|
48
|
+
company: true,
|
|
49
|
+
},
|
|
50
|
+
where: queryWhere,
|
|
51
|
+
take: pageLimit,
|
|
52
|
+
skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
|
|
53
|
+
}),
|
|
54
|
+
]);
|
|
55
|
+
return contacts;
|
|
56
|
+
});
|
|
57
|
+
exports.postContacts = postContacts;
|
|
58
|
+
const postContact = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, companyId, country, email, firstName, lastName, phone, }) {
|
|
59
|
+
const contact = yield prisma.stellarContact.upsert({
|
|
60
|
+
where: {
|
|
61
|
+
id,
|
|
62
|
+
},
|
|
63
|
+
update: {
|
|
64
|
+
companyId,
|
|
65
|
+
country,
|
|
66
|
+
email,
|
|
67
|
+
firstName,
|
|
68
|
+
lastName,
|
|
69
|
+
phone,
|
|
70
|
+
},
|
|
71
|
+
create: {
|
|
72
|
+
companyId,
|
|
73
|
+
country,
|
|
74
|
+
email,
|
|
75
|
+
firstName,
|
|
76
|
+
lastName,
|
|
77
|
+
phone,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
return contact;
|
|
81
|
+
});
|
|
82
|
+
exports.postContact = postContact;
|
|
83
|
+
const deleteContact = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id }) {
|
|
84
|
+
const contact = yield prisma.stellarContact.delete({
|
|
85
|
+
where: {
|
|
86
|
+
id,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
return contact;
|
|
90
|
+
});
|
|
91
|
+
exports.deleteContact = deleteContact;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
interface CurrencyBE {
|
|
2
|
+
code: string;
|
|
3
|
+
createdAt: string;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
id: string;
|
|
6
|
+
isDefault: string;
|
|
7
|
+
label: string;
|
|
8
|
+
preferenceId: string;
|
|
9
|
+
updatedAt: string;
|
|
10
|
+
}
|
|
11
|
+
interface GetCurrenciesArgs {
|
|
12
|
+
prisma: any;
|
|
13
|
+
}
|
|
14
|
+
interface GetCurrencyByIdArgs {
|
|
15
|
+
id: string;
|
|
16
|
+
prisma: any;
|
|
17
|
+
}
|
|
18
|
+
interface PostCurrencyArgs {
|
|
19
|
+
code: string;
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
id: string;
|
|
22
|
+
isDefault: boolean;
|
|
23
|
+
label: string;
|
|
24
|
+
preferenceId: string;
|
|
25
|
+
prisma: any;
|
|
26
|
+
}
|
|
27
|
+
interface DeleteCurrencyArgs {
|
|
28
|
+
id: string;
|
|
29
|
+
prisma: any;
|
|
30
|
+
}
|
|
31
|
+
export declare const getCurrencies: ({ prisma, }: GetCurrenciesArgs) => Promise<Array<CurrencyBE>>;
|
|
32
|
+
export declare const getCurrencyById: ({ id, prisma, }: GetCurrencyByIdArgs) => Promise<CurrencyBE>;
|
|
33
|
+
export declare const postCurrency: ({ code, enabled, id, isDefault, label, preferenceId, prisma, }: PostCurrencyArgs) => Promise<Array<CurrencyBE>>;
|
|
34
|
+
export declare const deleteCurrency: ({ id, prisma, }: DeleteCurrencyArgs) => Promise<CurrencyBE>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.deleteCurrency = exports.postCurrency = exports.getCurrencyById = exports.getCurrencies = void 0;
|
|
14
|
+
const getCurrencies = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
|
|
15
|
+
const customers = yield prisma.stellarCustomer.findMany({
|
|
16
|
+
orderBy: {
|
|
17
|
+
createdAt: 'desc',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return customers;
|
|
21
|
+
});
|
|
22
|
+
exports.getCurrencies = getCurrencies;
|
|
23
|
+
const getCurrencyById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id, prisma, }) {
|
|
24
|
+
const currency = yield prisma.stellarCurrency.findUnique({
|
|
25
|
+
where: {
|
|
26
|
+
id,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
return currency;
|
|
30
|
+
});
|
|
31
|
+
exports.getCurrencyById = getCurrencyById;
|
|
32
|
+
const postCurrency = (_c) => __awaiter(void 0, [_c], void 0, function* ({ code, enabled, id, isDefault, label, preferenceId, prisma, }) {
|
|
33
|
+
const currency = yield prisma.stellarCurrency.upsert({
|
|
34
|
+
where: {
|
|
35
|
+
id,
|
|
36
|
+
},
|
|
37
|
+
update: {
|
|
38
|
+
code,
|
|
39
|
+
enabled,
|
|
40
|
+
isDefault,
|
|
41
|
+
label,
|
|
42
|
+
preferenceId,
|
|
43
|
+
},
|
|
44
|
+
create: {
|
|
45
|
+
code,
|
|
46
|
+
enabled,
|
|
47
|
+
isDefault,
|
|
48
|
+
label,
|
|
49
|
+
preferenceId,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return currency;
|
|
53
|
+
});
|
|
54
|
+
exports.postCurrency = postCurrency;
|
|
55
|
+
const deleteCurrency = (_d) => __awaiter(void 0, [_d], void 0, function* ({ id, prisma, }) {
|
|
56
|
+
const currency = yield prisma.stellarCurrency.delete({
|
|
57
|
+
where: {
|
|
58
|
+
id,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return currency;
|
|
62
|
+
});
|
|
63
|
+
exports.deleteCurrency = deleteCurrency;
|
|
@@ -16,6 +16,9 @@ const getCustomers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma
|
|
|
16
16
|
orderBy: {
|
|
17
17
|
createdAt: 'desc',
|
|
18
18
|
},
|
|
19
|
+
include: {
|
|
20
|
+
contacts: true,
|
|
21
|
+
},
|
|
19
22
|
});
|
|
20
23
|
return customers;
|
|
21
24
|
});
|
|
@@ -25,6 +28,9 @@ const getCustomerById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ pri
|
|
|
25
28
|
where: {
|
|
26
29
|
id,
|
|
27
30
|
},
|
|
31
|
+
include: {
|
|
32
|
+
contacts: true,
|
|
33
|
+
},
|
|
28
34
|
});
|
|
29
35
|
return customer;
|
|
30
36
|
});
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export * from './api/stellar-solutions/app-user';
|
|
|
2
2
|
export * from './api/stellar-solutions/banking-detail';
|
|
3
3
|
export * from './api/stellar-solutions/branch';
|
|
4
4
|
export * from './api/stellar-solutions/company';
|
|
5
|
+
export * from './api/stellar-solutions/contact';
|
|
6
|
+
export * from './api/stellar-solutions/currency';
|
|
5
7
|
export * from './api/stellar-solutions/customer';
|
|
6
8
|
export * from './api/cors';
|
|
7
9
|
export * from './constants';
|
package/index.js
CHANGED
|
@@ -18,6 +18,8 @@ __exportStar(require("./api/stellar-solutions/app-user"), exports);
|
|
|
18
18
|
__exportStar(require("./api/stellar-solutions/banking-detail"), exports);
|
|
19
19
|
__exportStar(require("./api/stellar-solutions/branch"), exports);
|
|
20
20
|
__exportStar(require("./api/stellar-solutions/company"), exports);
|
|
21
|
+
__exportStar(require("./api/stellar-solutions/contact"), exports);
|
|
22
|
+
__exportStar(require("./api/stellar-solutions/currency"), exports);
|
|
21
23
|
__exportStar(require("./api/stellar-solutions/customer"), exports);
|
|
22
24
|
__exportStar(require("./api/cors"), exports);
|
|
23
25
|
__exportStar(require("./constants"), exports);
|