@stashfin/mysql2 1.4.35 → 1.4.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.
- package/README.md +55 -0
- package/dist/package.json +23 -0
- package/package.json +1 -1
- package/src/index.ts +128 -0
- package/src/indexPromise.ts +112 -0
- package/src/models/BBPSCustomerBillProviders.ts +27 -0
- package/src/models/BBPSProviders.ts +24 -0
- package/src/models/BBPSTransactions.ts +28 -0
- package/src/models/BBPSUtilities.ts +14 -0
- package/src/models/BBPSVendor.ts +12 -0
- package/src/models/Common.ts +21 -0
- package/src/models/Customer.ts +169 -0
- package/src/models/DashboardBlock.ts +32 -0
- package/src/models/Installments.ts +37 -0
- package/src/models/JourneySteps.ts +24 -0
- package/src/models/KycDetails.ts +20 -0
- package/src/models/Loans.ts +47 -0
- package/src/models/Location.ts +19 -0
- package/src/models/Offer.ts +37 -0
- package/src/models/PanDetails.ts +19 -0
- package/src/models/ReferAndEarn.ts +50 -0
- package/src/models/StashCash.ts +46 -0
- package/src/models/User.ts +21 -0
- package/src/models/UserAuthToken.ts +12 -0
- package/src/models/UserDetails.ts +12 -0
- package/src/models/UserKYCBank.ts +9 -0
- package/src/models/UserKYCPan.ts +15 -0
- package/src/models/WealthUser.ts +36 -0
- package/tsconfig.json +16 -0
- /package/{index copy.d.ts → dist/index copy.d.ts} +0 -0
- /package/{index copy.js → dist/index copy.js} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{indexPromise.d.ts → dist/indexPromise.d.ts} +0 -0
- /package/{indexPromise.js → dist/indexPromise.js} +0 -0
- /package/{models → dist/models}/BBPSCustomerBillProviders.d.ts +0 -0
- /package/{models → dist/models}/BBPSCustomerBillProviders.js +0 -0
- /package/{models → dist/models}/BBPSProviders.d.ts +0 -0
- /package/{models → dist/models}/BBPSProviders.js +0 -0
- /package/{models → dist/models}/BBPSTransactions.d.ts +0 -0
- /package/{models → dist/models}/BBPSTransactions.js +0 -0
- /package/{models → dist/models}/BBPSUtilities.d.ts +0 -0
- /package/{models → dist/models}/BBPSUtilities.js +0 -0
- /package/{models → dist/models}/BBPSVendor.d.ts +0 -0
- /package/{models → dist/models}/BBPSVendor.js +0 -0
- /package/{models → dist/models}/Banners.d.ts +0 -0
- /package/{models → dist/models}/Banners.js +0 -0
- /package/{models → dist/models}/Common.d.ts +0 -0
- /package/{models → dist/models}/Common.js +0 -0
- /package/{models → dist/models}/Customer.d.ts +0 -0
- /package/{models → dist/models}/Customer.js +0 -0
- /package/{models → dist/models}/DashboardBlock.d.ts +0 -0
- /package/{models → dist/models}/DashboardBlock.js +0 -0
- /package/{models → dist/models}/Installments.d.ts +0 -0
- /package/{models → dist/models}/Installments.js +0 -0
- /package/{models → dist/models}/JourneySteps.d.ts +0 -0
- /package/{models → dist/models}/JourneySteps.js +0 -0
- /package/{models → dist/models}/KycDetails.d.ts +0 -0
- /package/{models → dist/models}/KycDetails.js +0 -0
- /package/{models → dist/models}/Loans.d.ts +0 -0
- /package/{models → dist/models}/Loans.js +0 -0
- /package/{models → dist/models}/Location.d.ts +0 -0
- /package/{models → dist/models}/Location.js +0 -0
- /package/{models → dist/models}/Offer.d.ts +0 -0
- /package/{models → dist/models}/Offer.js +0 -0
- /package/{models → dist/models}/PanDetails.d.ts +0 -0
- /package/{models → dist/models}/PanDetails.js +0 -0
- /package/{models → dist/models}/ReferAndEarn.d.ts +0 -0
- /package/{models → dist/models}/ReferAndEarn.js +0 -0
- /package/{models → dist/models}/StashCash.d.ts +0 -0
- /package/{models → dist/models}/StashCash.js +0 -0
- /package/{models → dist/models}/User.d.ts +0 -0
- /package/{models → dist/models}/User.js +0 -0
- /package/{models → dist/models}/UserAuthToken.d.ts +0 -0
- /package/{models → dist/models}/UserAuthToken.js +0 -0
- /package/{models → dist/models}/UserDetails.d.ts +0 -0
- /package/{models → dist/models}/UserDetails.js +0 -0
- /package/{models → dist/models}/UserKYCBank.d.ts +0 -0
- /package/{models → dist/models}/UserKYCBank.js +0 -0
- /package/{models → dist/models}/UserKYCPan.d.ts +0 -0
- /package/{models → dist/models}/UserKYCPan.js +0 -0
- /package/{models → dist/models}/WealthUser.d.ts +0 -0
- /package/{models → dist/models}/WealthUser.js +0 -0
- /package/{models → dist/models}/location.d.ts +0 -0
- /package/{models → dist/models}/location.js +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# MySQL Package
|
|
2
|
+
|
|
3
|
+
This is a local package for MySQL database operations.
|
|
4
|
+
|
|
5
|
+
### Installation
|
|
6
|
+
|
|
7
|
+
To install this package, run the following command in your terminal:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @stashfin/mysql2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Table Interface
|
|
14
|
+
|
|
15
|
+
The package includes a table interface located in the model folder. This interface defines the structure of the tables in the MySQL database.
|
|
16
|
+
|
|
17
|
+
````
|
|
18
|
+
|
|
19
|
+
## Table Interface (model/table.ts)
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
export interface Table {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
// Add other table fields here
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface TableModel extends Table, RowDataPacket {}
|
|
29
|
+
|
|
30
|
+
````
|
|
31
|
+
|
|
32
|
+
### Local Development
|
|
33
|
+
|
|
34
|
+
To publish this package locally for development purposes, run the following command in your terminal:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
npm run build
|
|
38
|
+
cd dist
|
|
39
|
+
npm link
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Production Package Publish
|
|
43
|
+
|
|
44
|
+
To publish this package, run the following command in your terminal:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
npm run publish:patch
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Generate the Interfaces from mysql table
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
npx mysql-schema-ts mysql://root:root123@localhost/stashfin --table journey_steps
|
|
54
|
+
npx mysql-schema-ts mysql://root:root123@localhost/stashfin --table journey_steps > src/models/JourneySteps.ts
|
|
55
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stashfin/mysql2",
|
|
3
|
+
"version": "1.4.35",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc --build",
|
|
9
|
+
"build:ws": "tsc --build && copy package.json dist/",
|
|
10
|
+
"postbuild": "cp package.json dist/ ",
|
|
11
|
+
"publish:patch": "npm version patch && npm run build && cd dist && npm publish --access public",
|
|
12
|
+
"publish:minor": "npm version minor && npm run build && cd dist && npm publish --access public"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "Yogesh Randive",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"mysql2": "^3.9.9"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"cpy-cli": "^5.0.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import mysql, {
|
|
2
|
+
Pool,
|
|
3
|
+
RowDataPacket,
|
|
4
|
+
PoolOptions,
|
|
5
|
+
ResultSetHeader,
|
|
6
|
+
} from 'mysql2';
|
|
7
|
+
|
|
8
|
+
// define options
|
|
9
|
+
export interface MysqlConnectorOptions extends PoolOptions {}
|
|
10
|
+
|
|
11
|
+
//define class
|
|
12
|
+
export class MysqlConnector {
|
|
13
|
+
private pool: Pool;
|
|
14
|
+
private credentials: PoolOptions;
|
|
15
|
+
|
|
16
|
+
constructor(credentials: PoolOptions) {
|
|
17
|
+
this.credentials = credentials;
|
|
18
|
+
this.pool = mysql.createPool(this.credentials);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A random method to simulate a step before to get the class methods */
|
|
22
|
+
public getPoolConnection() {
|
|
23
|
+
if (!this?.pool) this.pool = mysql.createPool(this.credentials);
|
|
24
|
+
return this.pool;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public getConnection() {
|
|
28
|
+
if (!this?.pool) this.pool = mysql.createPool(this.credentials);
|
|
29
|
+
return this.pool.promise().getConnection();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async queryRow<T extends RowDataPacket>(
|
|
33
|
+
sql: string,
|
|
34
|
+
values?: Array<string | number>,
|
|
35
|
+
): Promise<T | undefined> {
|
|
36
|
+
const pool = this.getPoolConnection();
|
|
37
|
+
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
pool.query<T[]>(sql, values, function (err, results, fields) {
|
|
40
|
+
if (err) reject(err);
|
|
41
|
+
// Connection is automatically released when query resolves
|
|
42
|
+
else resolve(results[0] || undefined);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public async queryRows<T extends RowDataPacket>(
|
|
48
|
+
sql: string,
|
|
49
|
+
values?: Array<string | number>,
|
|
50
|
+
): Promise<T[]> {
|
|
51
|
+
const pool = this.getPoolConnection();
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
pool.query<T[]>(sql, values, function (err, results, fields) {
|
|
54
|
+
// Connection is automatically released when query resolves
|
|
55
|
+
if (err) reject(err);
|
|
56
|
+
else resolve(results);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public async queryArray<T extends RowDataPacket>(
|
|
62
|
+
sql: string,
|
|
63
|
+
values?: Array<string | number>,
|
|
64
|
+
): Promise<T[]> {
|
|
65
|
+
const pool = this.getPoolConnection();
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
pool.query<T[]>(
|
|
68
|
+
{ sql, values, rowsAsArray: true },
|
|
69
|
+
function (err, results, fields) {
|
|
70
|
+
// Connection is automatically released when query resolves
|
|
71
|
+
if (err) reject(err);
|
|
72
|
+
else resolve(results);
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public async executeResult(
|
|
79
|
+
sql: string,
|
|
80
|
+
values?: unknown[],
|
|
81
|
+
): Promise<ResultSetHeader> {
|
|
82
|
+
const pool = this.getPoolConnection();
|
|
83
|
+
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
pool.query<ResultSetHeader>(sql, values, function (err, results, fields) {
|
|
86
|
+
// Connection is automatically released when query resolves
|
|
87
|
+
if (err) reject(err);
|
|
88
|
+
else resolve(results || undefined);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public async insertData(
|
|
94
|
+
tableName: string,
|
|
95
|
+
data: Record<string, string | number>,
|
|
96
|
+
): Promise<ResultSetHeader> {
|
|
97
|
+
const keys = Object.keys(data);
|
|
98
|
+
const values = Object.values(data);
|
|
99
|
+
|
|
100
|
+
const sql = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES (${keys
|
|
101
|
+
.map(() => '?')
|
|
102
|
+
.join(', ')})`;
|
|
103
|
+
|
|
104
|
+
return this.executeResult(sql, values);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public async updateData(
|
|
108
|
+
tableName: string,
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
+
data: Record<string, any>,
|
|
111
|
+
condition: string,
|
|
112
|
+
conditionValues?: Array<string | number>,
|
|
113
|
+
): Promise<ResultSetHeader> {
|
|
114
|
+
const keys = Object.keys(data);
|
|
115
|
+
const values = Object.values(data);
|
|
116
|
+
|
|
117
|
+
const sql = `UPDATE ${tableName} SET ${keys
|
|
118
|
+
.map((key) => `${key} = ?`)
|
|
119
|
+
.join(', ')} WHERE ${condition}`;
|
|
120
|
+
|
|
121
|
+
const finalValues = [...values, ...(conditionValues || [])];
|
|
122
|
+
return this.executeResult(sql, finalValues);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public async close() {
|
|
126
|
+
await this.pool.end();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import mysql, {
|
|
2
|
+
Pool,
|
|
3
|
+
RowDataPacket,
|
|
4
|
+
PoolOptions,
|
|
5
|
+
ResultSetHeader,
|
|
6
|
+
} from 'mysql2/promise';
|
|
7
|
+
|
|
8
|
+
// define options
|
|
9
|
+
export interface MysqlConnectorOptions extends PoolOptions {}
|
|
10
|
+
|
|
11
|
+
//define class
|
|
12
|
+
export class MysqlConnector {
|
|
13
|
+
private pool: Pool;
|
|
14
|
+
private credentials: PoolOptions;
|
|
15
|
+
|
|
16
|
+
constructor(credentials: PoolOptions) {
|
|
17
|
+
this.credentials = credentials;
|
|
18
|
+
this.pool = mysql.createPool(this.credentials);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A random method to simulate a step before to get the class methods */
|
|
22
|
+
public getConnection() {
|
|
23
|
+
if (!this?.pool) this.pool = mysql.createPool(this.credentials);
|
|
24
|
+
return this.pool.getConnection();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async queryRow<T extends RowDataPacket>(
|
|
28
|
+
sql: string,
|
|
29
|
+
values?: Array<string | number>,
|
|
30
|
+
): Promise<T | undefined> {
|
|
31
|
+
const connection = await this.getConnection();
|
|
32
|
+
const [rows] = await connection.query<T[]>(sql, values);
|
|
33
|
+
await connection.release();
|
|
34
|
+
return rows[0] || undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async queryRows<T extends RowDataPacket>(
|
|
38
|
+
sql: string,
|
|
39
|
+
values?: Array<string | number>,
|
|
40
|
+
): Promise<T[]> {
|
|
41
|
+
const connection = await this.getConnection();
|
|
42
|
+
|
|
43
|
+
const [rows] = await connection.query<T[]>(sql, values);
|
|
44
|
+
|
|
45
|
+
await connection.release();
|
|
46
|
+
return rows;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public async queryArray<T extends RowDataPacket>(
|
|
50
|
+
sql: string,
|
|
51
|
+
values?: Array<string | number>,
|
|
52
|
+
): Promise<T[]> {
|
|
53
|
+
const connection = await this.getConnection();
|
|
54
|
+
|
|
55
|
+
const [rows] = await connection.query<T[]>({
|
|
56
|
+
sql,
|
|
57
|
+
values,
|
|
58
|
+
rowsAsArray: true,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
await connection.release();
|
|
62
|
+
return rows;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public async executeResult(
|
|
66
|
+
sql: string,
|
|
67
|
+
values?: unknown[],
|
|
68
|
+
): Promise<ResultSetHeader> {
|
|
69
|
+
const connection = await this.pool.getConnection();
|
|
70
|
+
|
|
71
|
+
const [rows] = await connection.query<ResultSetHeader>(sql, values);
|
|
72
|
+
|
|
73
|
+
await connection.release();
|
|
74
|
+
return rows;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public async insertData(
|
|
78
|
+
tableName: string,
|
|
79
|
+
data: Record<string, string | number>,
|
|
80
|
+
): Promise<ResultSetHeader> {
|
|
81
|
+
const keys = Object.keys(data);
|
|
82
|
+
const values = Object.values(data);
|
|
83
|
+
|
|
84
|
+
const sql = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES (${keys
|
|
85
|
+
.map(() => '?')
|
|
86
|
+
.join(', ')})`;
|
|
87
|
+
|
|
88
|
+
return this.executeResult(sql, values);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public async updateData(
|
|
92
|
+
tableName: string,
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
+
data: Record<string, any>,
|
|
95
|
+
condition: string,
|
|
96
|
+
conditionValues?: Array<string | number>,
|
|
97
|
+
): Promise<ResultSetHeader> {
|
|
98
|
+
const keys = Object.keys(data);
|
|
99
|
+
const values = Object.values(data);
|
|
100
|
+
|
|
101
|
+
const sql = `UPDATE ${tableName} SET ${keys
|
|
102
|
+
.map((key) => `${key} = ?`)
|
|
103
|
+
.join(', ')} WHERE ${condition}`;
|
|
104
|
+
|
|
105
|
+
const finalValues = [...values, ...(conditionValues || [])];
|
|
106
|
+
return this.executeResult(sql, finalValues);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public async close() {
|
|
110
|
+
await this.pool.end();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
|
|
3
|
+
export interface CustomerParams {
|
|
4
|
+
name: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export type CustomerParamsArray = CustomerParams[];
|
|
8
|
+
|
|
9
|
+
export interface BBPSCustomerBillProviderTable {
|
|
10
|
+
id: number;
|
|
11
|
+
customer_id: number;
|
|
12
|
+
biller_id: string;
|
|
13
|
+
utility_id: number;
|
|
14
|
+
utility_name: string;
|
|
15
|
+
provider_name: string;
|
|
16
|
+
provider_logo: string;
|
|
17
|
+
customer_name: string;
|
|
18
|
+
account_no: number;
|
|
19
|
+
bill_amount: number;
|
|
20
|
+
bill_number: string;
|
|
21
|
+
customer_params: CustomerParamsArray;
|
|
22
|
+
bill_date: Date;
|
|
23
|
+
created_at: Date;
|
|
24
|
+
updated_at: Date;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface BBPSCustomerBillProviderModel extends BBPSCustomerBillProviderTable, RowDataPacket {}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
|
|
3
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
4
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
5
|
+
export type JSONObject = { [member: string]: JSONPrimitive };
|
|
6
|
+
export type JSONArray = Array<JSONValue>;
|
|
7
|
+
|
|
8
|
+
export interface BBPSProvidersTable {
|
|
9
|
+
id: number;
|
|
10
|
+
name: string;
|
|
11
|
+
alias: string;
|
|
12
|
+
logo: string;
|
|
13
|
+
state: string;
|
|
14
|
+
customer_params: JSONValue;
|
|
15
|
+
utilityid: number;
|
|
16
|
+
vendorid: number;
|
|
17
|
+
billerid: string;
|
|
18
|
+
created_at: Date;
|
|
19
|
+
updated_at: Date;
|
|
20
|
+
is_active: number;
|
|
21
|
+
is_deleted: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface BBPSProvidersModel extends BBPSProvidersTable, RowDataPacket {}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
|
|
3
|
+
export interface BBPSTransactionsTable {
|
|
4
|
+
id: number;
|
|
5
|
+
customerid: number;
|
|
6
|
+
utilityid: number;
|
|
7
|
+
providerid: number;
|
|
8
|
+
account: string;
|
|
9
|
+
billamount: number;
|
|
10
|
+
amount: number;
|
|
11
|
+
discount: number;
|
|
12
|
+
promo: string;
|
|
13
|
+
duedate: Date;
|
|
14
|
+
status: string;
|
|
15
|
+
mode: string;
|
|
16
|
+
paymentid: string;
|
|
17
|
+
txnid: string;
|
|
18
|
+
attempted_at: Date;
|
|
19
|
+
paid_at: Date;
|
|
20
|
+
processed_at: Date;
|
|
21
|
+
created_at: Date;
|
|
22
|
+
updated_at: Date;
|
|
23
|
+
is_due: number;
|
|
24
|
+
is_active: number;
|
|
25
|
+
is_deleted: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface BBPSTransactionsModel extends BBPSTransactionsTable, RowDataPacket {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
|
|
3
|
+
export interface BBPSUtilitiesTable {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
logo: string;
|
|
7
|
+
vendorid: number;
|
|
8
|
+
created_at: Date;
|
|
9
|
+
updated_at: Date;
|
|
10
|
+
is_active: number;
|
|
11
|
+
is_deleted: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface BBPSUtilitiesModel extends BBPSUtilitiesTable, RowDataPacket {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
|
|
3
|
+
export interface BBPSVendorsTable {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
created_at: Date;
|
|
7
|
+
updated_at: Date;
|
|
8
|
+
is_active: number;
|
|
9
|
+
is_deleted: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface BBPSVendorsModel extends BBPSVendorsTable, RowDataPacket {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface Rule {
|
|
2
|
+
key: string;
|
|
3
|
+
value: string | number;
|
|
4
|
+
operator: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface Rules {
|
|
8
|
+
data: Rule[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface MetaData {
|
|
12
|
+
icon: string;
|
|
13
|
+
title: string;
|
|
14
|
+
eligibilityCriteria: string;
|
|
15
|
+
steps: string[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Stat {
|
|
19
|
+
count: number;
|
|
20
|
+
total: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = { [member: string]: JSONPrimitive };
|
|
5
|
+
export type JSONArray = Array<JSONValue>;
|
|
6
|
+
|
|
7
|
+
// Interface for the customers table
|
|
8
|
+
export interface CustomerTable {
|
|
9
|
+
id: number;
|
|
10
|
+
mobile: string;
|
|
11
|
+
email?: string | null;
|
|
12
|
+
first_name?: string | null;
|
|
13
|
+
middle_name?: string | null;
|
|
14
|
+
last_name?: string | null;
|
|
15
|
+
father_name?: string | null;
|
|
16
|
+
mother_maiden_name?: string | null;
|
|
17
|
+
dob?: Date | null;
|
|
18
|
+
company_name?: string | null;
|
|
19
|
+
official_email?: string | null;
|
|
20
|
+
pincode?: string | null;
|
|
21
|
+
mpin?: string | null;
|
|
22
|
+
pan?: string | null;
|
|
23
|
+
aadhaar?: string | null;
|
|
24
|
+
mobile_verified?: number | null;
|
|
25
|
+
email_verified?: number | null;
|
|
26
|
+
ip?: string | null;
|
|
27
|
+
device_id?: string | null;
|
|
28
|
+
is_registered?: number | null;
|
|
29
|
+
mobile_hash?: string | null;
|
|
30
|
+
email_hash?: string | null;
|
|
31
|
+
os_version?: string | null;
|
|
32
|
+
push_id?: string | null;
|
|
33
|
+
auth_token?: string | null;
|
|
34
|
+
app_version?: string | null;
|
|
35
|
+
biometric_enabled?: number | null;
|
|
36
|
+
journey_sequence?: number | null;
|
|
37
|
+
category?: string | null;
|
|
38
|
+
loc_limit?: number | null;
|
|
39
|
+
/** Defaults to: active. */
|
|
40
|
+
status?: 'active' | 'inactive' | null;
|
|
41
|
+
source?: string | null;
|
|
42
|
+
tnc_version?: string | null;
|
|
43
|
+
login_date?: Date | null;
|
|
44
|
+
min_tenure?: number | null;
|
|
45
|
+
max_tenure?: number | null;
|
|
46
|
+
roi?: number | null;
|
|
47
|
+
processing_rate?: number | null;
|
|
48
|
+
agent_id?: number | null;
|
|
49
|
+
/** Defaults to: new */
|
|
50
|
+
application_type?: string | null;
|
|
51
|
+
/** Defaults to: incomplete */
|
|
52
|
+
application_status?: string | null;
|
|
53
|
+
/** Defaults to: organic */
|
|
54
|
+
customer_type?: string | null;
|
|
55
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
56
|
+
created_at?: Date | null;
|
|
57
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
58
|
+
updated_at?: Date | null;
|
|
59
|
+
/** Defaults to: 1. */
|
|
60
|
+
is_active?: number | null;
|
|
61
|
+
/** Defaults to: 0. */
|
|
62
|
+
is_deleted?: number | null;
|
|
63
|
+
journey_updated_at?: Date | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Interface for the demographics table
|
|
67
|
+
export interface DemographicsTable {
|
|
68
|
+
id?: number;
|
|
69
|
+
customer_id: number;
|
|
70
|
+
aadhaar_name?: string | null;
|
|
71
|
+
crn?: string | null;
|
|
72
|
+
device?: JSONValue | null;
|
|
73
|
+
gender?: string | null;
|
|
74
|
+
gst_no?: string | null;
|
|
75
|
+
language?: string | null;
|
|
76
|
+
latitude?: number | null;
|
|
77
|
+
longitude?: number | null;
|
|
78
|
+
marital_status?: string | null;
|
|
79
|
+
occupation?: string | null;
|
|
80
|
+
office_addr?: JSONValue | null;
|
|
81
|
+
organization?: string | null;
|
|
82
|
+
pan_url?: string | null;
|
|
83
|
+
perm_addr?: JSONValue | null;
|
|
84
|
+
res_addr?: JSONValue | null;
|
|
85
|
+
salary?: number | null;
|
|
86
|
+
salary_date?: Date | null;
|
|
87
|
+
salary_mode?: string | null;
|
|
88
|
+
selfie_url?: string | null;
|
|
89
|
+
kyc_type?: string | null;
|
|
90
|
+
emi_date?: Date | null;
|
|
91
|
+
phone_matched?: number | null;
|
|
92
|
+
dob_matched?: number | null;
|
|
93
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
94
|
+
created_at?: Date | null;
|
|
95
|
+
updated_at?: Date | null;
|
|
96
|
+
nsdl_dob_matched?: number | null;
|
|
97
|
+
okyc_dob?: string | null;
|
|
98
|
+
dob_attempts?: number | null;
|
|
99
|
+
is_upgradable?: number | null;
|
|
100
|
+
has_imps?: number | null;
|
|
101
|
+
journey_inactive?: number | null;
|
|
102
|
+
repeat_journey?: number | null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface CustomerBanksTable {
|
|
106
|
+
id?: number;
|
|
107
|
+
customer_id: number;
|
|
108
|
+
account_number: string;
|
|
109
|
+
address?: string | null;
|
|
110
|
+
bank_name?: string | null;
|
|
111
|
+
ifsc_code?: string | null;
|
|
112
|
+
/** Defaults to: active. */
|
|
113
|
+
status?: 'active' | 'inactive';
|
|
114
|
+
is_primary?: boolean;
|
|
115
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
116
|
+
created_at?: Date | null;
|
|
117
|
+
updated_at?: Date | null;
|
|
118
|
+
}
|
|
119
|
+
export interface CustomerReferenceTable {
|
|
120
|
+
id: number;
|
|
121
|
+
customer_id: number;
|
|
122
|
+
reference_name: string;
|
|
123
|
+
relationship: 'Family' | 'Friend' | 'Colleague' | 'Other';
|
|
124
|
+
mobile_number: string;
|
|
125
|
+
email?: string;
|
|
126
|
+
address: string;
|
|
127
|
+
state_id: number;
|
|
128
|
+
city_id: number;
|
|
129
|
+
pincode: string;
|
|
130
|
+
created_at?: Date | null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface CustomerDocumentsTable {
|
|
134
|
+
id?: number;
|
|
135
|
+
customer_id?: number | null;
|
|
136
|
+
pan_url?: string | null;
|
|
137
|
+
aadhaar_url?: string | null;
|
|
138
|
+
address_proof_url?: string | null;
|
|
139
|
+
created_at?: Date | null;
|
|
140
|
+
updated_at?: Date | null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Interface for the customer_device_history table
|
|
144
|
+
export interface CustomerDeviceHistoryTable {
|
|
145
|
+
id: number;
|
|
146
|
+
customer_id: number;
|
|
147
|
+
device?: string | null;
|
|
148
|
+
device_id: string;
|
|
149
|
+
ip?: string | null;
|
|
150
|
+
os_version?: string | null;
|
|
151
|
+
push_id?: string | null;
|
|
152
|
+
app_version?: string | null;
|
|
153
|
+
is_rooted?: boolean;
|
|
154
|
+
created_at?: Date | null;
|
|
155
|
+
updated_at?: Date | null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// MySQL-specific interfaces extending RowDataPacket
|
|
159
|
+
export interface CustomerModel extends CustomerTable, RowDataPacket { }
|
|
160
|
+
export interface CustomerBanksModel extends CustomerBanksTable, RowDataPacket { }
|
|
161
|
+
export interface CustomerDocumentsModel
|
|
162
|
+
extends CustomerDocumentsTable,
|
|
163
|
+
RowDataPacket { }
|
|
164
|
+
export interface DemographicsModel extends DemographicsTable, RowDataPacket { }
|
|
165
|
+
export interface CustomerReferenceModel
|
|
166
|
+
extends CustomerReferenceTable,
|
|
167
|
+
RowDataPacket { }
|
|
168
|
+
|
|
169
|
+
export interface CustomerDeviceHistoryModel extends CustomerDeviceHistoryTable, RowDataPacket {}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = { [member: string]: JSONPrimitive };
|
|
5
|
+
export type JSONArray = Array<JSONValue>;
|
|
6
|
+
|
|
7
|
+
export interface DashboardBlock {
|
|
8
|
+
block_name: string;
|
|
9
|
+
block_title: string;
|
|
10
|
+
block_code: string;
|
|
11
|
+
text: string;
|
|
12
|
+
sub_text: string;
|
|
13
|
+
image_url: string;
|
|
14
|
+
video_url?: string;
|
|
15
|
+
video_length?: number;
|
|
16
|
+
action_url?: string;
|
|
17
|
+
landing_page?: string;
|
|
18
|
+
api_mode?: string;
|
|
19
|
+
app_version: string;
|
|
20
|
+
old_customers: boolean;
|
|
21
|
+
is_new?: boolean;
|
|
22
|
+
action_type?: string;
|
|
23
|
+
color1?: string;
|
|
24
|
+
color2?: string;
|
|
25
|
+
image_trailing?: string;
|
|
26
|
+
tag?: JSONValue ;
|
|
27
|
+
overlay_image?: string;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export interface DashboardBlockModel extends DashboardBlock, RowDataPacket {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = { [member: string]: JSONPrimitive };
|
|
5
|
+
export type JSONArray = Array<JSONValue>;
|
|
6
|
+
|
|
7
|
+
// Interface for the Installments table
|
|
8
|
+
export interface InstallmentsTable {
|
|
9
|
+
id?: number | null;
|
|
10
|
+
customer_id: number | null;
|
|
11
|
+
loan_id?: number | null;
|
|
12
|
+
seq_no: number | null;
|
|
13
|
+
amount?: number | null;
|
|
14
|
+
principal?: number | null;
|
|
15
|
+
interest?: number | null;
|
|
16
|
+
penalty?: number | null;
|
|
17
|
+
r_principal?: number | null;
|
|
18
|
+
r_interest?: number | null;
|
|
19
|
+
r_penalty?: number | null;
|
|
20
|
+
r_pif_principal?: number | null;
|
|
21
|
+
r_pif_interest?: number | null;
|
|
22
|
+
r_pif_penalty?: number | null;
|
|
23
|
+
status?: 'active' | 'closed' | 'delayed' | 'paid' | 'future' | null;
|
|
24
|
+
dpd?: number | null;
|
|
25
|
+
due_date?: Date | null;
|
|
26
|
+
discount?: number | null;
|
|
27
|
+
starting_balance?: number | null;
|
|
28
|
+
ending_balance?: number | null;
|
|
29
|
+
closed_at?: Date | null;
|
|
30
|
+
created_at?: Date | null;
|
|
31
|
+
updated_at?: Date | null;
|
|
32
|
+
is_active?: number | null;
|
|
33
|
+
is_deleted?: number | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// MySQL-specific interfaces extending RowDataPacket
|
|
37
|
+
export interface InstallmentsModel extends InstallmentsTable, RowDataPacket {}
|