@stashfin/mysql2 1.2.5 → 1.4.0
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/index.d.ts +1 -1
- package/index.js +5 -2
- package/models/Customer.d.ts +84 -54
- package/models/UserAuthToken.d.ts +1 -1
- package/models/UserDetails.d.ts +0 -20
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export declare class MysqlConnector {
|
|
|
12
12
|
queryArray<T extends RowDataPacket>(sql: string, values?: Array<string | number>): Promise<T[]>;
|
|
13
13
|
executeResult(sql: string, values?: unknown[]): Promise<ResultSetHeader>;
|
|
14
14
|
insertData(tableName: string, data: Record<string, string | number>): Promise<ResultSetHeader>;
|
|
15
|
-
updateData(tableName: string, data: Record<string,
|
|
15
|
+
updateData(tableName: string, data: Record<string, any>, condition: string, conditionValues?: Array<string | number>): Promise<ResultSetHeader>;
|
|
16
16
|
close(): Promise<void>;
|
|
17
17
|
}
|
package/index.js
CHANGED
|
@@ -55,13 +55,16 @@ class MysqlConnector {
|
|
|
55
55
|
.join(', ')})`;
|
|
56
56
|
return this.executeResult(sql, values);
|
|
57
57
|
}
|
|
58
|
-
async updateData(tableName,
|
|
58
|
+
async updateData(tableName,
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
data, condition, conditionValues) {
|
|
59
61
|
const keys = Object.keys(data);
|
|
60
62
|
const values = Object.values(data);
|
|
61
63
|
const sql = `UPDATE ${tableName} SET ${keys
|
|
62
64
|
.map((key) => `${key} = ?`)
|
|
63
65
|
.join(', ')} WHERE ${condition}`;
|
|
64
|
-
|
|
66
|
+
const finalValues = [...values, ...(conditionValues || [])];
|
|
67
|
+
return this.executeResult(sql, finalValues);
|
|
65
68
|
}
|
|
66
69
|
async close() {
|
|
67
70
|
await this.pool.end();
|
package/models/Customer.d.ts
CHANGED
|
@@ -1,65 +1,95 @@
|
|
|
1
1
|
import { RowDataPacket } from 'mysql2';
|
|
2
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JSONValue = JSONObject | JSONArray;
|
|
4
|
+
export type JSONObject = {
|
|
5
|
+
[member: string]: JSONPrimitive;
|
|
6
|
+
};
|
|
7
|
+
export type JSONArray = Array<JSONValue>;
|
|
2
8
|
export interface CustomerTable {
|
|
3
|
-
id
|
|
9
|
+
id: number;
|
|
4
10
|
mobile: string;
|
|
5
|
-
email?: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
dob?:
|
|
12
|
-
|
|
13
|
-
pincode?: string;
|
|
14
|
-
mpin?: string;
|
|
15
|
-
pan?: string;
|
|
16
|
-
aadhaar?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ip?: string;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
category?: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
pincode?: string | null;
|
|
20
|
+
mpin?: string | null;
|
|
21
|
+
pan?: string | null;
|
|
22
|
+
aadhaar?: string | null;
|
|
23
|
+
mobile_verified?: number | null;
|
|
24
|
+
email_verified?: number | null;
|
|
25
|
+
ip?: string | null;
|
|
26
|
+
device_id?: string | null;
|
|
27
|
+
os_version?: string | null;
|
|
28
|
+
push_id?: string | null;
|
|
29
|
+
auth_token?: string | null;
|
|
30
|
+
app_version?: string | null;
|
|
31
|
+
biometric_enabled?: number | null;
|
|
32
|
+
journey_step?: number | null;
|
|
33
|
+
category?: string | null;
|
|
34
|
+
loc_limit?: number | null;
|
|
35
|
+
/** Defaults to: active. */
|
|
36
|
+
status?: 'active' | 'inactive' | null;
|
|
37
|
+
source?: string | null;
|
|
38
|
+
tnc_version?: string | null;
|
|
39
|
+
login_date?: Date | null;
|
|
40
|
+
agent_id?: number | null;
|
|
41
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
42
|
+
created_at?: Date | null;
|
|
43
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
44
|
+
updated_at?: Date | null;
|
|
45
|
+
/** Defaults to: 1. */
|
|
46
|
+
is_active?: number | null;
|
|
47
|
+
/** Defaults to: 0. */
|
|
48
|
+
is_deleted?: number | null;
|
|
38
49
|
}
|
|
39
50
|
export interface DemographicsTable {
|
|
40
51
|
id?: number;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
customer_id: number;
|
|
53
|
+
aadhaar_name?: string | null;
|
|
54
|
+
crn?: string | null;
|
|
55
|
+
device?: JSONValue | null;
|
|
56
|
+
gender?: string | null;
|
|
57
|
+
gst_no?: string | null;
|
|
58
|
+
language?: string | null;
|
|
59
|
+
latitude?: number | null;
|
|
60
|
+
longitude?: number | null;
|
|
61
|
+
marital_status?: string | null;
|
|
62
|
+
occupation?: string | null;
|
|
63
|
+
office_addr?: JSONValue | null;
|
|
64
|
+
organization_id?: number | null;
|
|
65
|
+
pan_url?: string | null;
|
|
66
|
+
perm_addr?: JSONValue | null;
|
|
67
|
+
res_addr?: JSONValue | null;
|
|
68
|
+
salary?: number | null;
|
|
69
|
+
salary_date?: Date | null;
|
|
70
|
+
salary_mode?: string | null;
|
|
71
|
+
selfie_url?: string | null;
|
|
72
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
73
|
+
created_at?: Date | null;
|
|
74
|
+
updated_at?: Date | null;
|
|
75
|
+
}
|
|
76
|
+
export interface CustomerBanksTable {
|
|
77
|
+
id?: number;
|
|
78
|
+
customer_id: number;
|
|
79
|
+
account_number: string;
|
|
80
|
+
address?: string | null;
|
|
81
|
+
bank_name?: string | null;
|
|
82
|
+
ifsc_code?: string | null;
|
|
83
|
+
/** Defaults to: active. */
|
|
84
|
+
status?: 'active' | 'inactive';
|
|
85
|
+
is_primary?: boolean;
|
|
86
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
87
|
+
created_at?: Date | null;
|
|
88
|
+
updated_at?: Date | null;
|
|
61
89
|
}
|
|
62
90
|
export interface CustomerModel extends CustomerTable, RowDataPacket {
|
|
63
91
|
}
|
|
92
|
+
export interface CustomerBanksModel extends CustomerBanksTable, RowDataPacket {
|
|
93
|
+
}
|
|
64
94
|
export interface DemographicsModel extends DemographicsTable, RowDataPacket {
|
|
65
95
|
}
|
package/models/UserDetails.d.ts
CHANGED
|
@@ -7,25 +7,5 @@ export interface UserDetailTable {
|
|
|
7
7
|
email: string;
|
|
8
8
|
phone: string;
|
|
9
9
|
}
|
|
10
|
-
export interface UserKYCBankTable {
|
|
11
|
-
customer_id: number;
|
|
12
|
-
account_no: number;
|
|
13
|
-
ifsc_code: number;
|
|
14
|
-
}
|
|
15
|
-
export interface KYCPanTable {
|
|
16
|
-
pan_numeber: number;
|
|
17
|
-
customer_id: number;
|
|
18
|
-
is_active: number;
|
|
19
|
-
}
|
|
20
|
-
export interface KYCPanFileTable {
|
|
21
|
-
pan_proof: string;
|
|
22
|
-
user_id: number;
|
|
23
|
-
}
|
|
24
|
-
export interface UserKYCBankModel extends UserKYCBankTable, RowDataPacket {
|
|
25
|
-
}
|
|
26
|
-
export interface UserKYCPanModel extends KYCPanTable, RowDataPacket {
|
|
27
|
-
}
|
|
28
|
-
export interface UserKYCPanFileModel extends KYCPanFileTable, RowDataPacket {
|
|
29
|
-
}
|
|
30
10
|
export interface UserDetailModel extends UserDetailTable, RowDataPacket {
|
|
31
11
|
}
|