@meridianjs/user 0.1.6 → 0.1.8

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/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # @meridianjs/user
2
+
3
+ User, Team, and session management module for MeridianJS. Provides the `User` and `Team` data models, auto-generated CRUD, and custom helpers for email/Google ID lookups, login tracking, and session management.
4
+
5
+ Auto-loaded by `@meridianjs/meridian` — you do not need to add this to `modules[]` yourself.
6
+
7
+ ## Service: `userModuleService`
8
+
9
+ Resolve from the DI container in a route handler:
10
+
11
+ ```typescript
12
+ const svc = req.scope.resolve("userModuleService") as any
13
+ ```
14
+
15
+ ### Auto-generated CRUD
16
+
17
+ ```typescript
18
+ // Users
19
+ await svc.listUsers(filters?, options?)
20
+ await svc.listAndCountUsers(filters?, options?)
21
+ await svc.retrieveUser(id)
22
+ await svc.createUser(data)
23
+ await svc.updateUser(id, data)
24
+ await svc.deleteUser(id)
25
+ await svc.softDeleteUser(id)
26
+
27
+ // Teams
28
+ await svc.listTeams(filters?, options?)
29
+ await svc.retrieveTeam(id)
30
+ await svc.createTeam(data)
31
+ await svc.updateTeam(id, data)
32
+ await svc.deleteTeam(id)
33
+ ```
34
+
35
+ ### Custom Methods
36
+
37
+ ```typescript
38
+ // Find a user by email address (returns null if not found)
39
+ const user = await svc.retrieveUserByEmail("alice@example.com")
40
+
41
+ // Find a user by their Google OAuth ID
42
+ const user = await svc.retrieveUserByGoogleId(googleId)
43
+
44
+ // Update last_login_at timestamp
45
+ await svc.recordLogin(userId)
46
+
47
+ // Deactivate an account (sets is_active: false)
48
+ await svc.deactivateUser(userId)
49
+
50
+ // Total registered user count
51
+ const count = await svc.countUsers()
52
+
53
+ // Session management (for JWT revocation)
54
+ await svc.createSession(jti, userId, expiresAt)
55
+ await svc.retrieveValidSession(jti)
56
+ await svc.revokeSession(jti)
57
+ ```
58
+
59
+ ## Data Models
60
+
61
+ ### User
62
+
63
+ | Field | Type | Description |
64
+ |---|---|---|
65
+ | `id` | `uuid` | Primary key |
66
+ | `email` | `text` | Unique email address |
67
+ | `password_hash` | `text` | bcrypt hash (nullable for OAuth users) |
68
+ | `first_name` | `text` | — |
69
+ | `last_name` | `text` | — |
70
+ | `google_id` | `text` | Google OAuth ID (nullable) |
71
+ | `picture` | `text` | Profile picture URL (nullable) |
72
+ | `is_active` | `boolean` | Account active flag |
73
+ | `last_login_at` | `datetime` | Last successful login |
74
+ | `app_role_id` | `text` | Optional custom RBAC role |
75
+ | `created_at` | `datetime` | — |
76
+ | `updated_at` | `datetime` | — |
77
+
78
+ ### Team
79
+
80
+ | Field | Type | Description |
81
+ |---|---|---|
82
+ | `id` | `uuid` | Primary key |
83
+ | `name` | `text` | Team name |
84
+ | `workspace_id` | `text` | Owning workspace |
85
+ | `created_at` | `datetime` | — |
86
+
87
+ ## License
88
+
89
+ MIT
package/dist/index.js CHANGED
@@ -39,6 +39,8 @@ var User = import_framework_utils.model.define("user", {
39
39
  first_name: import_framework_utils.model.text().nullable(),
40
40
  last_name: import_framework_utils.model.text().nullable(),
41
41
  avatar_url: import_framework_utils.model.text().nullable(),
42
+ designation: import_framework_utils.model.text().nullable(),
43
+ phone_number: import_framework_utils.model.text().nullable(),
42
44
  role: import_framework_utils.model.enum(["super-admin", "admin", "moderator", "member"]).default("member"),
43
45
  is_active: import_framework_utils.model.boolean().default(true),
44
46
  last_login_at: import_framework_utils.model.date().nullable(),
package/dist/index.mjs CHANGED
@@ -13,6 +13,8 @@ var User = model.define("user", {
13
13
  first_name: model.text().nullable(),
14
14
  last_name: model.text().nullable(),
15
15
  avatar_url: model.text().nullable(),
16
+ designation: model.text().nullable(),
17
+ phone_number: model.text().nullable(),
16
18
  role: model.enum(["super-admin", "admin", "moderator", "member"]).default("member"),
17
19
  is_active: model.boolean().default(true),
18
20
  last_login_at: model.date().nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meridianjs/user",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Meridian user module — User and Team domain models",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",