@stashfin/mysql2 1.2.0 → 1.2.2
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 +3 -1
- package/models/Customer.d.ts +45 -20
- package/models/UserAuthToken.d.ts +1 -1
- package/models/UserDetails.d.ts +1 -1
- package/models/WealthUser.d.ts +1 -1
- 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): Promise<ResultSetHeader>;
|
|
16
16
|
close(): Promise<void>;
|
|
17
17
|
}
|
package/index.js
CHANGED
|
@@ -54,7 +54,9 @@ class MysqlConnector {
|
|
|
54
54
|
.join(', ')})`;
|
|
55
55
|
return this.executeResult(sql, values);
|
|
56
56
|
}
|
|
57
|
-
async updateData(tableName,
|
|
57
|
+
async updateData(tableName,
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
data, condition) {
|
|
58
60
|
const keys = Object.keys(data);
|
|
59
61
|
const values = Object.values(data);
|
|
60
62
|
const sql = `UPDATE ${tableName} SET ${keys
|
package/models/Customer.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
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
9
|
id?: number;
|
|
4
10
|
mobile: string;
|
|
@@ -38,28 +44,47 @@ export interface CustomerTable {
|
|
|
38
44
|
}
|
|
39
45
|
export interface DemographicsTable {
|
|
40
46
|
id?: number;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
customer_id: number;
|
|
48
|
+
aadhaar_name?: string | null;
|
|
49
|
+
crn?: string | null;
|
|
50
|
+
device?: JSONValue | null;
|
|
51
|
+
gender?: string | null;
|
|
52
|
+
gst_no?: string | null;
|
|
53
|
+
language?: string | null;
|
|
54
|
+
latitude?: number | null;
|
|
55
|
+
longitude?: number | null;
|
|
56
|
+
marital_status?: string | null;
|
|
57
|
+
occupation?: string | null;
|
|
58
|
+
office_addr?: JSONValue | null;
|
|
59
|
+
organization_id?: number | null;
|
|
60
|
+
pan_url?: string | null;
|
|
61
|
+
perm_addr?: JSONValue | null;
|
|
62
|
+
res_addr?: JSONValue | null;
|
|
63
|
+
salary?: number | null;
|
|
64
|
+
salary_date?: Date | null;
|
|
65
|
+
salary_mode?: string | null;
|
|
66
|
+
selfie_url?: string | null;
|
|
67
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
68
|
+
created_at?: Date | null;
|
|
69
|
+
updated_at?: Date | null;
|
|
70
|
+
}
|
|
71
|
+
export interface CustomerBanksTable {
|
|
72
|
+
id?: number;
|
|
73
|
+
customer_id: number;
|
|
74
|
+
account_number: string;
|
|
75
|
+
address?: string | null;
|
|
76
|
+
bank_name?: string | null;
|
|
77
|
+
ifsc_code?: string | null;
|
|
78
|
+
/** Defaults to: active. */
|
|
79
|
+
status?: 'active' | 'inactive';
|
|
80
|
+
is_primary?: boolean;
|
|
81
|
+
/** Defaults to: CURRENT_TIMESTAMP. */
|
|
82
|
+
created_at?: Date | null;
|
|
83
|
+
updated_at?: Date | null;
|
|
61
84
|
}
|
|
62
85
|
export interface CustomerModel extends CustomerTable, RowDataPacket {
|
|
63
86
|
}
|
|
87
|
+
export interface CustomerBanksModel extends CustomerBanksTable, RowDataPacket {
|
|
88
|
+
}
|
|
64
89
|
export interface DemographicsModel extends DemographicsTable, RowDataPacket {
|
|
65
90
|
}
|
package/models/UserDetails.d.ts
CHANGED
package/models/WealthUser.d.ts
CHANGED