@meridianjs/user 0.1.8 → 0.1.9
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 +11 -0
- package/dist/index.mjs +11 -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
|
@@ -112,6 +112,17 @@ var UserModuleService = class extends (0, import_framework_utils4.MeridianServic
|
|
|
112
112
|
async deactivateUser(userId) {
|
|
113
113
|
return this.updateUser(userId, { is_active: false });
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Restore a soft-deleted user account.
|
|
117
|
+
* Bypasses UPDATE_RESERVED to clear deleted_at directly via the repository.
|
|
118
|
+
*/
|
|
119
|
+
async restoreUser(userId, data = {}) {
|
|
120
|
+
const repo = this.container.resolve("userRepository");
|
|
121
|
+
const user = await repo.findOneOrFail({ id: userId });
|
|
122
|
+
Object.assign(user, { ...data, deleted_at: null, is_active: true });
|
|
123
|
+
await repo.flush();
|
|
124
|
+
return user;
|
|
125
|
+
}
|
|
115
126
|
/** Return the total number of registered users. */
|
|
116
127
|
async countUsers() {
|
|
117
128
|
const userRepository = this.container.resolve("userRepository");
|
package/dist/index.mjs
CHANGED
|
@@ -86,6 +86,17 @@ var UserModuleService = class extends MeridianService({ User: user_default, Team
|
|
|
86
86
|
async deactivateUser(userId) {
|
|
87
87
|
return this.updateUser(userId, { is_active: false });
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Restore a soft-deleted user account.
|
|
91
|
+
* Bypasses UPDATE_RESERVED to clear deleted_at directly via the repository.
|
|
92
|
+
*/
|
|
93
|
+
async restoreUser(userId, data = {}) {
|
|
94
|
+
const repo = this.container.resolve("userRepository");
|
|
95
|
+
const user = await repo.findOneOrFail({ id: userId });
|
|
96
|
+
Object.assign(user, { ...data, deleted_at: null, is_active: true });
|
|
97
|
+
await repo.flush();
|
|
98
|
+
return user;
|
|
99
|
+
}
|
|
89
100
|
/** Return the total number of registered users. */
|
|
90
101
|
async countUsers() {
|
|
91
102
|
const userRepository = this.container.resolve("userRepository");
|