@meridianjs/user 0.1.8 → 0.1.10
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/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +12 -0
- package/dist/index.mjs +12 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,11 @@ declare class UserModuleService extends UserModuleService_base {
|
|
|
13
13
|
recordLogin(userId: string): Promise<void>;
|
|
14
14
|
/** Deactivate a user account. */
|
|
15
15
|
deactivateUser(userId: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Restore a soft-deleted user account.
|
|
18
|
+
* Bypasses UPDATE_RESERVED to clear deleted_at directly via the repository.
|
|
19
|
+
*/
|
|
20
|
+
restoreUser(userId: string, data?: Record<string, unknown>): Promise<any>;
|
|
16
21
|
/** Return the total number of registered users. */
|
|
17
22
|
countUsers(): Promise<number>;
|
|
18
23
|
/** Store a new session record when a token is issued. */
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ declare class UserModuleService extends UserModuleService_base {
|
|
|
13
13
|
recordLogin(userId: string): Promise<void>;
|
|
14
14
|
/** Deactivate a user account. */
|
|
15
15
|
deactivateUser(userId: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Restore a soft-deleted user account.
|
|
18
|
+
* Bypasses UPDATE_RESERVED to clear deleted_at directly via the repository.
|
|
19
|
+
*/
|
|
20
|
+
restoreUser(userId: string, data?: Record<string, unknown>): Promise<any>;
|
|
16
21
|
/** Return the total number of registered users. */
|
|
17
22
|
countUsers(): Promise<number>;
|
|
18
23
|
/** Store a new session record when a token is issued. */
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ var User = import_framework_utils.model.define("user", {
|
|
|
46
46
|
last_login_at: import_framework_utils.model.date().nullable(),
|
|
47
47
|
app_role_id: import_framework_utils.model.text().nullable(),
|
|
48
48
|
metadata: import_framework_utils.model.json().nullable(),
|
|
49
|
+
has_password: import_framework_utils.model.boolean().default(true),
|
|
49
50
|
google_id: import_framework_utils.model.text().nullable()
|
|
50
51
|
}, [
|
|
51
52
|
{ columns: ["email"], unique: true },
|
|
@@ -112,6 +113,17 @@ var UserModuleService = class extends (0, import_framework_utils4.MeridianServic
|
|
|
112
113
|
async deactivateUser(userId) {
|
|
113
114
|
return this.updateUser(userId, { is_active: false });
|
|
114
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Restore a soft-deleted user account.
|
|
118
|
+
* Bypasses UPDATE_RESERVED to clear deleted_at directly via the repository.
|
|
119
|
+
*/
|
|
120
|
+
async restoreUser(userId, data = {}) {
|
|
121
|
+
const repo = this.container.resolve("userRepository");
|
|
122
|
+
const user = await repo.findOneOrFail({ id: userId });
|
|
123
|
+
Object.assign(user, { ...data, deleted_at: null, is_active: true });
|
|
124
|
+
await repo.flush();
|
|
125
|
+
return user;
|
|
126
|
+
}
|
|
115
127
|
/** Return the total number of registered users. */
|
|
116
128
|
async countUsers() {
|
|
117
129
|
const userRepository = this.container.resolve("userRepository");
|
package/dist/index.mjs
CHANGED
|
@@ -20,6 +20,7 @@ var User = model.define("user", {
|
|
|
20
20
|
last_login_at: model.date().nullable(),
|
|
21
21
|
app_role_id: model.text().nullable(),
|
|
22
22
|
metadata: model.json().nullable(),
|
|
23
|
+
has_password: model.boolean().default(true),
|
|
23
24
|
google_id: model.text().nullable()
|
|
24
25
|
}, [
|
|
25
26
|
{ columns: ["email"], unique: true },
|
|
@@ -86,6 +87,17 @@ var UserModuleService = class extends MeridianService({ User: user_default, Team
|
|
|
86
87
|
async deactivateUser(userId) {
|
|
87
88
|
return this.updateUser(userId, { is_active: false });
|
|
88
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Restore a soft-deleted user account.
|
|
92
|
+
* Bypasses UPDATE_RESERVED to clear deleted_at directly via the repository.
|
|
93
|
+
*/
|
|
94
|
+
async restoreUser(userId, data = {}) {
|
|
95
|
+
const repo = this.container.resolve("userRepository");
|
|
96
|
+
const user = await repo.findOneOrFail({ id: userId });
|
|
97
|
+
Object.assign(user, { ...data, deleted_at: null, is_active: true });
|
|
98
|
+
await repo.flush();
|
|
99
|
+
return user;
|
|
100
|
+
}
|
|
89
101
|
/** Return the total number of registered users. */
|
|
90
102
|
async countUsers() {
|
|
91
103
|
const userRepository = this.container.resolve("userRepository");
|