@react-pakistan/util-functions 1.22.36 → 1.22.37
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.
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
interface BranchBE {
|
|
2
|
+
branchAddress: string;
|
|
3
|
+
branchName: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
id: string;
|
|
7
|
+
isDefault: boolean;
|
|
8
|
+
personEmail: string;
|
|
9
|
+
personName: string;
|
|
10
|
+
personPhone: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
}
|
|
13
|
+
interface GetBranchesArgs {
|
|
14
|
+
prisma: any;
|
|
15
|
+
}
|
|
16
|
+
interface GetBranchByIdArgs {
|
|
17
|
+
id: string;
|
|
18
|
+
prisma: any;
|
|
19
|
+
}
|
|
20
|
+
interface PostBranchArgs {
|
|
21
|
+
prisma: any;
|
|
22
|
+
branchAddress: string;
|
|
23
|
+
branchName: string;
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
id: string;
|
|
26
|
+
isDefault: boolean;
|
|
27
|
+
personEmail: string;
|
|
28
|
+
personName: string;
|
|
29
|
+
personPhone: string;
|
|
30
|
+
preferenceId: string;
|
|
31
|
+
}
|
|
32
|
+
interface DeleteBranchArgs {
|
|
33
|
+
id: string;
|
|
34
|
+
prisma: any;
|
|
35
|
+
}
|
|
36
|
+
export declare const getBranches: ({ prisma }: GetBranchesArgs) => Promise<Array<BranchBE>>;
|
|
37
|
+
export declare const getBranchById: ({ prisma, id }: GetBranchByIdArgs) => Promise<BranchBE>;
|
|
38
|
+
export declare const postBranch: ({ prisma, branchAddress, branchName, enabled, id, isDefault, personEmail, personName, personPhone, preferenceId, }: PostBranchArgs) => Promise<Array<BranchBE>>;
|
|
39
|
+
export declare const deleteBranch: ({ prisma, id, }: DeleteBranchArgs) => Promise<BranchBE>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
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.deleteBranch = exports.postBranch = exports.getBranchById = exports.getBranches = void 0;
|
|
14
|
+
const getBranches = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
|
|
15
|
+
const branches = yield prisma.stellarBranch.findMany({
|
|
16
|
+
orderBy: {
|
|
17
|
+
createdAt: 'desc',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return branches;
|
|
21
|
+
});
|
|
22
|
+
exports.getBranches = getBranches;
|
|
23
|
+
const getBranchById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
|
|
24
|
+
const branch = yield prisma.stellarBranch.findUnique({
|
|
25
|
+
where: {
|
|
26
|
+
id,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
return branch;
|
|
30
|
+
});
|
|
31
|
+
exports.getBranchById = getBranchById;
|
|
32
|
+
const postBranch = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, branchAddress, branchName, enabled, id, isDefault, personEmail, personName, personPhone, preferenceId, }) {
|
|
33
|
+
const branch = yield prisma.stellarBranch.upsert({
|
|
34
|
+
where: {
|
|
35
|
+
id,
|
|
36
|
+
},
|
|
37
|
+
update: {
|
|
38
|
+
branchAddress,
|
|
39
|
+
branchName,
|
|
40
|
+
enabled,
|
|
41
|
+
isDefault,
|
|
42
|
+
personEmail,
|
|
43
|
+
personName,
|
|
44
|
+
personPhone,
|
|
45
|
+
preferenceId,
|
|
46
|
+
},
|
|
47
|
+
create: {
|
|
48
|
+
branchAddress,
|
|
49
|
+
branchName,
|
|
50
|
+
enabled,
|
|
51
|
+
isDefault,
|
|
52
|
+
personEmail,
|
|
53
|
+
personName,
|
|
54
|
+
personPhone,
|
|
55
|
+
preferenceId,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
return branch;
|
|
59
|
+
});
|
|
60
|
+
exports.postBranch = postBranch;
|
|
61
|
+
const deleteBranch = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, }) {
|
|
62
|
+
const branch = yield prisma.stellarBranch.delete({
|
|
63
|
+
where: {
|
|
64
|
+
id,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return branch;
|
|
68
|
+
});
|
|
69
|
+
exports.deleteBranch = deleteBranch;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface CompanyBE {
|
|
2
|
+
country: string;
|
|
3
|
+
email: string;
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
phone: boolean;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
website: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface GetCompaniesArgs {
|
|
11
|
+
prisma: any;
|
|
12
|
+
}
|
|
13
|
+
interface GetCompanyByIdArgs {
|
|
14
|
+
id: string;
|
|
15
|
+
prisma: any;
|
|
16
|
+
}
|
|
17
|
+
interface PostCompaniesArgs {
|
|
18
|
+
currentPage: number;
|
|
19
|
+
pageLimit: number;
|
|
20
|
+
prisma: any;
|
|
21
|
+
queryWhere: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
interface PostCompanyArgs {
|
|
26
|
+
prisma: any;
|
|
27
|
+
country: string;
|
|
28
|
+
email: string;
|
|
29
|
+
name: boolean;
|
|
30
|
+
id: string;
|
|
31
|
+
phone: boolean;
|
|
32
|
+
website: string;
|
|
33
|
+
}
|
|
34
|
+
interface DeleteCompanyArgs {
|
|
35
|
+
id: string;
|
|
36
|
+
prisma: any;
|
|
37
|
+
}
|
|
38
|
+
export declare const getCompanies: ({ prisma }: GetCompaniesArgs) => Promise<Array<CompanyBE>>;
|
|
39
|
+
export declare const getCompanyById: ({ prisma, id }: GetCompanyByIdArgs) => Promise<CompanyBE>;
|
|
40
|
+
export declare const postCompanies: ({ prisma, queryWhere, pageLimit, currentPage, }: PostCompaniesArgs) => Promise<Array<CompanyBE>>;
|
|
41
|
+
export declare const postCompany: ({ prisma, country, email, name, id, phone, website, }: PostCompanyArgs) => Promise<Array<CompanyBE>>;
|
|
42
|
+
export declare const deleteCompany: ({ prisma, id, }: DeleteCompanyArgs) => Promise<CompanyBE>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals */
|
|
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.deleteCompany = exports.postCompany = exports.postCompanies = exports.getCompanyById = exports.getCompanies = void 0;
|
|
14
|
+
const getCompanies = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma }) {
|
|
15
|
+
const companies = yield prisma.stellarCompany.findMany({
|
|
16
|
+
orderBy: {
|
|
17
|
+
createdAt: 'desc',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return companies;
|
|
21
|
+
});
|
|
22
|
+
exports.getCompanies = getCompanies;
|
|
23
|
+
const getCompanyById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id }) {
|
|
24
|
+
const company = yield prisma.stellarCompany.findUnique({
|
|
25
|
+
where: {
|
|
26
|
+
id,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
return company;
|
|
30
|
+
});
|
|
31
|
+
exports.getCompanyById = getCompanyById;
|
|
32
|
+
const postCompanies = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, queryWhere, pageLimit, currentPage, }) {
|
|
33
|
+
const companies = yield prisma.$transaction([
|
|
34
|
+
prisma.stellarCompany.count({
|
|
35
|
+
where: queryWhere,
|
|
36
|
+
}),
|
|
37
|
+
prisma.stellarCompany.findMany({
|
|
38
|
+
orderBy: {
|
|
39
|
+
createdAt: 'desc',
|
|
40
|
+
},
|
|
41
|
+
include: {
|
|
42
|
+
contacts: true,
|
|
43
|
+
},
|
|
44
|
+
where: queryWhere,
|
|
45
|
+
take: pageLimit,
|
|
46
|
+
skip: currentPage === 1 ? 0 : currentPage - 1 * pageLimit,
|
|
47
|
+
}),
|
|
48
|
+
]);
|
|
49
|
+
return companies;
|
|
50
|
+
});
|
|
51
|
+
exports.postCompanies = postCompanies;
|
|
52
|
+
const postCompany = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, country, email, name, id, phone, website, }) {
|
|
53
|
+
const company = yield prisma.stellarCompany.upsert({
|
|
54
|
+
where: {
|
|
55
|
+
id,
|
|
56
|
+
},
|
|
57
|
+
update: {
|
|
58
|
+
country,
|
|
59
|
+
email,
|
|
60
|
+
name,
|
|
61
|
+
phone,
|
|
62
|
+
website,
|
|
63
|
+
},
|
|
64
|
+
create: {
|
|
65
|
+
country,
|
|
66
|
+
email,
|
|
67
|
+
name,
|
|
68
|
+
phone,
|
|
69
|
+
website,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
return company;
|
|
73
|
+
});
|
|
74
|
+
exports.postCompany = postCompany;
|
|
75
|
+
const deleteCompany = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
|
|
76
|
+
const company = yield prisma.stellarCompany.delete({
|
|
77
|
+
where: {
|
|
78
|
+
id,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
return company;
|
|
82
|
+
});
|
|
83
|
+
exports.deleteCompany = deleteCompany;
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './api/stellar-solutions/app-user';
|
|
2
2
|
export * from './api/stellar-solutions/banking-detail';
|
|
3
|
+
export * from './api/stellar-solutions/branch';
|
|
4
|
+
export * from './api/stellar-solutions/company';
|
|
3
5
|
export * from './api/stellar-solutions/customer';
|
|
4
6
|
export * from './api/cors';
|
|
5
7
|
export * from './constants';
|
package/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api/stellar-solutions/app-user"), exports);
|
|
18
18
|
__exportStar(require("./api/stellar-solutions/banking-detail"), exports);
|
|
19
|
+
__exportStar(require("./api/stellar-solutions/branch"), exports);
|
|
20
|
+
__exportStar(require("./api/stellar-solutions/company"), exports);
|
|
19
21
|
__exportStar(require("./api/stellar-solutions/customer"), exports);
|
|
20
22
|
__exportStar(require("./api/cors"), exports);
|
|
21
23
|
__exportStar(require("./constants"), exports);
|