@react-pakistan/util-functions 1.22.36 → 1.22.38

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;
@@ -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;
@@ -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
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.36",
3
+ "version": "1.22.38",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {