@temboplus/afloat 0.1.44 → 0.1.46
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/esm/src/features/admin/contract.d.ts +74 -8
- package/esm/src/features/admin/contract.d.ts.map +1 -1
- package/esm/src/features/admin/contract.js +2 -6
- package/esm/src/features/admin/repository.d.ts +3 -3
- package/esm/src/features/admin/repository.d.ts.map +1 -1
- package/esm/src/features/admin/repository.js +7 -10
- package/esm/src/features/admin/schemas.d.ts +25 -0
- package/esm/src/features/admin/schemas.d.ts.map +1 -1
- package/esm/src/features/admin/schemas.js +32 -0
- package/package.json +1 -1
- package/script/src/features/admin/contract.d.ts +74 -8
- package/script/src/features/admin/contract.d.ts.map +1 -1
- package/script/src/features/admin/contract.js +2 -6
- package/script/src/features/admin/repository.d.ts +3 -3
- package/script/src/features/admin/repository.d.ts.map +1 -1
- package/script/src/features/admin/repository.js +7 -10
- package/script/src/features/admin/schemas.d.ts +25 -0
- package/script/src/features/admin/schemas.d.ts.map +1 -1
- package/script/src/features/admin/schemas.js +32 -0
|
@@ -3,11 +3,44 @@ export declare const userManagementContract: {
|
|
|
3
3
|
getUsers: {
|
|
4
4
|
description: "Retrieve a list of all user accounts in the system";
|
|
5
5
|
query: z.ZodObject<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
id: z.ZodOptional<z.ZodString>;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
identity: z.ZodOptional<z.ZodString>;
|
|
9
|
+
type: z.ZodOptional<z.ZodString>;
|
|
10
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
resetPassword: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
isArchived: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
16
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
17
|
+
eager: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
19
|
+
type?: string | undefined;
|
|
20
|
+
id?: string | undefined;
|
|
21
|
+
resetPassword?: boolean | undefined;
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
identity?: string | undefined;
|
|
24
|
+
profileId?: string | undefined;
|
|
25
|
+
createdAt?: string | undefined;
|
|
26
|
+
updatedAt?: string | undefined;
|
|
27
|
+
eager?: string | undefined;
|
|
28
|
+
roleId?: string | undefined;
|
|
29
|
+
isActive?: boolean | undefined;
|
|
30
|
+
isArchived?: boolean | undefined;
|
|
9
31
|
}, {
|
|
10
|
-
|
|
32
|
+
type?: string | undefined;
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
resetPassword?: boolean | undefined;
|
|
35
|
+
name?: string | undefined;
|
|
36
|
+
identity?: string | undefined;
|
|
37
|
+
profileId?: string | undefined;
|
|
38
|
+
createdAt?: string | undefined;
|
|
39
|
+
updatedAt?: string | undefined;
|
|
40
|
+
eager?: string | undefined;
|
|
41
|
+
roleId?: string | undefined;
|
|
42
|
+
isActive?: boolean | undefined;
|
|
43
|
+
isArchived?: boolean | undefined;
|
|
11
44
|
}>;
|
|
12
45
|
summary: "List all user accounts";
|
|
13
46
|
method: "GET";
|
|
@@ -100,11 +133,44 @@ export declare const userManagementContract: {
|
|
|
100
133
|
id: string;
|
|
101
134
|
}>;
|
|
102
135
|
query: z.ZodObject<{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
136
|
+
id: z.ZodOptional<z.ZodString>;
|
|
137
|
+
name: z.ZodOptional<z.ZodString>;
|
|
138
|
+
identity: z.ZodOptional<z.ZodString>;
|
|
139
|
+
type: z.ZodOptional<z.ZodString>;
|
|
140
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
142
|
+
resetPassword: z.ZodOptional<z.ZodBoolean>;
|
|
143
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
isArchived: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
146
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
147
|
+
eager: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
149
|
+
type?: string | undefined;
|
|
150
|
+
id?: string | undefined;
|
|
151
|
+
resetPassword?: boolean | undefined;
|
|
152
|
+
name?: string | undefined;
|
|
153
|
+
identity?: string | undefined;
|
|
154
|
+
profileId?: string | undefined;
|
|
155
|
+
createdAt?: string | undefined;
|
|
156
|
+
updatedAt?: string | undefined;
|
|
157
|
+
eager?: string | undefined;
|
|
158
|
+
roleId?: string | undefined;
|
|
159
|
+
isActive?: boolean | undefined;
|
|
160
|
+
isArchived?: boolean | undefined;
|
|
106
161
|
}, {
|
|
107
|
-
|
|
162
|
+
type?: string | undefined;
|
|
163
|
+
id?: string | undefined;
|
|
164
|
+
resetPassword?: boolean | undefined;
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
identity?: string | undefined;
|
|
167
|
+
profileId?: string | undefined;
|
|
168
|
+
createdAt?: string | undefined;
|
|
169
|
+
updatedAt?: string | undefined;
|
|
170
|
+
eager?: string | undefined;
|
|
171
|
+
roleId?: string | undefined;
|
|
172
|
+
isActive?: boolean | undefined;
|
|
173
|
+
isArchived?: boolean | undefined;
|
|
108
174
|
}>;
|
|
109
175
|
summary: "Get user account details";
|
|
110
176
|
method: "GET";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"contract.d.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,7 @@ export const userManagementContract = c.router({
|
|
|
8
8
|
getUsers: {
|
|
9
9
|
method: "GET",
|
|
10
10
|
path: "/login",
|
|
11
|
-
query:
|
|
12
|
-
eager: z.string(),
|
|
13
|
-
}),
|
|
11
|
+
query: UserManagementSchemas.managedUserQueryParams,
|
|
14
12
|
responses: {
|
|
15
13
|
200: z.array(UserManagementSchemas.managedUser),
|
|
16
14
|
401: z.object({
|
|
@@ -30,9 +28,7 @@ export const userManagementContract = c.router({
|
|
|
30
28
|
pathParams: z.object({
|
|
31
29
|
id: z.string(),
|
|
32
30
|
}),
|
|
33
|
-
query:
|
|
34
|
-
eager: z.string(),
|
|
35
|
-
}),
|
|
31
|
+
query: UserManagementSchemas.managedUserQueryParams,
|
|
36
32
|
responses: {
|
|
37
33
|
200: UserManagementSchemas.managedUser,
|
|
38
34
|
401: z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRepository } from "../../shared/base_repository.js";
|
|
2
2
|
import { userManagementContract } from "./contract.js";
|
|
3
|
-
import type { CreateUserRequest, CreateUserResponse, ResetPasswordRequest, UpdateUserRequest } from "./schemas.js";
|
|
3
|
+
import type { CreateUserRequest, CreateUserResponse, ManagedUserQueryParams, ResetPasswordRequest, UpdateUserRequest } from "./schemas.js";
|
|
4
4
|
import type { AfloatAuth } from "../auth/manager.js";
|
|
5
5
|
import { ManagedUser } from "../../models/index.js";
|
|
6
6
|
import { Role } from "../../models/role.js";
|
|
@@ -74,7 +74,7 @@ export declare class UserManagementRepository extends BaseRepository<typeof user
|
|
|
74
74
|
* const repository = new UserManagementRepository();
|
|
75
75
|
* repository.getAllUsers().then(users => console.log(users));
|
|
76
76
|
*/
|
|
77
|
-
getAllUsers(): Promise<ManagedUser[]>;
|
|
77
|
+
getAllUsers(query?: ManagedUserQueryParams): Promise<ManagedUser[]>;
|
|
78
78
|
/**
|
|
79
79
|
* Retrieves a specific user account by ID.
|
|
80
80
|
*
|
|
@@ -86,7 +86,7 @@ export declare class UserManagementRepository extends BaseRepository<typeof user
|
|
|
86
86
|
* const repository = new UserManagementRepository();
|
|
87
87
|
* repository.getUser('user-id').then(user => console.log(user));
|
|
88
88
|
*/
|
|
89
|
-
getUser(id: string): Promise<ManagedUser>;
|
|
89
|
+
getUser(id: string, query?: ManagedUserQueryParams): Promise<ManagedUser>;
|
|
90
90
|
/**
|
|
91
91
|
* Retrieves all available roles in the system.
|
|
92
92
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,WAAW,EAGZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAiB,MAAM,sBAAsB,CAAC;AAE3D;;;GAGG;AACH,qBAAa,wBACX,SAAQ,cAAc,CAAC,OAAO,sBAAsB,CAAC;IACrD;;;;;OAKG;gBACS,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;IAIxD;;;;;;OAMG;IACG,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgBvE;;;;;;;OAOG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuB5E;;;;;;OAMG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAoBnD;;;;;;OA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AE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAoBrD;;;;;;;OAOG;IACG,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,oBAAyB,GAC/B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAkBhC;;;;;;;;;;OAUG;IACG,WAAW,CACf,KAAK,GAAE,sBAA0C,GAChD,OAAO,CAAC,WAAW,EAAE,CAAC;IAgBzB;;;;;;;;;;OAUG;IACG,OAAO,CACX,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,sBAA0C,GAChD,OAAO,CAAC,WAAW,CAAC;IAoBvB;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAsBpC;;;;;;;;;;OAUG;IACG,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBzC"}
|
|
@@ -82,7 +82,7 @@ export class UserManagementRepository extends BaseRepository {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
const result = await this.client.archiveUser({ params: { id } });
|
|
85
|
-
const data = this.handleResponse(result,
|
|
85
|
+
const data = this.handleResponse(result, 201);
|
|
86
86
|
const managedUser = ManagedUser.from(data);
|
|
87
87
|
if (!managedUser) {
|
|
88
88
|
throw new Error("Invalid user data received from server");
|
|
@@ -106,7 +106,7 @@ export class UserManagementRepository extends BaseRepository {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
const result = await this.client.unArchiveUser({ params: { id } });
|
|
109
|
-
const data = this.handleResponse(result,
|
|
109
|
+
const data = this.handleResponse(result, 201);
|
|
110
110
|
const managedUser = ManagedUser.from(data);
|
|
111
111
|
if (!managedUser) {
|
|
112
112
|
throw new Error("Invalid user data received from server");
|
|
@@ -134,7 +134,7 @@ export class UserManagementRepository extends BaseRepository {
|
|
|
134
134
|
params: { id },
|
|
135
135
|
body: input,
|
|
136
136
|
});
|
|
137
|
-
return this.handleResponse(result,
|
|
137
|
+
return this.handleResponse(result, 201);
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* Retrieves all user accounts.
|
|
@@ -147,7 +147,7 @@ export class UserManagementRepository extends BaseRepository {
|
|
|
147
147
|
* const repository = new UserManagementRepository();
|
|
148
148
|
* repository.getAllUsers().then(users => console.log(users));
|
|
149
149
|
*/
|
|
150
|
-
async getAllUsers() {
|
|
150
|
+
async getAllUsers(query = { eager: "role" }) {
|
|
151
151
|
const auth = this.getAuthForPermissionCheck();
|
|
152
152
|
const requiredPerm = Permissions.UserManagement.ViewUsers;
|
|
153
153
|
if (!auth.checkPermission(requiredPerm)) {
|
|
@@ -156,7 +156,7 @@ export class UserManagementRepository extends BaseRepository {
|
|
|
156
156
|
requiredPermissions: [requiredPerm],
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
const result = await this.client.getUsers({ query
|
|
159
|
+
const result = await this.client.getUsers({ query });
|
|
160
160
|
const data = this.handleResponse(result, 200);
|
|
161
161
|
return ManagedUser.createMany(data);
|
|
162
162
|
}
|
|
@@ -171,7 +171,7 @@ export class UserManagementRepository extends BaseRepository {
|
|
|
171
171
|
* const repository = new UserManagementRepository();
|
|
172
172
|
* repository.getUser('user-id').then(user => console.log(user));
|
|
173
173
|
*/
|
|
174
|
-
async getUser(id) {
|
|
174
|
+
async getUser(id, query = { eager: "role" }) {
|
|
175
175
|
const auth = this.getAuthForPermissionCheck();
|
|
176
176
|
const requiredPerm = Permissions.UserManagement.ViewUser;
|
|
177
177
|
if (!auth.checkPermission(requiredPerm)) {
|
|
@@ -180,10 +180,7 @@ export class UserManagementRepository extends BaseRepository {
|
|
|
180
180
|
requiredPermissions: [requiredPerm],
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
const result = await this.client.getUser({
|
|
184
|
-
params: { id },
|
|
185
|
-
query: { eager: "role" },
|
|
186
|
-
});
|
|
183
|
+
const result = await this.client.getUser({ params: { id }, query });
|
|
187
184
|
const data = this.handleResponse(result, 200);
|
|
188
185
|
const managedUser = ManagedUser.from(data);
|
|
189
186
|
if (!managedUser) {
|
|
@@ -79,6 +79,24 @@ type _CreateUserResponseType = z.ZodObject<{
|
|
|
79
79
|
isArchived: z.ZodBoolean;
|
|
80
80
|
createdAt: z.ZodString;
|
|
81
81
|
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Type definition for managed user query parameters schema using Zod.
|
|
84
|
+
* This is used as a TypeScript type helper for the actual schema implementation.
|
|
85
|
+
*/
|
|
86
|
+
type _ManagedUserQueryParamsType = z.ZodObject<{
|
|
87
|
+
id: z.ZodOptional<z.ZodString>;
|
|
88
|
+
name: z.ZodOptional<z.ZodString>;
|
|
89
|
+
identity: z.ZodOptional<z.ZodString>;
|
|
90
|
+
type: z.ZodOptional<z.ZodString>;
|
|
91
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
93
|
+
resetPassword: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
isArchived: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
97
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
98
|
+
eager: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}>;
|
|
82
100
|
/**
|
|
83
101
|
* Collection of user management schemas for export.
|
|
84
102
|
* Provides access to all user and role validation schemas.
|
|
@@ -86,6 +104,7 @@ type _CreateUserResponseType = z.ZodObject<{
|
|
|
86
104
|
export declare const UserManagementSchemas: {
|
|
87
105
|
role: _RoleType;
|
|
88
106
|
managedUser: _ManagedUserType;
|
|
107
|
+
managedUserQueryParams: _ManagedUserQueryParamsType;
|
|
89
108
|
createUserRequest: _CreateUserRequestType;
|
|
90
109
|
updateUserRequest: _UpdateUserRequestType;
|
|
91
110
|
resetPasswordRequest: _ResetPasswordRequestType;
|
|
@@ -117,5 +136,11 @@ export type ResetPasswordRequest = z.infer<typeof UserManagementSchemas.resetPas
|
|
|
117
136
|
* Use this type for user creation responses that have been validated against the schema.
|
|
118
137
|
*/
|
|
119
138
|
export type CreateUserResponse = z.infer<typeof UserManagementSchemas.createUserResponse>;
|
|
139
|
+
/**
|
|
140
|
+
* TypeScript type for managed user query parameters.
|
|
141
|
+
* Use this type for query parameter objects that have been validated against the schema.
|
|
142
|
+
* All fields are optional to allow flexible filtering and searching.
|
|
143
|
+
*/
|
|
144
|
+
export type ManagedUserQueryParams = z.infer<typeof UserManagementSchemas.managedUserQueryParams>;
|
|
120
145
|
export {};
|
|
121
146
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,KAAK,aAAa,GAAG,CAAC,CAAC,UAAU,CAC/B,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EACvE,MAAM,EACN,MAAM,CACP,CAAC;AAuDF;;;GAGG;AACH,KAAK,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;IAC3B,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC;IAClB,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;CACxB,CAAC,CAAC;AAEH;;;GAGG;AACH,KAAK,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AC,CAAC,KAAK,CACrC,OAAO,qBAAqB,CAAC,iBAAiB,CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CACrC,OAAO,qBAAqB,CAAC,iBAAiB,CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACxC,OAAO,qBAAqB,CAAC,oBAAoB,CAClD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CACtC,OAAO,qBAAqB,CAAC,kBAAkB,CAChD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,qBAAqB,CAAC,sBAAsB,CACpD,CAAC"}
|
|
@@ -89,6 +89,37 @@ const managedUserSchema = z.object({
|
|
|
89
89
|
createdAt: z.string().datetime("Invalid creation timestamp"),
|
|
90
90
|
updatedAt: z.string().datetime("Invalid update timestamp"),
|
|
91
91
|
});
|
|
92
|
+
/**
|
|
93
|
+
* Schema definition for managed user query parameters.
|
|
94
|
+
* Contains all primitive fields from ManagedUserData for filtering/searching users.
|
|
95
|
+
* Excludes complex object fields like 'role' which are not suitable for query parameters.
|
|
96
|
+
*
|
|
97
|
+
* @property {string} id - Optional filter by user ID
|
|
98
|
+
* @property {string} name - Optional filter by user name (partial match)
|
|
99
|
+
* @property {string} identity - Optional filter by user identity (email/phone)
|
|
100
|
+
* @property {string} type - Optional filter by user type
|
|
101
|
+
* @property {string} profileId - Optional filter by profile ID
|
|
102
|
+
* @property {string} roleId - Optional filter by role ID
|
|
103
|
+
* @property {boolean} resetPassword - Optional filter by password reset requirement
|
|
104
|
+
* @property {boolean} isActive - Optional filter by account active status
|
|
105
|
+
* @property {boolean} isArchived - Optional filter by account archived status
|
|
106
|
+
* @property {string} createdAt - Optional filter by creation date (ISO datetime)
|
|
107
|
+
* @property {string} updatedAt - Optional filter by last update date (ISO datetime)
|
|
108
|
+
*/
|
|
109
|
+
const managedUserQueryParamsSchema = z.object({
|
|
110
|
+
id: z.string().min(1).optional(),
|
|
111
|
+
name: z.string().min(1).optional(),
|
|
112
|
+
identity: z.string().email("Invalid email address").optional(),
|
|
113
|
+
type: z.string().min(1).optional(),
|
|
114
|
+
profileId: z.string().min(1).optional(),
|
|
115
|
+
roleId: z.string().min(1).optional(),
|
|
116
|
+
resetPassword: z.boolean().optional(),
|
|
117
|
+
isActive: z.boolean().optional(),
|
|
118
|
+
isArchived: z.boolean().optional(),
|
|
119
|
+
createdAt: z.string().datetime("Invalid creation timestamp").optional(),
|
|
120
|
+
updatedAt: z.string().datetime("Invalid update timestamp").optional(),
|
|
121
|
+
eager: z.string().optional(),
|
|
122
|
+
});
|
|
92
123
|
/**
|
|
93
124
|
* Schema definition for creating a new user account.
|
|
94
125
|
* Defines the required and optional fields for user creation.
|
|
@@ -166,6 +197,7 @@ const createUserResponseSchema = z.object({
|
|
|
166
197
|
export const UserManagementSchemas = {
|
|
167
198
|
role: roleSchema,
|
|
168
199
|
managedUser: managedUserSchema,
|
|
200
|
+
managedUserQueryParams: managedUserQueryParamsSchema,
|
|
169
201
|
createUserRequest: createUserRequestSchema,
|
|
170
202
|
updateUserRequest: updateUserRequestSchema,
|
|
171
203
|
resetPasswordRequest: resetPasswordRequestSchema,
|
package/package.json
CHANGED
|
@@ -3,11 +3,44 @@ export declare const userManagementContract: {
|
|
|
3
3
|
getUsers: {
|
|
4
4
|
description: "Retrieve a list of all user accounts in the system";
|
|
5
5
|
query: z.ZodObject<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
id: z.ZodOptional<z.ZodString>;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
identity: z.ZodOptional<z.ZodString>;
|
|
9
|
+
type: z.ZodOptional<z.ZodString>;
|
|
10
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
resetPassword: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
isArchived: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
16
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
17
|
+
eager: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
19
|
+
type?: string | undefined;
|
|
20
|
+
id?: string | undefined;
|
|
21
|
+
resetPassword?: boolean | undefined;
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
identity?: string | undefined;
|
|
24
|
+
profileId?: string | undefined;
|
|
25
|
+
createdAt?: string | undefined;
|
|
26
|
+
updatedAt?: string | undefined;
|
|
27
|
+
eager?: string | undefined;
|
|
28
|
+
roleId?: string | undefined;
|
|
29
|
+
isActive?: boolean | undefined;
|
|
30
|
+
isArchived?: boolean | undefined;
|
|
9
31
|
}, {
|
|
10
|
-
|
|
32
|
+
type?: string | undefined;
|
|
33
|
+
id?: string | undefined;
|
|
34
|
+
resetPassword?: boolean | undefined;
|
|
35
|
+
name?: string | undefined;
|
|
36
|
+
identity?: string | undefined;
|
|
37
|
+
profileId?: string | undefined;
|
|
38
|
+
createdAt?: string | undefined;
|
|
39
|
+
updatedAt?: string | undefined;
|
|
40
|
+
eager?: string | undefined;
|
|
41
|
+
roleId?: string | undefined;
|
|
42
|
+
isActive?: boolean | undefined;
|
|
43
|
+
isArchived?: boolean | undefined;
|
|
11
44
|
}>;
|
|
12
45
|
summary: "List all user accounts";
|
|
13
46
|
method: "GET";
|
|
@@ -100,11 +133,44 @@ export declare const userManagementContract: {
|
|
|
100
133
|
id: string;
|
|
101
134
|
}>;
|
|
102
135
|
query: z.ZodObject<{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
136
|
+
id: z.ZodOptional<z.ZodString>;
|
|
137
|
+
name: z.ZodOptional<z.ZodString>;
|
|
138
|
+
identity: z.ZodOptional<z.ZodString>;
|
|
139
|
+
type: z.ZodOptional<z.ZodString>;
|
|
140
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
142
|
+
resetPassword: z.ZodOptional<z.ZodBoolean>;
|
|
143
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
isArchived: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
146
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
147
|
+
eager: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
149
|
+
type?: string | undefined;
|
|
150
|
+
id?: string | undefined;
|
|
151
|
+
resetPassword?: boolean | undefined;
|
|
152
|
+
name?: string | undefined;
|
|
153
|
+
identity?: string | undefined;
|
|
154
|
+
profileId?: string | undefined;
|
|
155
|
+
createdAt?: string | undefined;
|
|
156
|
+
updatedAt?: string | undefined;
|
|
157
|
+
eager?: string | undefined;
|
|
158
|
+
roleId?: string | undefined;
|
|
159
|
+
isActive?: boolean | undefined;
|
|
160
|
+
isArchived?: boolean | undefined;
|
|
106
161
|
}, {
|
|
107
|
-
|
|
162
|
+
type?: string | undefined;
|
|
163
|
+
id?: string | undefined;
|
|
164
|
+
resetPassword?: boolean | undefined;
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
identity?: string | undefined;
|
|
167
|
+
profileId?: string | undefined;
|
|
168
|
+
createdAt?: string | undefined;
|
|
169
|
+
updatedAt?: string | undefined;
|
|
170
|
+
eager?: string | undefined;
|
|
171
|
+
roleId?: string | undefined;
|
|
172
|
+
isActive?: boolean | undefined;
|
|
173
|
+
isArchived?: boolean | undefined;
|
|
108
174
|
}>;
|
|
109
175
|
summary: "Get user account details";
|
|
110
176
|
method: "GET";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsNjC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC"}
|
|
@@ -11,9 +11,7 @@ exports.userManagementContract = c.router({
|
|
|
11
11
|
getUsers: {
|
|
12
12
|
method: "GET",
|
|
13
13
|
path: "/login",
|
|
14
|
-
query:
|
|
15
|
-
eager: zod_1.z.string(),
|
|
16
|
-
}),
|
|
14
|
+
query: schemas_js_1.UserManagementSchemas.managedUserQueryParams,
|
|
17
15
|
responses: {
|
|
18
16
|
200: zod_1.z.array(schemas_js_1.UserManagementSchemas.managedUser),
|
|
19
17
|
401: zod_1.z.object({
|
|
@@ -33,9 +31,7 @@ exports.userManagementContract = c.router({
|
|
|
33
31
|
pathParams: zod_1.z.object({
|
|
34
32
|
id: zod_1.z.string(),
|
|
35
33
|
}),
|
|
36
|
-
query:
|
|
37
|
-
eager: zod_1.z.string(),
|
|
38
|
-
}),
|
|
34
|
+
query: schemas_js_1.UserManagementSchemas.managedUserQueryParams,
|
|
39
35
|
responses: {
|
|
40
36
|
200: schemas_js_1.UserManagementSchemas.managedUser,
|
|
41
37
|
401: zod_1.z.object({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRepository } from "../../shared/base_repository.js";
|
|
2
2
|
import { userManagementContract } from "./contract.js";
|
|
3
|
-
import type { CreateUserRequest, CreateUserResponse, ResetPasswordRequest, UpdateUserRequest } from "./schemas.js";
|
|
3
|
+
import type { CreateUserRequest, CreateUserResponse, ManagedUserQueryParams, ResetPasswordRequest, UpdateUserRequest } from "./schemas.js";
|
|
4
4
|
import type { AfloatAuth } from "../auth/manager.js";
|
|
5
5
|
import { ManagedUser } from "../../models/index.js";
|
|
6
6
|
import { Role } from "../../models/role.js";
|
|
@@ -74,7 +74,7 @@ export declare class UserManagementRepository extends BaseRepository<typeof user
|
|
|
74
74
|
* const repository = new UserManagementRepository();
|
|
75
75
|
* repository.getAllUsers().then(users => console.log(users));
|
|
76
76
|
*/
|
|
77
|
-
getAllUsers(): Promise<ManagedUser[]>;
|
|
77
|
+
getAllUsers(query?: ManagedUserQueryParams): Promise<ManagedUser[]>;
|
|
78
78
|
/**
|
|
79
79
|
* Retrieves a specific user account by ID.
|
|
80
80
|
*
|
|
@@ -86,7 +86,7 @@ export declare class UserManagementRepository extends BaseRepository<typeof user
|
|
|
86
86
|
* const repository = new UserManagementRepository();
|
|
87
87
|
* repository.getUser('user-id').then(user => console.log(user));
|
|
88
88
|
*/
|
|
89
|
-
getUser(id: string): Promise<ManagedUser>;
|
|
89
|
+
getUser(id: string, query?: ManagedUserQueryParams): Promise<ManagedUser>;
|
|
90
90
|
/**
|
|
91
91
|
* Retrieves all available roles in the system.
|
|
92
92
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,WAAW,EAGZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAiB,MAAM,sBAAsB,CAAC;AAE3D;;;GAGG;AACH,qBAAa,wBACX,SAAQ,cAAc,CAAC,OAAO,sBAAsB,CAAC;IACrD;;;;;OAKG;gBACS,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;IAIxD;;;;;;OAMG;IACG,UAAU,CAAC,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AG,OAAO,CAAC,kBAAkB,CAAC;IAgBvE;;;;;;;OAOG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAuB5E;;;;;;OAMG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAoBnD;;;;;;OAMG;IACG,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAoBrD;;;;;;;OAOG;IACG,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,oBAAyB,GAC/B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAkBhC;;;;;;;;;;OAUG;IACG,WAAW,CACf,KAAK,GAAE,sBAA0C,GAChD,OAAO,CAAC,WAAW,EAAE,CAAC;IAgBzB;;;;;;;;;;OAUG;IACG,OAAO,CACX,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,sBAA0C,GAChD,OAAO,CAAC,WAAW,CAAC;IAoBvB;;;;;;;;;OASG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAsBpC;;;;;;;;;;OAUG;IACG,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBzC"}
|
|
@@ -85,7 +85,7 @@ class UserManagementRepository extends base_repository_js_1.BaseRepository {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
const result = await this.client.archiveUser({ params: { id } });
|
|
88
|
-
const data = this.handleResponse(result,
|
|
88
|
+
const data = this.handleResponse(result, 201);
|
|
89
89
|
const managedUser = index_js_1.ManagedUser.from(data);
|
|
90
90
|
if (!managedUser) {
|
|
91
91
|
throw new Error("Invalid user data received from server");
|
|
@@ -109,7 +109,7 @@ class UserManagementRepository extends base_repository_js_1.BaseRepository {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
const result = await this.client.unArchiveUser({ params: { id } });
|
|
112
|
-
const data = this.handleResponse(result,
|
|
112
|
+
const data = this.handleResponse(result, 201);
|
|
113
113
|
const managedUser = index_js_1.ManagedUser.from(data);
|
|
114
114
|
if (!managedUser) {
|
|
115
115
|
throw new Error("Invalid user data received from server");
|
|
@@ -137,7 +137,7 @@ class UserManagementRepository extends base_repository_js_1.BaseRepository {
|
|
|
137
137
|
params: { id },
|
|
138
138
|
body: input,
|
|
139
139
|
});
|
|
140
|
-
return this.handleResponse(result,
|
|
140
|
+
return this.handleResponse(result, 201);
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* Retrieves all user accounts.
|
|
@@ -150,7 +150,7 @@ class UserManagementRepository extends base_repository_js_1.BaseRepository {
|
|
|
150
150
|
* const repository = new UserManagementRepository();
|
|
151
151
|
* repository.getAllUsers().then(users => console.log(users));
|
|
152
152
|
*/
|
|
153
|
-
async getAllUsers() {
|
|
153
|
+
async getAllUsers(query = { eager: "role" }) {
|
|
154
154
|
const auth = this.getAuthForPermissionCheck();
|
|
155
155
|
const requiredPerm = index_js_1.Permissions.UserManagement.ViewUsers;
|
|
156
156
|
if (!auth.checkPermission(requiredPerm)) {
|
|
@@ -159,7 +159,7 @@ class UserManagementRepository extends base_repository_js_1.BaseRepository {
|
|
|
159
159
|
requiredPermissions: [requiredPerm],
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
const result = await this.client.getUsers({ query
|
|
162
|
+
const result = await this.client.getUsers({ query });
|
|
163
163
|
const data = this.handleResponse(result, 200);
|
|
164
164
|
return index_js_1.ManagedUser.createMany(data);
|
|
165
165
|
}
|
|
@@ -174,7 +174,7 @@ class UserManagementRepository extends base_repository_js_1.BaseRepository {
|
|
|
174
174
|
* const repository = new UserManagementRepository();
|
|
175
175
|
* repository.getUser('user-id').then(user => console.log(user));
|
|
176
176
|
*/
|
|
177
|
-
async getUser(id) {
|
|
177
|
+
async getUser(id, query = { eager: "role" }) {
|
|
178
178
|
const auth = this.getAuthForPermissionCheck();
|
|
179
179
|
const requiredPerm = index_js_1.Permissions.UserManagement.ViewUser;
|
|
180
180
|
if (!auth.checkPermission(requiredPerm)) {
|
|
@@ -183,10 +183,7 @@ class UserManagementRepository extends base_repository_js_1.BaseRepository {
|
|
|
183
183
|
requiredPermissions: [requiredPerm],
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
-
const result = await this.client.getUser({
|
|
187
|
-
params: { id },
|
|
188
|
-
query: { eager: "role" },
|
|
189
|
-
});
|
|
186
|
+
const result = await this.client.getUser({ params: { id }, query });
|
|
190
187
|
const data = this.handleResponse(result, 200);
|
|
191
188
|
const managedUser = index_js_1.ManagedUser.from(data);
|
|
192
189
|
if (!managedUser) {
|
|
@@ -79,6 +79,24 @@ type _CreateUserResponseType = z.ZodObject<{
|
|
|
79
79
|
isArchived: z.ZodBoolean;
|
|
80
80
|
createdAt: z.ZodString;
|
|
81
81
|
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Type definition for managed user query parameters schema using Zod.
|
|
84
|
+
* This is used as a TypeScript type helper for the actual schema implementation.
|
|
85
|
+
*/
|
|
86
|
+
type _ManagedUserQueryParamsType = z.ZodObject<{
|
|
87
|
+
id: z.ZodOptional<z.ZodString>;
|
|
88
|
+
name: z.ZodOptional<z.ZodString>;
|
|
89
|
+
identity: z.ZodOptional<z.ZodString>;
|
|
90
|
+
type: z.ZodOptional<z.ZodString>;
|
|
91
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
93
|
+
resetPassword: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
isArchived: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
97
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
98
|
+
eager: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}>;
|
|
82
100
|
/**
|
|
83
101
|
* Collection of user management schemas for export.
|
|
84
102
|
* Provides access to all user and role validation schemas.
|
|
@@ -86,6 +104,7 @@ type _CreateUserResponseType = z.ZodObject<{
|
|
|
86
104
|
export declare const UserManagementSchemas: {
|
|
87
105
|
role: _RoleType;
|
|
88
106
|
managedUser: _ManagedUserType;
|
|
107
|
+
managedUserQueryParams: _ManagedUserQueryParamsType;
|
|
89
108
|
createUserRequest: _CreateUserRequestType;
|
|
90
109
|
updateUserRequest: _UpdateUserRequestType;
|
|
91
110
|
resetPasswordRequest: _ResetPasswordRequestType;
|
|
@@ -117,5 +136,11 @@ export type ResetPasswordRequest = z.infer<typeof UserManagementSchemas.resetPas
|
|
|
117
136
|
* Use this type for user creation responses that have been validated against the schema.
|
|
118
137
|
*/
|
|
119
138
|
export type CreateUserResponse = z.infer<typeof UserManagementSchemas.createUserResponse>;
|
|
139
|
+
/**
|
|
140
|
+
* TypeScript type for managed user query parameters.
|
|
141
|
+
* Use this type for query parameter objects that have been validated against the schema.
|
|
142
|
+
* All fields are optional to allow flexible filtering and searching.
|
|
143
|
+
*/
|
|
144
|
+
export type ManagedUserQueryParams = z.infer<typeof UserManagementSchemas.managedUserQueryParams>;
|
|
120
145
|
export {};
|
|
121
146
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,KAAK,aAAa,GAAG,CAAC,CAAC,UAAU,CAC/B,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EACvE,MAAM,EACN,MAAM,CACP,CAAC;AAuDF;;;GAGG;AACH,KAAK,SAAS,GAAG,CAA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AC;IACtC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEtC,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC,CAAC;AAmKH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;CASjC,CAAC;AAIF;;;GAGG;AACH,KAAK,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CACrC,OAAO,qBAAqB,CAAC,iBAAiB,CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CACrC,OAAO,qBAAqB,CAAC,iBAAiB,CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CACxC,OAAO,qBAAqB,CAAC,oBAAoB,CAClD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CACtC,OAAO,qBAAqB,CAAC,kBAAkB,CAChD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,qBAAqB,CAAC,sBAAsB,CACpD,CAAC"}
|
|
@@ -92,6 +92,37 @@ const managedUserSchema = zod_1.z.object({
|
|
|
92
92
|
createdAt: zod_1.z.string().datetime("Invalid creation timestamp"),
|
|
93
93
|
updatedAt: zod_1.z.string().datetime("Invalid update timestamp"),
|
|
94
94
|
});
|
|
95
|
+
/**
|
|
96
|
+
* Schema definition for managed user query parameters.
|
|
97
|
+
* Contains all primitive fields from ManagedUserData for filtering/searching users.
|
|
98
|
+
* Excludes complex object fields like 'role' which are not suitable for query parameters.
|
|
99
|
+
*
|
|
100
|
+
* @property {string} id - Optional filter by user ID
|
|
101
|
+
* @property {string} name - Optional filter by user name (partial match)
|
|
102
|
+
* @property {string} identity - Optional filter by user identity (email/phone)
|
|
103
|
+
* @property {string} type - Optional filter by user type
|
|
104
|
+
* @property {string} profileId - Optional filter by profile ID
|
|
105
|
+
* @property {string} roleId - Optional filter by role ID
|
|
106
|
+
* @property {boolean} resetPassword - Optional filter by password reset requirement
|
|
107
|
+
* @property {boolean} isActive - Optional filter by account active status
|
|
108
|
+
* @property {boolean} isArchived - Optional filter by account archived status
|
|
109
|
+
* @property {string} createdAt - Optional filter by creation date (ISO datetime)
|
|
110
|
+
* @property {string} updatedAt - Optional filter by last update date (ISO datetime)
|
|
111
|
+
*/
|
|
112
|
+
const managedUserQueryParamsSchema = zod_1.z.object({
|
|
113
|
+
id: zod_1.z.string().min(1).optional(),
|
|
114
|
+
name: zod_1.z.string().min(1).optional(),
|
|
115
|
+
identity: zod_1.z.string().email("Invalid email address").optional(),
|
|
116
|
+
type: zod_1.z.string().min(1).optional(),
|
|
117
|
+
profileId: zod_1.z.string().min(1).optional(),
|
|
118
|
+
roleId: zod_1.z.string().min(1).optional(),
|
|
119
|
+
resetPassword: zod_1.z.boolean().optional(),
|
|
120
|
+
isActive: zod_1.z.boolean().optional(),
|
|
121
|
+
isArchived: zod_1.z.boolean().optional(),
|
|
122
|
+
createdAt: zod_1.z.string().datetime("Invalid creation timestamp").optional(),
|
|
123
|
+
updatedAt: zod_1.z.string().datetime("Invalid update timestamp").optional(),
|
|
124
|
+
eager: zod_1.z.string().optional(),
|
|
125
|
+
});
|
|
95
126
|
/**
|
|
96
127
|
* Schema definition for creating a new user account.
|
|
97
128
|
* Defines the required and optional fields for user creation.
|
|
@@ -169,6 +200,7 @@ const createUserResponseSchema = zod_1.z.object({
|
|
|
169
200
|
exports.UserManagementSchemas = {
|
|
170
201
|
role: roleSchema,
|
|
171
202
|
managedUser: managedUserSchema,
|
|
203
|
+
managedUserQueryParams: managedUserQueryParamsSchema,
|
|
172
204
|
createUserRequest: createUserRequestSchema,
|
|
173
205
|
updateUserRequest: updateUserRequestSchema,
|
|
174
206
|
resetPasswordRequest: resetPasswordRequestSchema,
|