@meridianjs/user 0.1.4 → 0.1.6

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 CHANGED
@@ -7,6 +7,8 @@ declare class UserModuleService extends UserModuleService_base {
7
7
  constructor(container: MeridianContainer);
8
8
  /** Find a user by email. Returns null if not found. */
9
9
  retrieveUserByEmail(email: string): Promise<any | null>;
10
+ /** Find a user by Google ID. Returns null if not found. */
11
+ retrieveUserByGoogleId(googleId: string): Promise<any | null>;
10
12
  /** Update user's last login timestamp. */
11
13
  recordLogin(userId: string): Promise<void>;
12
14
  /** Deactivate a user account. */
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ declare class UserModuleService extends UserModuleService_base {
7
7
  constructor(container: MeridianContainer);
8
8
  /** Find a user by email. Returns null if not found. */
9
9
  retrieveUserByEmail(email: string): Promise<any | null>;
10
+ /** Find a user by Google ID. Returns null if not found. */
11
+ retrieveUserByGoogleId(googleId: string): Promise<any | null>;
10
12
  /** Update user's last login timestamp. */
11
13
  recordLogin(userId: string): Promise<void>;
12
14
  /** Deactivate a user account. */
package/dist/index.js CHANGED
@@ -43,9 +43,11 @@ var User = import_framework_utils.model.define("user", {
43
43
  is_active: import_framework_utils.model.boolean().default(true),
44
44
  last_login_at: import_framework_utils.model.date().nullable(),
45
45
  app_role_id: import_framework_utils.model.text().nullable(),
46
- metadata: import_framework_utils.model.json().nullable()
46
+ metadata: import_framework_utils.model.json().nullable(),
47
+ google_id: import_framework_utils.model.text().nullable()
47
48
  }, [
48
- { columns: ["email"], unique: true }
49
+ { columns: ["email"], unique: true },
50
+ { columns: ["google_id"] }
49
51
  ]);
50
52
  var user_default = User;
51
53
 
@@ -91,6 +93,15 @@ var UserModuleService = class extends (0, import_framework_utils4.MeridianServic
91
93
  return null;
92
94
  }
93
95
  }
96
+ /** Find a user by Google ID. Returns null if not found. */
97
+ async retrieveUserByGoogleId(googleId) {
98
+ const userRepository = this.container.resolve("userRepository");
99
+ try {
100
+ return await userRepository.findOneOrFail({ google_id: googleId });
101
+ } catch {
102
+ return null;
103
+ }
104
+ }
94
105
  /** Update user's last login timestamp. */
95
106
  async recordLogin(userId) {
96
107
  await this.updateUser(userId, { last_login_at: /* @__PURE__ */ new Date() });
package/dist/index.mjs CHANGED
@@ -17,9 +17,11 @@ var User = model.define("user", {
17
17
  is_active: model.boolean().default(true),
18
18
  last_login_at: model.date().nullable(),
19
19
  app_role_id: model.text().nullable(),
20
- metadata: model.json().nullable()
20
+ metadata: model.json().nullable(),
21
+ google_id: model.text().nullable()
21
22
  }, [
22
- { columns: ["email"], unique: true }
23
+ { columns: ["email"], unique: true },
24
+ { columns: ["google_id"] }
23
25
  ]);
24
26
  var user_default = User;
25
27
 
@@ -65,6 +67,15 @@ var UserModuleService = class extends MeridianService({ User: user_default, Team
65
67
  return null;
66
68
  }
67
69
  }
70
+ /** Find a user by Google ID. Returns null if not found. */
71
+ async retrieveUserByGoogleId(googleId) {
72
+ const userRepository = this.container.resolve("userRepository");
73
+ try {
74
+ return await userRepository.findOneOrFail({ google_id: googleId });
75
+ } catch {
76
+ return null;
77
+ }
78
+ }
68
79
  /** Update user's last login timestamp. */
69
80
  async recordLogin(userId) {
70
81
  await this.updateUser(userId, { last_login_at: /* @__PURE__ */ new Date() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meridianjs/user",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Meridian user module — User and Team domain models",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",