najm-auth 0.1.12 → 0.1.13
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.
Potentially problematic release.
This version of najm-auth might be problematic. Click here for more details.
- package/dist/index.d.ts +1325 -2104
- package/dist/index.js +3201 -0
- package/dist/schema/mysql.d.ts +1297 -0
- package/dist/schema/mysql.js +72 -0
- package/dist/schema/pg.d.ts +1300 -0
- package/dist/schema/pg.js +78 -0
- package/dist/schema/sqlite.d.ts +1439 -0
- package/dist/schema/sqlite.js +65 -0
- package/package.json +74 -19
- package/README.md +0 -501
- package/dist/index.mjs +0 -3082
package/dist/index.d.ts
CHANGED
|
@@ -1,76 +1,587 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as najm_core from 'najm-core';
|
|
2
|
+
import { ValidationPluginConfig } from 'najm-validation';
|
|
3
|
+
import { RateLimitPluginConfig } from 'najm-rate';
|
|
4
|
+
import { I18nService } from 'najm-i18n';
|
|
5
|
+
import { EmailService } from 'najm-email';
|
|
6
|
+
import { TDb, SeedEntry } from 'najm-database';
|
|
7
|
+
import { User, NewUser, RoleEntity, NewRoleEntity, Permission, NewPermission, RolePermission } from './schema/pg.js';
|
|
8
|
+
export { NewRolePermission, NewToken, Token, authSchema, baseFields, permissionsTable, rolePermissionsTable, rolesTable, tokensTable, usersTable } from './schema/pg.js';
|
|
9
|
+
import { CacheService } from 'najm-cache';
|
|
2
10
|
import { z } from 'zod';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
11
|
+
import { GuardResult } from 'najm-guard';
|
|
12
|
+
import 'drizzle-orm';
|
|
13
|
+
import 'drizzle-orm/pg-core';
|
|
5
14
|
|
|
15
|
+
/**
|
|
16
|
+
* JWT configuration for token generation and verification
|
|
17
|
+
*/
|
|
18
|
+
interface JwtConfig {
|
|
19
|
+
/** Secret key for access token signing */
|
|
20
|
+
accessSecret: string;
|
|
21
|
+
/** Access token expiration time (e.g., '15m', '1h') */
|
|
22
|
+
accessExpiresIn: string;
|
|
23
|
+
/** Secret key for refresh token signing */
|
|
24
|
+
refreshSecret: string;
|
|
25
|
+
/** Refresh token expiration time (e.g., '7d', '30d') */
|
|
26
|
+
refreshExpiresIn: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Complete auth plugin configuration (internal)
|
|
30
|
+
*/
|
|
31
|
+
interface AuthConfig {
|
|
32
|
+
/** JWT configuration */
|
|
33
|
+
jwt: JwtConfig;
|
|
34
|
+
/** Refresh token cookie name (default: 'refreshToken') */
|
|
35
|
+
refreshCookieName: string;
|
|
36
|
+
/** Database name to use (default: 'default') */
|
|
37
|
+
database: string;
|
|
38
|
+
/** Cache key prefix for blacklist (default: 'auth:blacklist:') */
|
|
39
|
+
blacklistPrefix: string;
|
|
40
|
+
/** Default role name for new user registration (default: null - no role assigned) */
|
|
41
|
+
defaultRole: string | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Auth plugin configuration options
|
|
45
|
+
* Cache is provided by najm-cache plugin (auto-dependency)
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Auth schema shape (dialect-agnostic)
|
|
49
|
+
* Import from 'najm-auth/pg', 'najm-auth/sqlite', or 'najm-auth/mysql'
|
|
50
|
+
*/
|
|
51
|
+
interface AuthSchema {
|
|
52
|
+
users: any;
|
|
53
|
+
tokens: any;
|
|
54
|
+
roles: any;
|
|
55
|
+
permissions: any;
|
|
56
|
+
rolePermissions: any;
|
|
57
|
+
}
|
|
58
|
+
type AuthPluginConfig = {
|
|
59
|
+
/** Database dialect (default: 'pg'). Auto-selects the correct schema. */
|
|
60
|
+
dialect?: 'pg' | 'sqlite' | 'mysql';
|
|
61
|
+
/** Database schema tables (optional, overrides dialect). Use authSchema from 'najm-auth/sqlite' or 'najm-auth/mysql' */
|
|
62
|
+
schema?: AuthSchema;
|
|
63
|
+
/** JWT configuration (secrets can be set via env vars) */
|
|
64
|
+
jwt?: Partial<JwtConfig>;
|
|
65
|
+
/** Refresh token cookie name (default: 'refreshToken') */
|
|
66
|
+
refreshCookieName?: string;
|
|
67
|
+
/** Database name to use (default: 'default') */
|
|
68
|
+
database?: string;
|
|
69
|
+
/** Cache key prefix for blacklist (default: 'auth:blacklist:') */
|
|
70
|
+
blacklistPrefix?: string;
|
|
71
|
+
/** Default role name for new user registration (default: null - no role assigned). Set to 'user' for auto-assignment. */
|
|
72
|
+
defaultRole?: string | null;
|
|
73
|
+
/** Optional config forwarded to validation() dependency */
|
|
74
|
+
validation?: ValidationPluginConfig;
|
|
75
|
+
/** Optional config forwarded to rateLimit() dependency */
|
|
76
|
+
rateLimit?: RateLimitPluginConfig;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* JWT payload structure
|
|
80
|
+
*/
|
|
81
|
+
interface JwtPayload {
|
|
82
|
+
userId: string;
|
|
83
|
+
/** Unique token ID for blacklist-based revocation */
|
|
84
|
+
jti: string;
|
|
85
|
+
exp?: number;
|
|
86
|
+
iat?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Token pair returned after authentication
|
|
90
|
+
*/
|
|
91
|
+
interface TokenPair {
|
|
92
|
+
accessToken: string;
|
|
93
|
+
refreshToken: string;
|
|
94
|
+
accessTokenExpiresAt?: number;
|
|
95
|
+
refreshTokenExpiresAt?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* User data structure for authentication
|
|
99
|
+
*/
|
|
100
|
+
interface AuthUser {
|
|
101
|
+
id: string;
|
|
102
|
+
email: string;
|
|
103
|
+
name?: string;
|
|
104
|
+
role?: string;
|
|
105
|
+
permissions?: string[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare const auth$1: (config?: AuthPluginConfig) => najm_core.NajmPlugin;
|
|
109
|
+
|
|
110
|
+
declare const AUTH_CONFIG: unique symbol;
|
|
111
|
+
declare const AUTH_SCHEMA: unique symbol;
|
|
112
|
+
declare const AUTH_USER: unique symbol;
|
|
113
|
+
declare const AUTH_ROLE: unique symbol;
|
|
114
|
+
declare const AUTH_PERMISSIONS: unique symbol;
|
|
115
|
+
|
|
116
|
+
var auth = {
|
|
117
|
+
errors: {
|
|
118
|
+
invalidCredentials: "Invalid email or password",
|
|
119
|
+
emailExists: "Email already registered",
|
|
120
|
+
accessDenied: "Access denied",
|
|
121
|
+
tokenExpired: "Token has expired",
|
|
122
|
+
tokenInvalid: "Invalid token",
|
|
123
|
+
tokenMissing: "Authorization token is missing",
|
|
124
|
+
tokenVerificationFailed: "Token verification failed",
|
|
125
|
+
tokenRevoked: "Token has been revoked",
|
|
126
|
+
refreshTokenMissing: "Refresh token is missing",
|
|
127
|
+
refreshTokenInvalid: "Invalid refresh token",
|
|
128
|
+
invalidResetToken: "Invalid password reset token",
|
|
129
|
+
resetTokenExpired: "Password reset token has expired",
|
|
130
|
+
unauthorized: "Unauthorized access",
|
|
131
|
+
sessionExpired: "Session has expired"
|
|
132
|
+
},
|
|
133
|
+
success: {
|
|
134
|
+
login: "Login successful",
|
|
135
|
+
logout: "Logout successful",
|
|
136
|
+
passwordChanged: "Password changed successfully",
|
|
137
|
+
tokenRefreshed: "Token refreshed successfully"
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var users = {
|
|
141
|
+
errors: {
|
|
142
|
+
notFound: "User not found",
|
|
143
|
+
idExists: "User ID already exists",
|
|
144
|
+
emailRequired: "Email is required",
|
|
145
|
+
passwordRequired: "Password is required",
|
|
146
|
+
invalidEmail: "Invalid email format",
|
|
147
|
+
weakPassword: "Password is too weak",
|
|
148
|
+
adminRoleNotFound: "Admin role not found in system"
|
|
149
|
+
},
|
|
150
|
+
success: {
|
|
151
|
+
created: "User created successfully",
|
|
152
|
+
updated: "User updated successfully",
|
|
153
|
+
deleted: "User deleted successfully",
|
|
154
|
+
retrieved: "User retrieved successfully"
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var roles = {
|
|
158
|
+
errors: {
|
|
159
|
+
notFound: "Role not found",
|
|
160
|
+
exists: "Role already exists",
|
|
161
|
+
nameRequired: "Role name is required",
|
|
162
|
+
cannotDeleteSystem: "Cannot delete system role"
|
|
163
|
+
},
|
|
164
|
+
success: {
|
|
165
|
+
created: "Role created successfully",
|
|
166
|
+
updated: "Role updated successfully",
|
|
167
|
+
deleted: "Role deleted successfully",
|
|
168
|
+
assigned: "Role assigned successfully",
|
|
169
|
+
retrieved: "Role retrieved successfully"
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var permissions = {
|
|
173
|
+
errors: {
|
|
174
|
+
notFound: "Permission not found",
|
|
175
|
+
nameExists: "Permission name already exists",
|
|
176
|
+
roleAlreadyHasPermission: "Role already has this permission",
|
|
177
|
+
cannotRemoveRequired: "Cannot remove required permission"
|
|
178
|
+
},
|
|
179
|
+
success: {
|
|
180
|
+
created: "Permission created successfully",
|
|
181
|
+
updated: "Permission updated successfully",
|
|
182
|
+
deleted: "Permission deleted successfully",
|
|
183
|
+
granted: "Permission granted successfully",
|
|
184
|
+
revoked: "Permission revoked successfully",
|
|
185
|
+
retrieved: "Permissions retrieved successfully",
|
|
186
|
+
assigned: "Permission assigned to role successfully",
|
|
187
|
+
removed: "Permission removed from role successfully",
|
|
188
|
+
allDeleted: "All permissions deleted successfully"
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var en = {
|
|
192
|
+
auth: auth,
|
|
193
|
+
users: users,
|
|
194
|
+
roles: roles,
|
|
195
|
+
permissions: permissions
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Default auth translations organized by language
|
|
200
|
+
* Can be imported and merged with user translations
|
|
201
|
+
*/
|
|
202
|
+
declare const AUTH_LOCALES: {
|
|
203
|
+
readonly en: {
|
|
204
|
+
auth: {
|
|
205
|
+
errors: {
|
|
206
|
+
invalidCredentials: string;
|
|
207
|
+
emailExists: string;
|
|
208
|
+
accessDenied: string;
|
|
209
|
+
tokenExpired: string;
|
|
210
|
+
tokenInvalid: string;
|
|
211
|
+
tokenMissing: string;
|
|
212
|
+
tokenVerificationFailed: string;
|
|
213
|
+
tokenRevoked: string;
|
|
214
|
+
refreshTokenMissing: string;
|
|
215
|
+
refreshTokenInvalid: string;
|
|
216
|
+
invalidResetToken: string;
|
|
217
|
+
resetTokenExpired: string;
|
|
218
|
+
unauthorized: string;
|
|
219
|
+
sessionExpired: string;
|
|
220
|
+
};
|
|
221
|
+
success: {
|
|
222
|
+
login: string;
|
|
223
|
+
logout: string;
|
|
224
|
+
passwordChanged: string;
|
|
225
|
+
tokenRefreshed: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
users: {
|
|
229
|
+
errors: {
|
|
230
|
+
notFound: string;
|
|
231
|
+
idExists: string;
|
|
232
|
+
emailRequired: string;
|
|
233
|
+
passwordRequired: string;
|
|
234
|
+
invalidEmail: string;
|
|
235
|
+
weakPassword: string;
|
|
236
|
+
adminRoleNotFound: string;
|
|
237
|
+
};
|
|
238
|
+
success: {
|
|
239
|
+
created: string;
|
|
240
|
+
updated: string;
|
|
241
|
+
deleted: string;
|
|
242
|
+
retrieved: string;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
roles: {
|
|
246
|
+
errors: {
|
|
247
|
+
notFound: string;
|
|
248
|
+
exists: string;
|
|
249
|
+
nameRequired: string;
|
|
250
|
+
cannotDeleteSystem: string;
|
|
251
|
+
};
|
|
252
|
+
success: {
|
|
253
|
+
created: string;
|
|
254
|
+
updated: string;
|
|
255
|
+
deleted: string;
|
|
256
|
+
assigned: string;
|
|
257
|
+
retrieved: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
permissions: {
|
|
261
|
+
errors: {
|
|
262
|
+
notFound: string;
|
|
263
|
+
nameExists: string;
|
|
264
|
+
roleAlreadyHasPermission: string;
|
|
265
|
+
cannotRemoveRequired: string;
|
|
266
|
+
};
|
|
267
|
+
success: {
|
|
268
|
+
created: string;
|
|
269
|
+
updated: string;
|
|
270
|
+
deleted: string;
|
|
271
|
+
granted: string;
|
|
272
|
+
revoked: string;
|
|
273
|
+
retrieved: string;
|
|
274
|
+
assigned: string;
|
|
275
|
+
removed: string;
|
|
276
|
+
allDeleted: string;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Get translations for a specific language
|
|
283
|
+
* Falls back to English if language not found
|
|
284
|
+
*/
|
|
285
|
+
declare function getAuthLocale(lang: string): Record<string, any>;
|
|
286
|
+
/**
|
|
287
|
+
* All supported languages in auth package
|
|
288
|
+
*/
|
|
289
|
+
declare const AUTH_SUPPORTED_LANGUAGES: string[];
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* EncryptionService - Pure hashing utility
|
|
293
|
+
* Validation is handled by UserValidator (single source of truth)
|
|
294
|
+
*/
|
|
6
295
|
declare class EncryptionService {
|
|
7
296
|
constructor();
|
|
8
|
-
hashPassword(password:
|
|
9
|
-
comparePassword(password:
|
|
297
|
+
hashPassword(password: string): Promise<string>;
|
|
298
|
+
comparePassword(password: string, hashedPassword: string): Promise<boolean>;
|
|
10
299
|
}
|
|
11
300
|
|
|
12
|
-
declare class
|
|
13
|
-
|
|
14
|
-
|
|
301
|
+
declare class CookieManager {
|
|
302
|
+
private config;
|
|
303
|
+
private cookieService;
|
|
304
|
+
private get cookieName();
|
|
305
|
+
setRefreshToken(refreshToken: string): void;
|
|
306
|
+
clearRefreshToken(): void;
|
|
307
|
+
getRefreshToken(): string | undefined;
|
|
308
|
+
hasRefreshToken(): boolean;
|
|
309
|
+
getCookieName(): string;
|
|
15
310
|
}
|
|
16
311
|
|
|
312
|
+
interface UserWithPermissions extends Omit<User, 'password'> {
|
|
313
|
+
role?: string | null;
|
|
314
|
+
permissions: string[];
|
|
315
|
+
}
|
|
17
316
|
declare class UserRepository {
|
|
18
|
-
db:
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
317
|
+
db: TDb;
|
|
318
|
+
private schema;
|
|
319
|
+
private get users();
|
|
320
|
+
private get roles();
|
|
321
|
+
/** Shared query helper */
|
|
322
|
+
private get q();
|
|
323
|
+
getAll(): Promise<UserWithPermissions[]>;
|
|
324
|
+
getById(id: string): Promise<UserWithPermissions | undefined>;
|
|
325
|
+
getByEmail(email: string): Promise<(User & {
|
|
326
|
+
role?: string | null;
|
|
327
|
+
}) | undefined>;
|
|
328
|
+
create(data: NewUser): Promise<User>;
|
|
329
|
+
update(id: string, data: Partial<NewUser>): Promise<User>;
|
|
330
|
+
delete(id: string): Promise<User>;
|
|
331
|
+
deleteAll(): Promise<User[]>;
|
|
332
|
+
getRoleNameById(userId: string): Promise<string | null>;
|
|
333
|
+
getUserPassword(email: string): Promise<string | undefined>;
|
|
334
|
+
getUserPermissions(userId: string): Promise<string[]>;
|
|
30
335
|
}
|
|
31
336
|
|
|
337
|
+
/**
|
|
338
|
+
* UserValidator - Business validation for user operations
|
|
339
|
+
* Handles database checks (unique, exists, permissions)
|
|
340
|
+
* Schema validation is handled by DTOs in user.dto.ts
|
|
341
|
+
*/
|
|
32
342
|
declare class UserValidator {
|
|
33
343
|
private userRepository;
|
|
34
344
|
private encryptionService;
|
|
345
|
+
private t;
|
|
35
346
|
constructor(userRepository: UserRepository, encryptionService: EncryptionService);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Check if email already exists in database
|
|
349
|
+
*/
|
|
350
|
+
checkEmailUnique(email: string, excludeId?: string): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Check if user exists by ID
|
|
353
|
+
*/
|
|
354
|
+
checkUserExists(id: string): Promise<UserWithPermissions>;
|
|
355
|
+
/**
|
|
356
|
+
* Check if user exists by email
|
|
357
|
+
*/
|
|
358
|
+
checkUserExistsByEmail(email: string): Promise<{
|
|
359
|
+
status: "active" | "inactive" | "pending";
|
|
360
|
+
id: string;
|
|
361
|
+
createdAt: string;
|
|
362
|
+
updatedAt: string;
|
|
363
|
+
email: string;
|
|
364
|
+
emailVerified: boolean;
|
|
365
|
+
password: string;
|
|
366
|
+
image: string;
|
|
367
|
+
roleId: string;
|
|
368
|
+
lastLogin: string;
|
|
369
|
+
} & {
|
|
370
|
+
role?: string | null;
|
|
371
|
+
}>;
|
|
372
|
+
/**
|
|
373
|
+
* Check if email exists in database
|
|
374
|
+
*/
|
|
375
|
+
checkEmailExists(email: string): Promise<{
|
|
376
|
+
status: "active" | "inactive" | "pending";
|
|
377
|
+
id: string;
|
|
378
|
+
createdAt: string;
|
|
379
|
+
updatedAt: string;
|
|
380
|
+
email: string;
|
|
381
|
+
emailVerified: boolean;
|
|
382
|
+
password: string;
|
|
383
|
+
image: string;
|
|
384
|
+
roleId: string;
|
|
385
|
+
lastLogin: string;
|
|
386
|
+
} & {
|
|
387
|
+
role?: string | null;
|
|
388
|
+
}>;
|
|
389
|
+
/**
|
|
390
|
+
* Verify password against hashed password (throws on invalid)
|
|
391
|
+
*/
|
|
392
|
+
checkPasswordValid(password: string, hashedPassword: string): Promise<void>;
|
|
393
|
+
/**
|
|
394
|
+
* Compare password against hash - returns boolean (no throw)
|
|
395
|
+
* Used for timing-safe authentication
|
|
396
|
+
*/
|
|
397
|
+
comparePassword(password: string, hashedPassword: string): Promise<boolean>;
|
|
398
|
+
/**
|
|
399
|
+
* Check if user ID is unique (for custom IDs)
|
|
400
|
+
*/
|
|
401
|
+
checkUserIdIsUnique(id: string): Promise<void>;
|
|
402
|
+
/**
|
|
403
|
+
* Check if user has required role
|
|
404
|
+
*/
|
|
405
|
+
hasRole(userId: string, roles: string[]): Promise<boolean>;
|
|
406
|
+
/**
|
|
407
|
+
* Validate password strength and complexity
|
|
408
|
+
* Enforces:
|
|
409
|
+
* - Minimum 8 characters
|
|
410
|
+
* - At least one uppercase letter
|
|
411
|
+
* - At least one lowercase letter
|
|
412
|
+
* - At least one number
|
|
413
|
+
*/
|
|
414
|
+
validatePasswordStrength(password: string): void;
|
|
48
415
|
}
|
|
49
416
|
|
|
50
417
|
declare class RoleRepository {
|
|
51
|
-
db:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
418
|
+
db: TDb;
|
|
419
|
+
private schema;
|
|
420
|
+
private get roles();
|
|
421
|
+
getAll(): Promise<RoleEntity[]>;
|
|
422
|
+
getById(id: string): Promise<RoleEntity | undefined>;
|
|
423
|
+
getByName(name: string): Promise<RoleEntity | undefined>;
|
|
424
|
+
create(data: NewRoleEntity): Promise<RoleEntity>;
|
|
425
|
+
update(id: string, data: Partial<NewRoleEntity>): Promise<RoleEntity>;
|
|
426
|
+
delete(id: string): Promise<RoleEntity>;
|
|
58
427
|
}
|
|
59
428
|
|
|
429
|
+
/**
|
|
430
|
+
* RoleValidator - Business validation for role operations
|
|
431
|
+
* Handles database checks (unique, exists)
|
|
432
|
+
* Schema validation is handled by DTOs in role.dto.ts
|
|
433
|
+
*/
|
|
60
434
|
declare class RoleValidator {
|
|
61
435
|
private roleRepository;
|
|
436
|
+
private t;
|
|
62
437
|
constructor(roleRepository: RoleRepository);
|
|
63
|
-
|
|
438
|
+
/**
|
|
439
|
+
* Check if role name is unique
|
|
440
|
+
*/
|
|
441
|
+
checkNameUnique(roleName: string, excludeId?: string): Promise<void>;
|
|
442
|
+
/**
|
|
443
|
+
* Check if role exists by ID
|
|
444
|
+
*/
|
|
445
|
+
checkRoleExists(id: string): Promise<{
|
|
446
|
+
description: string;
|
|
447
|
+
name: string;
|
|
448
|
+
id: string;
|
|
449
|
+
createdAt: string;
|
|
450
|
+
updatedAt: string;
|
|
451
|
+
}>;
|
|
452
|
+
/**
|
|
453
|
+
* Check if role exists by name
|
|
454
|
+
*/
|
|
455
|
+
checkRoleExistsByName(roleName: string): Promise<{
|
|
456
|
+
description: string;
|
|
457
|
+
name: string;
|
|
458
|
+
id: string;
|
|
459
|
+
createdAt: string;
|
|
460
|
+
updatedAt: string;
|
|
461
|
+
}>;
|
|
462
|
+
/**
|
|
463
|
+
* Check if admin role exists (required for system setup)
|
|
464
|
+
*/
|
|
465
|
+
checkAdminRoleExists(): Promise<{
|
|
466
|
+
description: string;
|
|
467
|
+
name: string;
|
|
468
|
+
id: string;
|
|
469
|
+
createdAt: string;
|
|
470
|
+
updatedAt: string;
|
|
471
|
+
}>;
|
|
472
|
+
/**
|
|
473
|
+
* Check if role name exists (returns boolean, doesn't throw)
|
|
474
|
+
*/
|
|
64
475
|
isRoleNameExists(roleName: string): Promise<boolean>;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
declare class RoleService {
|
|
479
|
+
private roleRepository;
|
|
480
|
+
private roleValidator;
|
|
481
|
+
constructor(roleRepository: RoleRepository, roleValidator: RoleValidator);
|
|
482
|
+
getAll(): Promise<{
|
|
483
|
+
description: string;
|
|
484
|
+
name: string;
|
|
485
|
+
id: string;
|
|
486
|
+
createdAt: string;
|
|
487
|
+
updatedAt: string;
|
|
488
|
+
}[]>;
|
|
489
|
+
getById(id: any): Promise<{
|
|
490
|
+
description: string;
|
|
491
|
+
name: string;
|
|
492
|
+
id: string;
|
|
493
|
+
createdAt: string;
|
|
494
|
+
updatedAt: string;
|
|
495
|
+
}>;
|
|
496
|
+
getByName(name: any): Promise<{
|
|
497
|
+
description: string;
|
|
498
|
+
name: string;
|
|
499
|
+
id: string;
|
|
500
|
+
createdAt: string;
|
|
501
|
+
updatedAt: string;
|
|
502
|
+
}>;
|
|
503
|
+
create(data: any): Promise<{
|
|
504
|
+
description: string;
|
|
505
|
+
name: string;
|
|
506
|
+
id: string;
|
|
507
|
+
createdAt: string;
|
|
508
|
+
updatedAt: string;
|
|
509
|
+
}>;
|
|
510
|
+
update(id: any, data: any): Promise<{
|
|
511
|
+
description: string;
|
|
512
|
+
name: string;
|
|
513
|
+
id: string;
|
|
514
|
+
createdAt: string;
|
|
515
|
+
updatedAt: string;
|
|
516
|
+
}>;
|
|
517
|
+
delete(id: any): Promise<{
|
|
518
|
+
description: string;
|
|
519
|
+
name: string;
|
|
520
|
+
id: string;
|
|
521
|
+
createdAt: string;
|
|
522
|
+
updatedAt: string;
|
|
523
|
+
}>;
|
|
524
|
+
seedDefaultRoles(defaultRoles: any): Promise<{
|
|
525
|
+
description: string;
|
|
526
|
+
name: string;
|
|
527
|
+
id: string;
|
|
528
|
+
createdAt: string;
|
|
529
|
+
updatedAt: string;
|
|
530
|
+
}[]>;
|
|
531
|
+
getRoleIdByName(name: any): Promise<string>;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
type SanitizedUser = Omit<User, 'password'> & {
|
|
535
|
+
role?: string | null;
|
|
536
|
+
permissions?: string[];
|
|
537
|
+
};
|
|
538
|
+
declare class UserService {
|
|
539
|
+
private roleValidator;
|
|
540
|
+
private roleService;
|
|
541
|
+
private userRepository;
|
|
542
|
+
private userValidator;
|
|
543
|
+
private encryptionService;
|
|
544
|
+
private i18nService;
|
|
545
|
+
private authConfig;
|
|
546
|
+
constructor(roleValidator: RoleValidator, roleService: RoleService, userRepository: UserRepository, userValidator: UserValidator, encryptionService: EncryptionService, i18nService: I18nService, authConfig: AuthConfig);
|
|
547
|
+
private sanitizeUser;
|
|
548
|
+
private sanitizeUsers;
|
|
549
|
+
private resolveUserRole;
|
|
550
|
+
getAll(): Promise<SanitizedUser[]>;
|
|
551
|
+
getById(id: string): Promise<SanitizedUser>;
|
|
552
|
+
getByEmail(email: string): Promise<SanitizedUser>;
|
|
553
|
+
/**
|
|
554
|
+
* Find user by email without throwing - returns null if not found
|
|
555
|
+
* Used for timing-safe authentication
|
|
556
|
+
*/
|
|
557
|
+
findByEmail(email: string): Promise<(User & {
|
|
558
|
+
role?: string | null;
|
|
559
|
+
}) | undefined>;
|
|
560
|
+
create(data: Record<string, any>): Promise<SanitizedUser>;
|
|
561
|
+
update(id: string, data: Record<string, any>): Promise<SanitizedUser>;
|
|
562
|
+
delete(id: string): Promise<SanitizedUser>;
|
|
563
|
+
deleteAll(): Promise<SanitizedUser[]>;
|
|
564
|
+
getRoleName(id: string): Promise<string | null>;
|
|
565
|
+
getPassword(email: string): Promise<string | undefined>;
|
|
566
|
+
assignRole(id: string, roleId?: string, roleName?: string): Promise<SanitizedUser>;
|
|
567
|
+
removeRole(id: string): Promise<SanitizedUser>;
|
|
568
|
+
seedAdminUser(config?: {
|
|
569
|
+
email?: string;
|
|
570
|
+
password?: string;
|
|
571
|
+
name?: string;
|
|
572
|
+
}): Promise<SanitizedUser>;
|
|
573
|
+
updateLang(language: string): Promise<string>;
|
|
574
|
+
getLang(): Promise<string>;
|
|
70
575
|
}
|
|
71
576
|
|
|
72
577
|
declare class TokenRepository {
|
|
73
|
-
db:
|
|
578
|
+
db: TDb;
|
|
579
|
+
private schema;
|
|
580
|
+
private get tokens();
|
|
581
|
+
private get users();
|
|
582
|
+
private get roles();
|
|
583
|
+
/** Shared query helper */
|
|
584
|
+
private get q();
|
|
74
585
|
storeRefreshToken(tokenData: {
|
|
75
586
|
userId: string;
|
|
76
587
|
token: string;
|
|
@@ -79,1478 +590,396 @@ declare class TokenRepository {
|
|
|
79
590
|
getRefreshToken(userId: string): Promise<any>;
|
|
80
591
|
revokeToken(userId: string): Promise<any>;
|
|
81
592
|
isUserExists(userId: string): Promise<boolean>;
|
|
82
|
-
getRoleNameById(userId: string): Promise<
|
|
83
|
-
getUserPermissions(userId: string): Promise<
|
|
593
|
+
getRoleNameById(userId: string): Promise<string>;
|
|
594
|
+
getUserPermissions(userId: string): Promise<string[]>;
|
|
84
595
|
getUser(userId: string): Promise<any>;
|
|
85
596
|
}
|
|
86
597
|
|
|
87
|
-
interface JwtPayload {
|
|
88
|
-
userId: string;
|
|
89
|
-
exp?: number;
|
|
90
|
-
iat?: number;
|
|
91
|
-
}
|
|
92
598
|
declare class TokenService {
|
|
93
599
|
private tokenRepository;
|
|
94
|
-
private
|
|
95
|
-
private
|
|
96
|
-
private
|
|
97
|
-
private
|
|
98
|
-
constructor(tokenRepository: TokenRepository);
|
|
99
|
-
|
|
100
|
-
|
|
600
|
+
private cookieManager;
|
|
601
|
+
private cache;
|
|
602
|
+
private config;
|
|
603
|
+
private t;
|
|
604
|
+
constructor(tokenRepository: TokenRepository, cookieManager: CookieManager, cache: CacheService);
|
|
605
|
+
/**
|
|
606
|
+
* Get blacklist key prefix
|
|
607
|
+
*/
|
|
608
|
+
private get blacklistPrefix();
|
|
609
|
+
extractAccessToken(authorization: string): string;
|
|
610
|
+
/**
|
|
611
|
+
* Verify access token and check blacklist
|
|
612
|
+
* Throws error if token is invalid, expired, or blacklisted
|
|
613
|
+
*/
|
|
614
|
+
verifyAccessToken(token: string): Promise<JwtPayload>;
|
|
101
615
|
verifyRefreshToken(token: string): string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
616
|
+
getUser(auth: string): Promise<any>;
|
|
617
|
+
getTokenExpire(token: string): number | undefined;
|
|
618
|
+
/**
|
|
619
|
+
* Generate access token with unique jti for blacklist support
|
|
620
|
+
*/
|
|
105
621
|
generateAccessToken(data: {
|
|
106
622
|
userId: string;
|
|
107
623
|
}): string;
|
|
624
|
+
/**
|
|
625
|
+
* Generate refresh token with unique jti
|
|
626
|
+
*/
|
|
108
627
|
generateRefreshToken(data: {
|
|
109
628
|
userId: string;
|
|
110
629
|
}): string;
|
|
111
|
-
generateTokens(userId:
|
|
630
|
+
generateTokens(userId: string): Promise<{
|
|
112
631
|
accessToken: string;
|
|
113
632
|
refreshToken: string;
|
|
114
633
|
accessTokenExpiresAt: number;
|
|
115
634
|
refreshTokenExpiresAt: number;
|
|
116
635
|
}>;
|
|
636
|
+
/**
|
|
637
|
+
* Blacklist an access token by its jti
|
|
638
|
+
* Token will be rejected until it naturally expires
|
|
639
|
+
*/
|
|
640
|
+
blacklistToken(jti: string, expiresInSeconds: number): Promise<void>;
|
|
641
|
+
/**
|
|
642
|
+
* Check if a token is blacklisted
|
|
643
|
+
*/
|
|
644
|
+
isTokenBlacklisted(jti: string): Promise<boolean>;
|
|
645
|
+
/**
|
|
646
|
+
* Blacklist the current access token (for logout)
|
|
647
|
+
* Extracts jti and remaining TTL from the token
|
|
648
|
+
*/
|
|
649
|
+
blacklistCurrentToken(token: string): Promise<void>;
|
|
650
|
+
/**
|
|
651
|
+
* Store hashed refresh token in database for security
|
|
652
|
+
* This prevents token theft in case of database breach
|
|
653
|
+
*/
|
|
654
|
+
storeRefreshToken(userId: string, refreshToken: string): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* Refresh tokens with secure token comparison
|
|
657
|
+
* Compares provided token with hashed version in database
|
|
658
|
+
*/
|
|
117
659
|
refreshTokens(): Promise<{
|
|
118
660
|
accessToken: string;
|
|
119
661
|
refreshToken: string;
|
|
120
662
|
accessTokenExpiresAt: number;
|
|
121
663
|
refreshTokenExpiresAt: number;
|
|
122
664
|
}>;
|
|
123
|
-
revokeToken(userId:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
readonly FINANCIAL: readonly ["admin", "accounting"];
|
|
142
|
-
readonly STAFF: readonly ["admin", "principal", "accounting", "secretary", "teacher"];
|
|
143
|
-
readonly END_USERS: readonly ["student", "parent"];
|
|
144
|
-
readonly ALL: readonly ["admin", "principal", "accounting", "secretary", "teacher", "student", "parent"];
|
|
145
|
-
};
|
|
146
|
-
type RoleGroup = typeof ROLE_GROUPS[keyof typeof ROLE_GROUPS];
|
|
147
|
-
declare class RoleChecker {
|
|
148
|
-
isInGroup(userRole: any, group: readonly string[]): boolean;
|
|
149
|
-
isAdministrator(userRole: any): boolean;
|
|
150
|
-
isStaff(userRole: any): boolean;
|
|
151
|
-
hasAnyRole(userRole: any, roles: readonly string[]): boolean;
|
|
152
|
-
hasExactRole(userRole: any, requiredRole: any): boolean;
|
|
153
|
-
}
|
|
154
|
-
declare class RoleGuards {
|
|
155
|
-
private roleChecker;
|
|
156
|
-
private tokenService;
|
|
157
|
-
constructor(roleChecker: RoleChecker, tokenService: TokenService);
|
|
158
|
-
isAuth(auth: any, ctx: any): Promise<boolean>;
|
|
159
|
-
hasRoles(auth: any, ctx: any, roles: any): Promise<boolean>;
|
|
665
|
+
revokeToken(userId: string): Promise<any>;
|
|
666
|
+
/**
|
|
667
|
+
* Logout user - blacklist access token and revoke refresh token
|
|
668
|
+
*/
|
|
669
|
+
logout(userId: string, authorization?: string): Promise<void>;
|
|
670
|
+
/**
|
|
671
|
+
* Generate secure password reset token
|
|
672
|
+
* Returns both the plain token (to send via email) and userId for identification
|
|
673
|
+
*/
|
|
674
|
+
generateResetToken(userId: string): {
|
|
675
|
+
token: string;
|
|
676
|
+
userId: string;
|
|
677
|
+
};
|
|
678
|
+
/**
|
|
679
|
+
* Verify password reset token
|
|
680
|
+
* Returns userId if valid, throws error if expired/invalid
|
|
681
|
+
*/
|
|
682
|
+
verifyResetToken(token: string): string;
|
|
160
683
|
}
|
|
161
|
-
declare const isAdmin: () => (target: any, propertyKey?: string) => void;
|
|
162
|
-
declare const isPrincipal: () => (target: any, propertyKey?: string) => void;
|
|
163
|
-
declare const isAccounting: () => (target: any, propertyKey?: string) => void;
|
|
164
|
-
declare const isSecretary: () => (target: any, propertyKey?: string) => void;
|
|
165
|
-
declare const isTeacher: () => (target: any, propertyKey?: string) => void;
|
|
166
|
-
declare const isParent: () => (target: any, propertyKey?: string) => void;
|
|
167
|
-
declare const isStudent: () => (target: any, propertyKey?: string) => void;
|
|
168
|
-
declare const isAdministrator: () => (target: any, propertyKey?: string) => void;
|
|
169
|
-
declare const isFinancial: () => (target: any, propertyKey?: string) => void;
|
|
170
|
-
declare const isStaff: () => (target: any, propertyKey?: string) => void;
|
|
171
|
-
declare const isAuth: (...params: any[]) => (target: any, propertyKey?: string) => void;
|
|
172
|
-
type Role = typeof ROLES[keyof typeof ROLES];
|
|
173
|
-
declare const Role: (...roles: any[]) => (target: any, propertyKey?: string) => void;
|
|
174
684
|
|
|
175
|
-
declare
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
685
|
+
declare const createUserDto: z.ZodObject<{
|
|
686
|
+
email: z.ZodString;
|
|
687
|
+
password: z.ZodString;
|
|
688
|
+
username: z.ZodOptional<z.ZodString>;
|
|
689
|
+
roleId: z.ZodOptional<z.ZodString>;
|
|
690
|
+
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>]>>;
|
|
691
|
+
emailVerified: z.ZodDefault<z.ZodBoolean>;
|
|
692
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
693
|
+
active: "active";
|
|
694
|
+
inactive: "inactive";
|
|
695
|
+
pending: "pending";
|
|
696
|
+
}>>;
|
|
697
|
+
}, z.core.$strip>;
|
|
698
|
+
declare const updateUserDto: z.ZodObject<{
|
|
699
|
+
email: z.ZodOptional<z.ZodString>;
|
|
700
|
+
password: z.ZodOptional<z.ZodString>;
|
|
701
|
+
username: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
702
|
+
roleId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
703
|
+
image: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>]>>>;
|
|
704
|
+
emailVerified: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
705
|
+
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
706
|
+
active: "active";
|
|
707
|
+
inactive: "inactive";
|
|
708
|
+
pending: "pending";
|
|
709
|
+
}>>>;
|
|
710
|
+
}, z.core.$strip>;
|
|
711
|
+
declare const userIdParam: z.ZodObject<{
|
|
712
|
+
id: z.ZodString;
|
|
713
|
+
}, z.core.$strip>;
|
|
714
|
+
declare const loginDto: z.ZodObject<{
|
|
715
|
+
email: z.ZodString;
|
|
716
|
+
password: z.ZodString;
|
|
717
|
+
}, z.core.$strip>;
|
|
718
|
+
declare const changePasswordDto: z.ZodObject<{
|
|
719
|
+
currentPassword: z.ZodString;
|
|
720
|
+
newPassword: z.ZodString;
|
|
721
|
+
}, z.core.$strip>;
|
|
722
|
+
declare const resetPasswordDto: z.ZodObject<{
|
|
723
|
+
email: z.ZodString;
|
|
724
|
+
}, z.core.$strip>;
|
|
725
|
+
declare const confirmResetPasswordDto: z.ZodObject<{
|
|
726
|
+
token: z.ZodString;
|
|
727
|
+
newPassword: z.ZodString;
|
|
728
|
+
}, z.core.$strip>;
|
|
729
|
+
declare const languageParam: z.ZodObject<{
|
|
730
|
+
language: z.ZodString;
|
|
731
|
+
}, z.core.$strip>;
|
|
732
|
+
declare const emailParam: z.ZodObject<{
|
|
733
|
+
email: z.ZodString;
|
|
734
|
+
}, z.core.$strip>;
|
|
735
|
+
declare const userIdInParam: z.ZodObject<{
|
|
736
|
+
userId: z.ZodString;
|
|
737
|
+
}, z.core.$strip>;
|
|
738
|
+
declare const assignRoleParams: z.ZodObject<{
|
|
739
|
+
userId: z.ZodString;
|
|
740
|
+
roleId: z.ZodString;
|
|
741
|
+
}, z.core.$strip>;
|
|
742
|
+
type CreateUserDto = z.infer<typeof createUserDto>;
|
|
743
|
+
type UpdateUserDto = z.infer<typeof updateUserDto>;
|
|
744
|
+
type UserIdParam = z.infer<typeof userIdParam>;
|
|
745
|
+
type LoginDto = z.infer<typeof loginDto>;
|
|
746
|
+
type ChangePasswordDto = z.infer<typeof changePasswordDto>;
|
|
747
|
+
type ResetPasswordDto = z.infer<typeof resetPasswordDto>;
|
|
748
|
+
type ConfirmResetPasswordDto = z.infer<typeof confirmResetPasswordDto>;
|
|
749
|
+
type LanguageParam = z.infer<typeof languageParam>;
|
|
750
|
+
type EmailParam = z.infer<typeof emailParam>;
|
|
751
|
+
type UserIdInParam = z.infer<typeof userIdInParam>;
|
|
752
|
+
type AssignRoleParams = z.infer<typeof assignRoleParams>;
|
|
188
753
|
|
|
189
|
-
declare class
|
|
190
|
-
private
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
754
|
+
declare class AuthService {
|
|
755
|
+
private tokenService;
|
|
756
|
+
private userService;
|
|
757
|
+
private userValidator;
|
|
758
|
+
private cookieManager;
|
|
759
|
+
private i18nService;
|
|
760
|
+
private emailService;
|
|
761
|
+
private t;
|
|
762
|
+
private logger;
|
|
763
|
+
private static readonly DUMMY_HASH;
|
|
764
|
+
constructor(tokenService: TokenService, userService: UserService, userValidator: UserValidator, cookieManager: CookieManager, i18nService: I18nService, emailService: EmailService);
|
|
765
|
+
registerUser(body: CreateUserDto): Promise<SanitizedUser>;
|
|
766
|
+
loginUser(body: LoginDto): Promise<TokenPair>;
|
|
767
|
+
refreshTokens(): Promise<TokenPair>;
|
|
768
|
+
logoutUser(userId: string, authorization?: string): Promise<{
|
|
198
769
|
data: any;
|
|
199
770
|
message: string;
|
|
200
|
-
status: string;
|
|
201
771
|
}>;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
message: string;
|
|
205
|
-
status: string;
|
|
772
|
+
getUserProfile(userData: AuthUser): Promise<AuthUser & {
|
|
773
|
+
language: string;
|
|
206
774
|
}>;
|
|
207
|
-
|
|
208
|
-
data: any;
|
|
775
|
+
forgotPassword(email: string): Promise<{
|
|
209
776
|
message: string;
|
|
210
|
-
status: string;
|
|
211
777
|
}>;
|
|
212
|
-
|
|
213
|
-
data: any;
|
|
778
|
+
resetPassword(token: string, newPassword: string): Promise<{
|
|
214
779
|
message: string;
|
|
215
|
-
status: string;
|
|
216
780
|
}>;
|
|
217
781
|
}
|
|
218
782
|
|
|
219
|
-
declare class
|
|
220
|
-
private
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
private sanitizeUser;
|
|
227
|
-
private sanitizeUsers;
|
|
228
|
-
private resolveUserRole;
|
|
229
|
-
getAll(): Promise<any>;
|
|
230
|
-
getById(id: any): Promise<any>;
|
|
231
|
-
getByEmail(email: any): Promise<any>;
|
|
232
|
-
create(data: any): Promise<any>;
|
|
233
|
-
update(id: any, data: any): Promise<any>;
|
|
234
|
-
delete(id: any): Promise<any>;
|
|
235
|
-
deleteAll(): Promise<any>;
|
|
236
|
-
getRoleName(id: any): Promise<any>;
|
|
237
|
-
getPassword(email: any): Promise<any>;
|
|
238
|
-
assignRole(id: any, roleId: any, roleName?: any): Promise<any>;
|
|
239
|
-
removeRole(id: any): Promise<any>;
|
|
240
|
-
seedAdminUser(): Promise<any>;
|
|
241
|
-
updateLang(language: any): Promise<any>;
|
|
242
|
-
getLang(): Promise<string>;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
declare class UserController {
|
|
246
|
-
private userService;
|
|
247
|
-
constructor(userService: UserService);
|
|
248
|
-
getUsers(): Promise<{
|
|
249
|
-
data: any;
|
|
250
|
-
message: string;
|
|
251
|
-
status: string;
|
|
252
|
-
}>;
|
|
253
|
-
getLang(): Promise<{
|
|
254
|
-
data: {
|
|
255
|
-
language: string;
|
|
256
|
-
};
|
|
257
|
-
message: string;
|
|
258
|
-
status: string;
|
|
259
|
-
}>;
|
|
260
|
-
updateLang(language: any): Promise<{
|
|
261
|
-
data: any;
|
|
262
|
-
message: string;
|
|
263
|
-
status: string;
|
|
264
|
-
}>;
|
|
265
|
-
getUser(id: any): Promise<{
|
|
266
|
-
data: any;
|
|
267
|
-
message: string;
|
|
268
|
-
status: string;
|
|
269
|
-
}>;
|
|
270
|
-
getByEmail(email: any): Promise<{
|
|
271
|
-
data: any;
|
|
272
|
-
message: string;
|
|
273
|
-
status: string;
|
|
274
|
-
}>;
|
|
275
|
-
getRole(userId: any): Promise<{
|
|
276
|
-
data: any;
|
|
277
|
-
message: string;
|
|
278
|
-
status: string;
|
|
279
|
-
}>;
|
|
280
|
-
create(body: any): Promise<{
|
|
281
|
-
data: any;
|
|
282
|
-
message: string;
|
|
283
|
-
status: string;
|
|
284
|
-
}>;
|
|
285
|
-
update(id: any, body: any): Promise<{
|
|
286
|
-
data: any;
|
|
287
|
-
message: string;
|
|
288
|
-
status: string;
|
|
289
|
-
}>;
|
|
290
|
-
delete(id: any): Promise<{
|
|
783
|
+
declare class AuthController {
|
|
784
|
+
private authService;
|
|
785
|
+
constructor(authService: AuthService);
|
|
786
|
+
registerUser(body: CreateUserDto): Promise<SanitizedUser>;
|
|
787
|
+
loginUser(body: LoginDto): Promise<TokenPair>;
|
|
788
|
+
refreshTokens(): Promise<TokenPair>;
|
|
789
|
+
logoutUser(userId: string, authorization?: string): Promise<{
|
|
291
790
|
data: any;
|
|
292
791
|
message: string;
|
|
293
|
-
status: string;
|
|
294
792
|
}>;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
message: string;
|
|
298
|
-
status: string;
|
|
793
|
+
userProfile(user: any): Promise<AuthUser & {
|
|
794
|
+
language: string;
|
|
299
795
|
}>;
|
|
300
|
-
|
|
796
|
+
forgotPassword(body: ResetPasswordDto): Promise<{
|
|
301
797
|
message: string;
|
|
302
|
-
status: string;
|
|
303
798
|
}>;
|
|
304
|
-
|
|
799
|
+
resetPassword(body: ConfirmResetPasswordDto): Promise<{
|
|
305
800
|
message: string;
|
|
306
|
-
status: string;
|
|
307
801
|
}>;
|
|
308
802
|
}
|
|
309
803
|
|
|
310
|
-
declare class
|
|
804
|
+
declare class AuthGuard {
|
|
311
805
|
private tokenService;
|
|
312
|
-
|
|
313
|
-
private userValidator;
|
|
314
|
-
private cookieService;
|
|
315
|
-
constructor(tokenService: TokenService, userService: UserService, userValidator: UserValidator, cookieService: CookieService);
|
|
316
|
-
registerUser(body: any): Promise<any>;
|
|
317
|
-
loginUser(body: any): Promise<{
|
|
318
|
-
accessToken: string;
|
|
319
|
-
refreshToken: string;
|
|
320
|
-
accessTokenExpiresAt: number;
|
|
321
|
-
refreshTokenExpiresAt: number;
|
|
322
|
-
}>;
|
|
323
|
-
refreshTokens(): Promise<{
|
|
324
|
-
accessToken: string;
|
|
325
|
-
refreshToken: string;
|
|
326
|
-
accessTokenExpiresAt: number;
|
|
327
|
-
refreshTokenExpiresAt: number;
|
|
328
|
-
}>;
|
|
329
|
-
logoutUser(userId: any): Promise<{
|
|
330
|
-
data: any;
|
|
331
|
-
message: string;
|
|
332
|
-
}>;
|
|
333
|
-
getUserProfile(userData: any): Promise<any>;
|
|
334
|
-
forgotPassword(email: any): Promise<void>;
|
|
806
|
+
canActivate(auth: string): Promise<GuardResult | false>;
|
|
335
807
|
}
|
|
808
|
+
declare const isAuth: () => ClassDecorator & MethodDecorator;
|
|
336
809
|
|
|
337
|
-
declare
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
refreshToken: string;
|
|
359
|
-
accessTokenExpiresAt: number;
|
|
360
|
-
refreshTokenExpiresAt: number;
|
|
361
|
-
};
|
|
362
|
-
message: string;
|
|
363
|
-
status: string;
|
|
364
|
-
}>;
|
|
365
|
-
logoutUser(id: any): Promise<{
|
|
366
|
-
data: {
|
|
367
|
-
data: any;
|
|
368
|
-
message: string;
|
|
369
|
-
};
|
|
370
|
-
message: string;
|
|
371
|
-
status: string;
|
|
372
|
-
}>;
|
|
373
|
-
userProfile(user: any): Promise<{
|
|
374
|
-
data: any;
|
|
375
|
-
message: string;
|
|
376
|
-
status: string;
|
|
377
|
-
}>;
|
|
378
|
-
forgotPassword(body: any): Promise<{
|
|
379
|
-
data: void;
|
|
380
|
-
message: string;
|
|
381
|
-
status: string;
|
|
382
|
-
}>;
|
|
810
|
+
declare const AUTH_MODULE: readonly [typeof AuthService, typeof CookieManager, typeof EncryptionService, typeof AuthGuard, typeof AuthController];
|
|
811
|
+
|
|
812
|
+
declare class PermissionRepository {
|
|
813
|
+
db: TDb;
|
|
814
|
+
private schema;
|
|
815
|
+
private get permissions();
|
|
816
|
+
private get rolePermissions();
|
|
817
|
+
private get roles();
|
|
818
|
+
getAll(): Promise<Permission[]>;
|
|
819
|
+
getById(id: string): Promise<Permission | undefined>;
|
|
820
|
+
getByName(name: string): Promise<Permission | undefined>;
|
|
821
|
+
getByResource(resource: string): Promise<Permission[]>;
|
|
822
|
+
create(data: NewPermission): Promise<Permission>;
|
|
823
|
+
update(id: string, data: Partial<NewPermission>): Promise<Permission>;
|
|
824
|
+
delete(id: string): Promise<Permission>;
|
|
825
|
+
getPermissionsByRole(roleId: string): Promise<Array<Pick<Permission, 'id' | 'name' | 'description' | 'resource' | 'action'>>>;
|
|
826
|
+
getRolesByPermission(permissionId: string): Promise<Array<Pick<RoleEntity, 'id' | 'name' | 'description'>>>;
|
|
827
|
+
assignPermissionToRole(roleId: string, permissionId: string): Promise<RolePermission>;
|
|
828
|
+
removePermissionFromRole(roleId: string, permissionId: string): Promise<RolePermission>;
|
|
829
|
+
checkRoleHasPermission(roleId: string, permissionId: string): Promise<boolean>;
|
|
830
|
+
deleteAll(): Promise<Permission[]>;
|
|
383
831
|
}
|
|
384
832
|
|
|
385
|
-
declare
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
tokenType: {
|
|
399
|
-
values: string[];
|
|
400
|
-
translationKey: string;
|
|
401
|
-
};
|
|
402
|
-
fileStatus: {
|
|
403
|
-
values: string[];
|
|
404
|
-
translationKey: string;
|
|
405
|
-
};
|
|
406
|
-
gender: {
|
|
407
|
-
values: string[];
|
|
408
|
-
translationKey: string;
|
|
409
|
-
};
|
|
410
|
-
studentStatus: {
|
|
411
|
-
values: string[];
|
|
412
|
-
translationKey: string;
|
|
413
|
-
};
|
|
414
|
-
teacherStatus: {
|
|
415
|
-
values: string[];
|
|
416
|
-
translationKey: string;
|
|
417
|
-
};
|
|
418
|
-
employmentType: {
|
|
419
|
-
values: string[];
|
|
420
|
-
translationKey: string;
|
|
421
|
-
};
|
|
422
|
-
relationshipType: {
|
|
423
|
-
values: string[];
|
|
424
|
-
translationKey: string;
|
|
425
|
-
};
|
|
426
|
-
semester: {
|
|
427
|
-
values: string[];
|
|
428
|
-
translationKey: string;
|
|
429
|
-
};
|
|
430
|
-
classStatus: {
|
|
431
|
-
values: string[];
|
|
432
|
-
translationKey: string;
|
|
433
|
-
};
|
|
434
|
-
sectionStatus: {
|
|
435
|
-
values: string[];
|
|
436
|
-
translationKey: string;
|
|
437
|
-
};
|
|
438
|
-
language: {
|
|
439
|
-
values: string[];
|
|
440
|
-
translationKey: string;
|
|
441
|
-
};
|
|
442
|
-
enrollmentStatus: {
|
|
443
|
-
values: string[];
|
|
444
|
-
translationKey: string;
|
|
445
|
-
};
|
|
446
|
-
assignmentStatus: {
|
|
447
|
-
values: string[];
|
|
448
|
-
translationKey: string;
|
|
449
|
-
};
|
|
450
|
-
calendarSystem: {
|
|
451
|
-
values: string[];
|
|
452
|
-
translationKey: string;
|
|
453
|
-
};
|
|
454
|
-
assessmentType: {
|
|
455
|
-
values: string[];
|
|
456
|
-
translationKey: string;
|
|
457
|
-
};
|
|
458
|
-
assessmentStatus: {
|
|
459
|
-
values: string[];
|
|
460
|
-
translationKey: string;
|
|
461
|
-
};
|
|
462
|
-
submissionType: {
|
|
463
|
-
values: string[];
|
|
464
|
-
translationKey: string;
|
|
465
|
-
};
|
|
466
|
-
examType: {
|
|
467
|
-
values: string[];
|
|
468
|
-
translationKey: string;
|
|
469
|
-
};
|
|
470
|
-
examSecurity: {
|
|
471
|
-
values: string[];
|
|
472
|
-
translationKey: string;
|
|
473
|
-
};
|
|
474
|
-
examStatus: {
|
|
475
|
-
values: string[];
|
|
476
|
-
translationKey: string;
|
|
477
|
-
};
|
|
478
|
-
gradeStatus: {
|
|
479
|
-
values: string[];
|
|
480
|
-
translationKey: string;
|
|
481
|
-
};
|
|
482
|
-
attendanceStatus: {
|
|
483
|
-
values: string[];
|
|
484
|
-
translationKey: string;
|
|
485
|
-
};
|
|
486
|
-
proficiencyLevel: {
|
|
487
|
-
values: string[];
|
|
488
|
-
translationKey: string;
|
|
489
|
-
};
|
|
490
|
-
dayOfWeek: {
|
|
491
|
-
values: string[];
|
|
492
|
-
translationKey: string;
|
|
493
|
-
};
|
|
494
|
-
alertType: {
|
|
495
|
-
values: string[];
|
|
496
|
-
translationKey: string;
|
|
497
|
-
};
|
|
498
|
-
alertPriority: {
|
|
499
|
-
values: string[];
|
|
500
|
-
translationKey: string;
|
|
501
|
-
};
|
|
502
|
-
alertStatus: {
|
|
503
|
-
values: string[];
|
|
504
|
-
translationKey: string;
|
|
505
|
-
};
|
|
506
|
-
feeTypeStatus: {
|
|
507
|
-
values: string[];
|
|
508
|
-
translationKey: string;
|
|
509
|
-
};
|
|
510
|
-
feeCategory: {
|
|
511
|
-
values: string[];
|
|
512
|
-
translationKey: string;
|
|
513
|
-
};
|
|
514
|
-
paymentType: {
|
|
515
|
-
values: string[];
|
|
516
|
-
translationKey: string;
|
|
517
|
-
};
|
|
518
|
-
schedule: {
|
|
519
|
-
values: string[];
|
|
520
|
-
translationKey: string;
|
|
521
|
-
};
|
|
522
|
-
feeStatus: {
|
|
523
|
-
values: string[];
|
|
524
|
-
translationKey: string;
|
|
525
|
-
};
|
|
526
|
-
feeInstallmentStatus: {
|
|
527
|
-
values: string[];
|
|
528
|
-
translationKey: string;
|
|
529
|
-
};
|
|
530
|
-
paymentMethod: {
|
|
531
|
-
values: string[];
|
|
532
|
-
translationKey: string;
|
|
533
|
-
};
|
|
534
|
-
paymentStatus: {
|
|
535
|
-
values: string[];
|
|
536
|
-
translationKey: string;
|
|
537
|
-
};
|
|
538
|
-
eventType: {
|
|
539
|
-
values: string[];
|
|
540
|
-
translationKey: string;
|
|
541
|
-
};
|
|
542
|
-
eventStatus: {
|
|
543
|
-
values: string[];
|
|
544
|
-
translationKey: string;
|
|
545
|
-
};
|
|
546
|
-
eventVisibility: {
|
|
547
|
-
values: string[];
|
|
548
|
-
translationKey: string;
|
|
549
|
-
};
|
|
550
|
-
participantType: {
|
|
551
|
-
values: string[];
|
|
552
|
-
translationKey: string;
|
|
553
|
-
};
|
|
554
|
-
expenseCategory: {
|
|
555
|
-
values: string[];
|
|
556
|
-
translationKey: string;
|
|
557
|
-
};
|
|
558
|
-
expenseStatus: {
|
|
559
|
-
values: string[];
|
|
560
|
-
translationKey: string;
|
|
561
|
-
};
|
|
562
|
-
trackerMode: {
|
|
563
|
-
values: string[];
|
|
564
|
-
translationKey: string;
|
|
565
|
-
};
|
|
566
|
-
driverStatus: {
|
|
567
|
-
values: string[];
|
|
568
|
-
translationKey: string;
|
|
569
|
-
};
|
|
570
|
-
vehicleStatus: {
|
|
571
|
-
values: string[];
|
|
572
|
-
translationKey: string;
|
|
573
|
-
};
|
|
574
|
-
vehicleType: {
|
|
575
|
-
values: string[];
|
|
576
|
-
translationKey: string;
|
|
577
|
-
};
|
|
578
|
-
vehicleDocumentType: {
|
|
579
|
-
values: string[];
|
|
580
|
-
translationKey: string;
|
|
581
|
-
};
|
|
582
|
-
busStatus: {
|
|
583
|
-
values: string[];
|
|
584
|
-
translationKey: string;
|
|
585
|
-
};
|
|
586
|
-
refuelStatus: {
|
|
587
|
-
values: string[];
|
|
588
|
-
translationKey: string;
|
|
589
|
-
};
|
|
590
|
-
fuelType: {
|
|
591
|
-
values: string[];
|
|
592
|
-
translationKey: string;
|
|
593
|
-
};
|
|
594
|
-
maintenanceType: {
|
|
595
|
-
values: string[];
|
|
596
|
-
translationKey: string;
|
|
597
|
-
};
|
|
598
|
-
maintenanceStatus: {
|
|
599
|
-
values: string[];
|
|
600
|
-
translationKey: string;
|
|
601
|
-
};
|
|
602
|
-
maritalStatus: {
|
|
603
|
-
values: string[];
|
|
604
|
-
translationKey: string;
|
|
605
|
-
};
|
|
833
|
+
declare class PermissionGuard {
|
|
834
|
+
canActivate(requiredPermission: string, permissions: string[]): GuardResult | false;
|
|
835
|
+
private checkPermission;
|
|
836
|
+
}
|
|
837
|
+
declare const Can: (permission: string) => ClassDecorator & MethodDecorator;
|
|
838
|
+
declare const canCreate: (resource: string) => ClassDecorator & MethodDecorator;
|
|
839
|
+
declare const canRead: (resource: string) => ClassDecorator & MethodDecorator;
|
|
840
|
+
declare const canUpdate: (resource: string) => ClassDecorator & MethodDecorator;
|
|
841
|
+
declare const canDelete: (resource: string) => ClassDecorator & MethodDecorator;
|
|
842
|
+
declare const canManage: (resource: string) => ClassDecorator & MethodDecorator;
|
|
843
|
+
|
|
844
|
+
declare const ROLES: {
|
|
845
|
+
readonly ADMIN: "admin";
|
|
606
846
|
};
|
|
607
|
-
declare const
|
|
608
|
-
|
|
847
|
+
declare const ROLE_GROUPS: {
|
|
848
|
+
ADMINISTRATORS: "admin"[];
|
|
849
|
+
};
|
|
850
|
+
type RoleType = typeof ROLES[keyof typeof ROLES];
|
|
851
|
+
type RoleInput = string | string[];
|
|
609
852
|
|
|
610
|
-
declare
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
status: z.ZodEnum<{
|
|
621
|
-
[x: string]: any;
|
|
622
|
-
}>;
|
|
623
|
-
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
624
|
-
}, z.core.$strip>;
|
|
625
|
-
declare const roleSchema: z.ZodObject<{
|
|
626
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
627
|
-
name: z.ZodString;
|
|
628
|
-
description: z.ZodOptional<z.ZodString>;
|
|
629
|
-
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
630
|
-
}, z.core.$strip>;
|
|
631
|
-
declare const studentSchema: z.ZodObject<{
|
|
632
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
633
|
-
classId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
634
|
-
sectionId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
635
|
-
studentCode: z.ZodString;
|
|
636
|
-
name: z.ZodString;
|
|
637
|
-
email: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
638
|
-
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
639
|
-
address: z.ZodOptional<z.ZodString>;
|
|
640
|
-
dateOfBirth: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
641
|
-
gender: z.ZodEnum<{
|
|
642
|
-
[x: string]: any;
|
|
643
|
-
}>;
|
|
644
|
-
enrollmentDate: z.ZodString;
|
|
645
|
-
medicalConditions: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
646
|
-
previousSchool: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
647
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
648
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
649
|
-
[x: string]: any;
|
|
650
|
-
}>>;
|
|
651
|
-
}, z.core.$strip>;
|
|
652
|
-
declare const parentSchema: z.ZodObject<{
|
|
653
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
654
|
-
name: z.ZodString;
|
|
655
|
-
email: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>;
|
|
656
|
-
phone: z.ZodString;
|
|
657
|
-
gender: z.ZodOptional<z.ZodEnum<{
|
|
658
|
-
[x: string]: any;
|
|
659
|
-
}>>;
|
|
660
|
-
address: z.ZodOptional<z.ZodString>;
|
|
661
|
-
dateOfBirth: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
662
|
-
cin: z.ZodString;
|
|
663
|
-
occupation: z.ZodOptional<z.ZodString>;
|
|
664
|
-
nationality: z.ZodOptional<z.ZodString>;
|
|
665
|
-
maritalStatus: z.ZodOptional<z.ZodString>;
|
|
666
|
-
relationshipType: z.ZodEnum<{
|
|
667
|
-
[x: string]: any;
|
|
668
|
-
}>;
|
|
669
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
670
|
-
isEmergencyContact: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
671
|
-
financialResponsibility: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
672
|
-
}, z.core.$strip>;
|
|
673
|
-
declare const driverSchema: z.ZodObject<{
|
|
674
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
675
|
-
name: z.ZodString;
|
|
676
|
-
email: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
677
|
-
cin: z.ZodString;
|
|
678
|
-
phone: z.ZodString;
|
|
679
|
-
address: z.ZodOptional<z.ZodString>;
|
|
680
|
-
gender: z.ZodOptional<z.ZodEnum<{
|
|
681
|
-
[x: string]: any;
|
|
682
|
-
}>>;
|
|
683
|
-
licenseNumber: z.ZodString;
|
|
684
|
-
licenseType: z.ZodString;
|
|
685
|
-
licenseExpiry: z.ZodString;
|
|
686
|
-
hireDate: z.ZodString;
|
|
687
|
-
salary: any;
|
|
688
|
-
yearsOfExperience: any;
|
|
689
|
-
emergencyContact: z.ZodOptional<z.ZodString>;
|
|
690
|
-
emergencyPhone: z.ZodOptional<z.ZodString>;
|
|
691
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
692
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
693
|
-
[x: string]: any;
|
|
694
|
-
}>>;
|
|
695
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
696
|
-
}, z.core.$strip>;
|
|
697
|
-
declare const teacherPersonalSchema: z.ZodObject<{
|
|
698
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
699
|
-
name: z.ZodString;
|
|
700
|
-
cin: z.ZodString;
|
|
701
|
-
email: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
702
|
-
phone: z.ZodString;
|
|
703
|
-
address: z.ZodOptional<z.ZodString>;
|
|
704
|
-
gender: z.ZodOptional<z.ZodEnum<{
|
|
705
|
-
[x: string]: any;
|
|
706
|
-
}>>;
|
|
707
|
-
emergencyContact: z.ZodOptional<z.ZodString>;
|
|
708
|
-
emergencyPhone: z.ZodString;
|
|
709
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
710
|
-
[x: string]: any;
|
|
711
|
-
}>>;
|
|
712
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
713
|
-
}, z.core.$strip>;
|
|
714
|
-
declare const teacherProfessionalSchema: z.ZodObject<{
|
|
715
|
-
specialization: z.ZodOptional<z.ZodString>;
|
|
716
|
-
yearsOfExperience: any;
|
|
717
|
-
salary: any;
|
|
718
|
-
hireDate: z.ZodString;
|
|
719
|
-
bankAccount: z.ZodOptional<z.ZodCoercedString<unknown>>;
|
|
720
|
-
employmentType: z.ZodOptional<z.ZodEnum<{
|
|
721
|
-
[x: string]: any;
|
|
722
|
-
}>>;
|
|
723
|
-
workloadHours: any;
|
|
724
|
-
academicDegrees: z.ZodOptional<z.ZodString>;
|
|
725
|
-
}, z.core.$strip>;
|
|
726
|
-
declare const assignmentSchema: z.ZodObject<{
|
|
727
|
-
classId: z.ZodString;
|
|
728
|
-
sectionIds: z.ZodArray<z.ZodString>;
|
|
729
|
-
subjectIds: z.ZodArray<z.ZodString>;
|
|
730
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
731
|
-
}, z.core.$strip>;
|
|
732
|
-
declare const assignmentsSchema: z.ZodObject<{
|
|
733
|
-
assignments: z.ZodArray<z.ZodObject<{
|
|
734
|
-
classId: z.ZodString;
|
|
735
|
-
sectionIds: z.ZodArray<z.ZodString>;
|
|
736
|
-
subjectIds: z.ZodArray<z.ZodString>;
|
|
737
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
738
|
-
}, z.core.$strip>>;
|
|
739
|
-
}, z.core.$strip>;
|
|
740
|
-
declare const teacherFullSchema: z.ZodObject<{
|
|
741
|
-
assignments: z.ZodArray<z.ZodObject<{
|
|
742
|
-
classId: z.ZodString;
|
|
743
|
-
sectionIds: z.ZodArray<z.ZodString>;
|
|
744
|
-
subjectIds: z.ZodArray<z.ZodString>;
|
|
745
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
746
|
-
}, z.core.$strip>>;
|
|
747
|
-
specialization: z.ZodOptional<z.ZodString>;
|
|
748
|
-
yearsOfExperience: any;
|
|
749
|
-
salary: any;
|
|
750
|
-
hireDate: z.ZodString;
|
|
751
|
-
bankAccount: z.ZodOptional<z.ZodCoercedString<unknown>>;
|
|
752
|
-
employmentType: z.ZodOptional<z.ZodEnum<{
|
|
753
|
-
[x: string]: any;
|
|
754
|
-
}>>;
|
|
755
|
-
workloadHours: any;
|
|
756
|
-
academicDegrees: z.ZodOptional<z.ZodString>;
|
|
757
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
758
|
-
name: z.ZodString;
|
|
759
|
-
cin: z.ZodString;
|
|
760
|
-
email: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
761
|
-
phone: z.ZodString;
|
|
762
|
-
address: z.ZodOptional<z.ZodString>;
|
|
763
|
-
gender: z.ZodOptional<z.ZodEnum<{
|
|
764
|
-
[x: string]: any;
|
|
765
|
-
}>>;
|
|
766
|
-
emergencyContact: z.ZodOptional<z.ZodString>;
|
|
767
|
-
emergencyPhone: z.ZodString;
|
|
768
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
769
|
-
[x: string]: any;
|
|
770
|
-
}>>;
|
|
771
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
772
|
-
}, z.core.$strip>;
|
|
773
|
-
declare const feeTypeSchema: z.ZodObject<{
|
|
774
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
775
|
-
name: z.ZodString;
|
|
776
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
777
|
-
category: z.ZodString;
|
|
778
|
-
amount: any;
|
|
779
|
-
paymentType: z.ZodDefault<z.ZodEnum<{
|
|
780
|
-
[x: string]: any;
|
|
781
|
-
}>>;
|
|
782
|
-
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
783
|
-
[x: string]: any;
|
|
784
|
-
}>>>;
|
|
785
|
-
}, z.core.$strip>;
|
|
786
|
-
declare const feeSchema: z.ZodObject<{
|
|
787
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
788
|
-
studentId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
789
|
-
feeTypeId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
790
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
791
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
792
|
-
[x: string]: any;
|
|
793
|
-
}>>;
|
|
794
|
-
schedule: z.ZodEnum<{
|
|
795
|
-
[x: string]: any;
|
|
796
|
-
}>;
|
|
797
|
-
baseAmount: any;
|
|
798
|
-
grossAmount: any;
|
|
799
|
-
netAmount: any;
|
|
800
|
-
paidAmount: any;
|
|
801
|
-
discountAmount: any;
|
|
802
|
-
discountReason: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
803
|
-
assignedBy: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
804
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
805
|
-
}, z.core.$strip>;
|
|
806
|
-
declare const bulkFeeItemSchema: z.ZodObject<{
|
|
807
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
808
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
809
|
-
[x: string]: any;
|
|
810
|
-
}>>;
|
|
811
|
-
schedule: z.ZodEnum<{
|
|
812
|
-
[x: string]: any;
|
|
813
|
-
}>;
|
|
814
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
815
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
816
|
-
feeTypeId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
817
|
-
baseAmount: any;
|
|
818
|
-
grossAmount: any;
|
|
819
|
-
netAmount: any;
|
|
820
|
-
paidAmount: any;
|
|
821
|
-
discountAmount: any;
|
|
822
|
-
discountReason: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
823
|
-
assignedBy: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
824
|
-
}, z.core.$strip>;
|
|
825
|
-
declare const bulkFeeFormSchema: z.ZodObject<{
|
|
826
|
-
studentId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
827
|
-
fees: z.ZodArray<z.ZodObject<{
|
|
828
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
829
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
830
|
-
[x: string]: any;
|
|
831
|
-
}>>;
|
|
832
|
-
schedule: z.ZodEnum<{
|
|
833
|
-
[x: string]: any;
|
|
834
|
-
}>;
|
|
835
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
836
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
837
|
-
feeTypeId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
838
|
-
baseAmount: any;
|
|
839
|
-
grossAmount: any;
|
|
840
|
-
netAmount: any;
|
|
841
|
-
paidAmount: any;
|
|
842
|
-
discountAmount: any;
|
|
843
|
-
discountReason: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
844
|
-
assignedBy: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
845
|
-
}, z.core.$strip>>;
|
|
846
|
-
}, z.core.$strip>;
|
|
847
|
-
declare const feeInstallmentSchema: z.ZodObject<{
|
|
848
|
-
feeId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
849
|
-
number: any;
|
|
850
|
-
dueDate: z.ZodString;
|
|
851
|
-
amount: any;
|
|
852
|
-
paidAmount: any;
|
|
853
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
854
|
-
[x: string]: any;
|
|
855
|
-
}>>;
|
|
856
|
-
}, z.core.$strip>;
|
|
857
|
-
declare const feePaymentSchema: z.ZodObject<{
|
|
858
|
-
studentId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
859
|
-
amount: any;
|
|
860
|
-
paymentMethod: z.ZodEnum<{
|
|
861
|
-
[x: string]: any;
|
|
862
|
-
}>;
|
|
863
|
-
paymentDate: z.ZodString;
|
|
864
|
-
checkNumber: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
865
|
-
checkDueDate: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
866
|
-
transactionRef: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
867
|
-
receiptNumber: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
868
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
869
|
-
[x: string]: any;
|
|
870
|
-
}>>;
|
|
871
|
-
processedBy: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
872
|
-
notes: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
873
|
-
allocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
874
|
-
feeId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
875
|
-
number: z.ZodNumber;
|
|
876
|
-
amount: any;
|
|
877
|
-
}, z.core.$strip>>>>;
|
|
878
|
-
}, z.core.$strip>;
|
|
879
|
-
declare const paymentAllocationSchema: z.ZodObject<{
|
|
880
|
-
paymentId: z.ZodString;
|
|
881
|
-
feeId: z.ZodString;
|
|
882
|
-
installmentId: z.ZodOptional<z.ZodString>;
|
|
883
|
-
amount: z.ZodNumber;
|
|
884
|
-
type: z.ZodDefault<z.ZodEnum<{
|
|
885
|
-
fee: "fee";
|
|
886
|
-
installment: "installment";
|
|
887
|
-
}>>;
|
|
888
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
889
|
-
}, z.core.$strip>;
|
|
890
|
-
declare const parentsSchema: z.ZodObject<{
|
|
891
|
-
parents: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
892
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
893
|
-
name: z.ZodString;
|
|
894
|
-
email: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>;
|
|
895
|
-
phone: z.ZodString;
|
|
896
|
-
gender: z.ZodOptional<z.ZodEnum<{
|
|
897
|
-
[x: string]: any;
|
|
898
|
-
}>>;
|
|
899
|
-
address: z.ZodOptional<z.ZodString>;
|
|
900
|
-
dateOfBirth: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
901
|
-
cin: z.ZodString;
|
|
902
|
-
occupation: z.ZodOptional<z.ZodString>;
|
|
903
|
-
nationality: z.ZodOptional<z.ZodString>;
|
|
904
|
-
maritalStatus: z.ZodOptional<z.ZodString>;
|
|
905
|
-
relationshipType: z.ZodEnum<{
|
|
906
|
-
[x: string]: any;
|
|
907
|
-
}>;
|
|
908
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
909
|
-
isEmergencyContact: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
910
|
-
financialResponsibility: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
911
|
-
}, z.core.$strip>>>>;
|
|
912
|
-
}, z.core.$strip>;
|
|
913
|
-
declare const feesSchema: z.ZodObject<{
|
|
914
|
-
fees: z.ZodArray<z.ZodObject<{
|
|
915
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
916
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
917
|
-
[x: string]: any;
|
|
918
|
-
}>>;
|
|
919
|
-
schedule: z.ZodEnum<{
|
|
920
|
-
[x: string]: any;
|
|
921
|
-
}>;
|
|
922
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
923
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
924
|
-
feeTypeId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
925
|
-
baseAmount: any;
|
|
926
|
-
grossAmount: any;
|
|
927
|
-
netAmount: any;
|
|
928
|
-
paidAmount: any;
|
|
929
|
-
discountAmount: any;
|
|
930
|
-
discountReason: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
931
|
-
assignedBy: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
932
|
-
}, z.core.$strip>>;
|
|
933
|
-
}, z.core.$strip>;
|
|
934
|
-
declare const fullStudentSchema: z.ZodObject<{
|
|
935
|
-
fees: z.ZodArray<z.ZodObject<{
|
|
936
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
937
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
938
|
-
[x: string]: any;
|
|
939
|
-
}>>;
|
|
940
|
-
schedule: z.ZodEnum<{
|
|
941
|
-
[x: string]: any;
|
|
942
|
-
}>;
|
|
943
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
944
|
-
academicYear: z.ZodOptional<z.ZodString>;
|
|
945
|
-
feeTypeId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
946
|
-
baseAmount: any;
|
|
947
|
-
grossAmount: any;
|
|
948
|
-
netAmount: any;
|
|
949
|
-
paidAmount: any;
|
|
950
|
-
discountAmount: any;
|
|
951
|
-
discountReason: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
952
|
-
assignedBy: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
953
|
-
}, z.core.$strip>>;
|
|
954
|
-
parents: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
955
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
956
|
-
name: z.ZodString;
|
|
957
|
-
email: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>;
|
|
958
|
-
phone: z.ZodString;
|
|
959
|
-
gender: z.ZodOptional<z.ZodEnum<{
|
|
960
|
-
[x: string]: any;
|
|
961
|
-
}>>;
|
|
962
|
-
address: z.ZodOptional<z.ZodString>;
|
|
963
|
-
dateOfBirth: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
964
|
-
cin: z.ZodString;
|
|
965
|
-
occupation: z.ZodOptional<z.ZodString>;
|
|
966
|
-
nationality: z.ZodOptional<z.ZodString>;
|
|
967
|
-
maritalStatus: z.ZodOptional<z.ZodString>;
|
|
968
|
-
relationshipType: z.ZodEnum<{
|
|
969
|
-
[x: string]: any;
|
|
970
|
-
}>;
|
|
971
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
972
|
-
isEmergencyContact: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
973
|
-
financialResponsibility: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
974
|
-
}, z.core.$strip>>>>;
|
|
975
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
976
|
-
classId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
977
|
-
sectionId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
978
|
-
studentCode: z.ZodString;
|
|
979
|
-
name: z.ZodString;
|
|
980
|
-
email: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
981
|
-
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
982
|
-
address: z.ZodOptional<z.ZodString>;
|
|
983
|
-
dateOfBirth: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
984
|
-
gender: z.ZodEnum<{
|
|
985
|
-
[x: string]: any;
|
|
986
|
-
}>;
|
|
987
|
-
enrollmentDate: z.ZodString;
|
|
988
|
-
medicalConditions: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
989
|
-
previousSchool: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
990
|
-
image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<File, File>, z.ZodNull]>>;
|
|
991
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
992
|
-
[x: string]: any;
|
|
993
|
-
}>>;
|
|
994
|
-
}, z.core.$strip>;
|
|
995
|
-
declare const subjectSchema: z.ZodObject<{
|
|
996
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
997
|
-
code: z.ZodString;
|
|
998
|
-
name: z.ZodString;
|
|
999
|
-
description: z.ZodOptional<z.ZodString>;
|
|
1000
|
-
gradeLevel: any;
|
|
1001
|
-
}, z.core.$strip>;
|
|
1002
|
-
declare const sectionSchema: z.ZodObject<{
|
|
1003
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1004
|
-
classId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1005
|
-
name: z.ZodString;
|
|
1006
|
-
maxStudents: any;
|
|
1007
|
-
roomNumber: any;
|
|
1008
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1009
|
-
[x: string]: any;
|
|
1010
|
-
}>>;
|
|
1011
|
-
}, z.core.$strip>;
|
|
1012
|
-
declare const classSchema: z.ZodObject<{
|
|
1013
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
853
|
+
declare class RoleGuard {
|
|
854
|
+
canActivate(allowedRoles: RoleInput, userRole: string): false | {
|
|
855
|
+
role: string;
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
declare const Role: (roles: RoleInput) => any;
|
|
859
|
+
declare const isAdmin: () => ClassDecorator & MethodDecorator;
|
|
860
|
+
declare const isAdministrator: () => ClassDecorator & MethodDecorator;
|
|
861
|
+
|
|
862
|
+
declare const createRoleDto: z.ZodObject<{
|
|
1014
863
|
name: z.ZodString;
|
|
1015
864
|
description: z.ZodOptional<z.ZodString>;
|
|
1016
|
-
academicYear: z.ZodString;
|
|
1017
|
-
level: z.ZodString;
|
|
1018
865
|
}, z.core.$strip>;
|
|
1019
|
-
declare const
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
subjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1023
|
-
sectionId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1024
|
-
date: z.ZodString;
|
|
1025
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1026
|
-
[x: string]: any;
|
|
1027
|
-
}>>;
|
|
1028
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
1029
|
-
}, z.core.$strip>;
|
|
1030
|
-
declare const assessmentSchema: z.ZodObject<{
|
|
1031
|
-
classId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1032
|
-
sectionId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1033
|
-
subjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1034
|
-
teacherId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1035
|
-
teacherAssignmentId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1036
|
-
title: z.ZodString;
|
|
1037
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1038
|
-
type: z.ZodDefault<z.ZodEnum<{
|
|
1039
|
-
[x: string]: any;
|
|
1040
|
-
}>>;
|
|
1041
|
-
date: z.ZodString;
|
|
1042
|
-
duration: any;
|
|
1043
|
-
totalMarks: any;
|
|
1044
|
-
passingMarks: any;
|
|
1045
|
-
instructions: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1046
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1047
|
-
[x: string]: any;
|
|
1048
|
-
}>>;
|
|
1049
|
-
assessmentId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1050
|
-
}, z.core.$strip>;
|
|
1051
|
-
declare const bulkAssessmentSchema: z.ZodObject<{
|
|
1052
|
-
assessments: z.ZodArray<z.ZodObject<{
|
|
1053
|
-
classId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1054
|
-
sectionId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1055
|
-
subjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1056
|
-
teacherId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1057
|
-
teacherAssignmentId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1058
|
-
title: z.ZodString;
|
|
1059
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1060
|
-
type: z.ZodDefault<z.ZodEnum<{
|
|
1061
|
-
[x: string]: any;
|
|
1062
|
-
}>>;
|
|
1063
|
-
date: z.ZodString;
|
|
1064
|
-
duration: any;
|
|
1065
|
-
totalMarks: any;
|
|
1066
|
-
passingMarks: any;
|
|
1067
|
-
instructions: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1068
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1069
|
-
[x: string]: any;
|
|
1070
|
-
}>>;
|
|
1071
|
-
assessmentId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1072
|
-
}, z.core.$strip>>;
|
|
866
|
+
declare const updateRoleDto: z.ZodObject<{
|
|
867
|
+
name: z.ZodOptional<z.ZodString>;
|
|
868
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1073
869
|
}, z.core.$strip>;
|
|
1074
|
-
declare const
|
|
1075
|
-
|
|
1076
|
-
teacherId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1077
|
-
subjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1078
|
-
sectionId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1079
|
-
studentId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1080
|
-
gradeId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1081
|
-
assessmentTitle: z.ZodOptional<z.ZodString>;
|
|
1082
|
-
marksObtained: any;
|
|
1083
|
-
feedback: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1084
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1085
|
-
[x: string]: any;
|
|
1086
|
-
}>>;
|
|
1087
|
-
}, z.core.$strip>;
|
|
1088
|
-
declare const examSchema: z.ZodObject<{
|
|
1089
|
-
classId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1090
|
-
sectionId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1091
|
-
subjectId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1092
|
-
teacherId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1093
|
-
examId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1094
|
-
teacherAssignmentId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
1095
|
-
title: z.ZodString;
|
|
1096
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1097
|
-
type: z.ZodDefault<z.ZodEnum<{
|
|
1098
|
-
[x: string]: any;
|
|
1099
|
-
}>>;
|
|
1100
|
-
date: z.ZodString;
|
|
1101
|
-
startTime: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1102
|
-
endTime: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1103
|
-
duration: any;
|
|
1104
|
-
totalMarks: any;
|
|
1105
|
-
passingMarks: any;
|
|
1106
|
-
roomNumber: any;
|
|
1107
|
-
allowedMaterials: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1108
|
-
instructions: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1109
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1110
|
-
[x: string]: any;
|
|
1111
|
-
}>>;
|
|
870
|
+
declare const roleIdParam: z.ZodObject<{
|
|
871
|
+
id: z.ZodString;
|
|
1112
872
|
}, z.core.$strip>;
|
|
1113
|
-
declare const
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
authorId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1117
|
-
targetAudience: z.ZodEnum<{
|
|
1118
|
-
teachers: "teachers";
|
|
1119
|
-
students: "students";
|
|
1120
|
-
parents: "parents";
|
|
1121
|
-
all: "all";
|
|
1122
|
-
class: "class";
|
|
1123
|
-
}>;
|
|
1124
|
-
classId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1125
|
-
isPublished: z.ZodDefault<z.ZodBoolean>;
|
|
1126
|
-
publishDate: z.ZodOptional<z.ZodString>;
|
|
1127
|
-
expiryDate: z.ZodOptional<z.ZodString>;
|
|
873
|
+
declare const assignRoleDto: z.ZodObject<{
|
|
874
|
+
userId: z.ZodString;
|
|
875
|
+
roleId: z.ZodString;
|
|
1128
876
|
}, z.core.$strip>;
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}>>;
|
|
1151
|
-
authorId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1152
|
-
isRead: z.ZodDefault<z.ZodBoolean>;
|
|
1153
|
-
}, z.core.$strip>;
|
|
1154
|
-
declare const eventSchema: z.ZodObject<{
|
|
1155
|
-
title: z.ZodString;
|
|
1156
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1157
|
-
type: z.ZodEnum<{
|
|
1158
|
-
[x: string]: any;
|
|
1159
|
-
}>;
|
|
1160
|
-
startDate: z.ZodString;
|
|
1161
|
-
endDate: z.ZodString;
|
|
1162
|
-
startTime: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1163
|
-
endTime: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1164
|
-
location: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1165
|
-
venue: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1166
|
-
organizerId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1167
|
-
classId: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
1168
|
-
sectionId: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
1169
|
-
visibility: z.ZodDefault<z.ZodEnum<{
|
|
1170
|
-
[x: string]: any;
|
|
1171
|
-
}>>;
|
|
1172
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1173
|
-
[x: string]: any;
|
|
1174
|
-
}>>;
|
|
1175
|
-
capacity: any;
|
|
1176
|
-
registrationRequired: z.ZodDefault<z.ZodBoolean>;
|
|
1177
|
-
registrationDeadline: z.ZodNullable<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1178
|
-
attachments: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
1179
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1180
|
-
}, z.core.$strip>;
|
|
1181
|
-
declare const eventParticipantSchema: z.ZodObject<{
|
|
1182
|
-
eventId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1183
|
-
participantId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1184
|
-
participantType: z.ZodEnum<{
|
|
1185
|
-
[x: string]: any;
|
|
877
|
+
type CreateRoleDto = z.infer<typeof createRoleDto>;
|
|
878
|
+
type UpdateRoleDto = z.infer<typeof updateRoleDto>;
|
|
879
|
+
type RoleIdParam = z.infer<typeof roleIdParam>;
|
|
880
|
+
type AssignRoleDto = z.infer<typeof assignRoleDto>;
|
|
881
|
+
|
|
882
|
+
declare class RoleController {
|
|
883
|
+
private roleService;
|
|
884
|
+
constructor(roleService: RoleService);
|
|
885
|
+
getRoles(): Promise<{
|
|
886
|
+
description: string;
|
|
887
|
+
name: string;
|
|
888
|
+
id: string;
|
|
889
|
+
createdAt: string;
|
|
890
|
+
updatedAt: string;
|
|
891
|
+
}[]>;
|
|
892
|
+
getRole(params: RoleIdParam): Promise<{
|
|
893
|
+
description: string;
|
|
894
|
+
name: string;
|
|
895
|
+
id: string;
|
|
896
|
+
createdAt: string;
|
|
897
|
+
updatedAt: string;
|
|
1186
898
|
}>;
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1194
|
-
category: z.ZodEnum<{
|
|
1195
|
-
[x: string]: any;
|
|
899
|
+
createRole(body: CreateRoleDto): Promise<{
|
|
900
|
+
description: string;
|
|
901
|
+
name: string;
|
|
902
|
+
id: string;
|
|
903
|
+
createdAt: string;
|
|
904
|
+
updatedAt: string;
|
|
1196
905
|
}>;
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
paymentDate: z.ZodNullable<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1204
|
-
vendor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1205
|
-
invoiceNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1206
|
-
receiptNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1207
|
-
checkNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1208
|
-
transactionRef: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1209
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1210
|
-
[x: string]: any;
|
|
1211
|
-
}>>;
|
|
1212
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1213
|
-
}, z.core.$strip>;
|
|
1214
|
-
declare const expenseApprovalSchema: z.ZodObject<{
|
|
1215
|
-
action: z.ZodEnum<{
|
|
1216
|
-
approve: "approve";
|
|
1217
|
-
reject: "reject";
|
|
906
|
+
updateRole(params: RoleIdParam, body: UpdateRoleDto): Promise<{
|
|
907
|
+
description: string;
|
|
908
|
+
name: string;
|
|
909
|
+
id: string;
|
|
910
|
+
createdAt: string;
|
|
911
|
+
updatedAt: string;
|
|
1218
912
|
}>;
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
913
|
+
deleteRole(params: RoleIdParam): Promise<{
|
|
914
|
+
description: string;
|
|
915
|
+
name: string;
|
|
916
|
+
id: string;
|
|
917
|
+
createdAt: string;
|
|
918
|
+
updatedAt: string;
|
|
1224
919
|
}>;
|
|
1225
|
-
paymentDate: z.ZodString;
|
|
1226
|
-
checkNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1227
|
-
transactionRef: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1228
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1229
|
-
}, z.core.$strip>;
|
|
1230
|
-
declare const vehicleSchema: z.ZodObject<{
|
|
1231
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1232
|
-
name: z.ZodString;
|
|
1233
|
-
brand: z.ZodString;
|
|
1234
|
-
model: z.ZodString;
|
|
1235
|
-
year: any;
|
|
1236
|
-
type: z.ZodDefault<z.ZodEnum<{
|
|
1237
|
-
[x: string]: any;
|
|
1238
|
-
}>>;
|
|
1239
|
-
capacity: any;
|
|
1240
|
-
licensePlate: z.ZodString;
|
|
1241
|
-
driverId: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
1242
|
-
image: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
1243
|
-
purchaseDate: z.ZodNullable<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1244
|
-
purchasePrice: any;
|
|
1245
|
-
initialMileage: any;
|
|
1246
|
-
currentMileage: any;
|
|
1247
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1248
|
-
[x: string]: any;
|
|
1249
|
-
}>>;
|
|
1250
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1251
|
-
}, z.core.$strip>;
|
|
1252
|
-
declare const refuelSchema: z.ZodObject<{
|
|
1253
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1254
|
-
busId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1255
|
-
refuelDate: z.ZodString;
|
|
1256
|
-
quantity: any;
|
|
1257
|
-
unitPrice: any;
|
|
1258
|
-
totalCost: any;
|
|
1259
|
-
fuelType: z.ZodDefault<z.ZodEnum<{
|
|
1260
|
-
[x: string]: any;
|
|
1261
|
-
}>>;
|
|
1262
|
-
odometer: any;
|
|
1263
|
-
fuelStation: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1264
|
-
invoiceNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1265
|
-
paymentMethod: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
1266
|
-
[x: string]: any;
|
|
1267
|
-
}>>>;
|
|
1268
|
-
paidBy: z.ZodNullable<z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>>;
|
|
1269
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
1270
|
-
[x: string]: any;
|
|
1271
|
-
}>>;
|
|
1272
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1273
|
-
}, z.core.$strip>;
|
|
1274
|
-
declare const settingsSchema: z.ZodObject<{
|
|
1275
|
-
schoolName: z.ZodString;
|
|
1276
|
-
schoolAddress: z.ZodOptional<z.ZodString>;
|
|
1277
|
-
schoolPhone: z.ZodString;
|
|
1278
|
-
schoolEmail: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
1279
|
-
schoolWebsite: z.ZodOptional<z.ZodString>;
|
|
1280
|
-
schoolLogo: z.ZodOptional<z.ZodString>;
|
|
1281
|
-
currentAcademicYear: z.ZodString;
|
|
1282
|
-
gradingScale: z.ZodOptional<z.ZodAny>;
|
|
1283
|
-
attendanceRequirement: any;
|
|
1284
|
-
maxClassSize: any;
|
|
1285
|
-
minimumPassingGrade: any;
|
|
1286
|
-
defaultExamDuration: any;
|
|
1287
|
-
calendarSystem: z.ZodDefault<z.ZodEnum<{
|
|
1288
|
-
[x: string]: any;
|
|
1289
|
-
}>>;
|
|
1290
|
-
startMonth: z.ZodDefault<z.ZodString>;
|
|
1291
|
-
endMonth: z.ZodDefault<z.ZodString>;
|
|
1292
|
-
academicAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1293
|
-
attendanceAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1294
|
-
eventAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1295
|
-
homeworkAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1296
|
-
feesReminder: z.ZodDefault<z.ZodBoolean>;
|
|
1297
|
-
feesOverdueAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1298
|
-
emailNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
1299
|
-
smsNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
1300
|
-
parentNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
1301
|
-
lowGradeAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1302
|
-
allowLateSubmission: z.ZodDefault<z.ZodBoolean>;
|
|
1303
|
-
examResultsAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1304
|
-
disciplinaryAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1305
|
-
achievementAlerts: z.ZodDefault<z.ZodBoolean>;
|
|
1306
|
-
maintenanceNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
1307
|
-
twoFactorEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
1308
|
-
sessionTimeout: z.ZodDefault<z.ZodString>;
|
|
1309
|
-
passwordRequireSymbols: z.ZodDefault<z.ZodBoolean>;
|
|
1310
|
-
loginNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
1311
|
-
parentAccessEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
1312
|
-
teacherAccessEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
1313
|
-
studentAccessEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
1314
|
-
timeZone: z.ZodDefault<z.ZodString>;
|
|
1315
|
-
language: z.ZodDefault<z.ZodEnum<{
|
|
1316
|
-
[x: string]: any;
|
|
1317
|
-
}>>;
|
|
1318
|
-
theme: z.ZodDefault<z.ZodEnum<{
|
|
1319
|
-
system: "system";
|
|
1320
|
-
light: "light";
|
|
1321
|
-
dark: "dark";
|
|
1322
|
-
}>>;
|
|
1323
|
-
dateFormat: z.ZodDefault<z.ZodEnum<{
|
|
1324
|
-
"YYYY-MM-DD": "YYYY-MM-DD";
|
|
1325
|
-
"MM/DD/YYYY": "MM/DD/YYYY";
|
|
1326
|
-
"DD/MM/YYYY": "DD/MM/YYYY";
|
|
1327
|
-
"DD-MM-YY": "DD-MM-YY";
|
|
1328
|
-
"DD-MM-YYYY": "DD-MM-YYYY";
|
|
1329
|
-
}>>;
|
|
1330
|
-
timeFormat: z.ZodDefault<z.ZodEnum<{
|
|
1331
|
-
12: "12";
|
|
1332
|
-
24: "24";
|
|
1333
|
-
}>>;
|
|
1334
|
-
currency: z.ZodDefault<z.ZodString>;
|
|
1335
|
-
gradingPeriods: any;
|
|
1336
|
-
schoolStartTime: z.ZodDefault<z.ZodString>;
|
|
1337
|
-
schoolEndTime: z.ZodDefault<z.ZodString>;
|
|
1338
|
-
lunchBreakDuration: any;
|
|
1339
|
-
maintenanceMode: z.ZodDefault<z.ZodBoolean>;
|
|
1340
|
-
autoBackup: z.ZodDefault<z.ZodBoolean>;
|
|
1341
|
-
}, z.core.$strip>;
|
|
1342
|
-
declare const idParamSchema: z.ZodObject<{
|
|
1343
|
-
id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
1344
|
-
}, z.core.$strip>;
|
|
1345
|
-
declare const paginationSchema: z.ZodObject<{
|
|
1346
|
-
page: any;
|
|
1347
|
-
limit: any;
|
|
1348
|
-
}, z.core.$strip>;
|
|
1349
|
-
declare const dateRangeSchema: z.ZodObject<{
|
|
1350
|
-
dateFrom: z.ZodString;
|
|
1351
|
-
dateTo: z.ZodString;
|
|
1352
|
-
}, z.core.$strip>;
|
|
1353
|
-
|
|
1354
|
-
declare const userTypeEnum: z.ZodEnum<{
|
|
1355
|
-
[x: string]: any;
|
|
1356
|
-
}>;
|
|
1357
|
-
declare const userStatusEnum: z.ZodEnum<{
|
|
1358
|
-
[x: string]: any;
|
|
1359
|
-
}>;
|
|
1360
|
-
declare const tokenStatusEnum: z.ZodEnum<{
|
|
1361
|
-
[x: string]: any;
|
|
1362
|
-
}>;
|
|
1363
|
-
declare const tokenTypeEnum: z.ZodEnum<{
|
|
1364
|
-
[x: string]: any;
|
|
1365
|
-
}>;
|
|
1366
|
-
declare const fileStatusEnum: z.ZodEnum<{
|
|
1367
|
-
[x: string]: any;
|
|
1368
|
-
}>;
|
|
1369
|
-
declare const genderEnum: z.ZodEnum<{
|
|
1370
|
-
[x: string]: any;
|
|
1371
|
-
}>;
|
|
1372
|
-
declare const studentStatusEnum: z.ZodEnum<{
|
|
1373
|
-
[x: string]: any;
|
|
1374
|
-
}>;
|
|
1375
|
-
declare const teacherStatusEnum: z.ZodEnum<{
|
|
1376
|
-
[x: string]: any;
|
|
1377
|
-
}>;
|
|
1378
|
-
declare const employmentTypeEnum: z.ZodEnum<{
|
|
1379
|
-
[x: string]: any;
|
|
1380
|
-
}>;
|
|
1381
|
-
declare const relationshipTypeEnum: z.ZodEnum<{
|
|
1382
|
-
[x: string]: any;
|
|
1383
|
-
}>;
|
|
1384
|
-
declare const semesterEnum: z.ZodEnum<{
|
|
1385
|
-
[x: string]: any;
|
|
1386
|
-
}>;
|
|
1387
|
-
declare const classStatusEnum: z.ZodEnum<{
|
|
1388
|
-
[x: string]: any;
|
|
1389
|
-
}>;
|
|
1390
|
-
declare const sectionStatusEnum: z.ZodEnum<{
|
|
1391
|
-
[x: string]: any;
|
|
1392
|
-
}>;
|
|
1393
|
-
declare const languageEnum: z.ZodEnum<{
|
|
1394
|
-
[x: string]: any;
|
|
1395
|
-
}>;
|
|
1396
|
-
declare const enrollmentStatusEnum: z.ZodEnum<{
|
|
1397
|
-
[x: string]: any;
|
|
1398
|
-
}>;
|
|
1399
|
-
declare const assignmentStatusEnum: z.ZodEnum<{
|
|
1400
|
-
[x: string]: any;
|
|
1401
|
-
}>;
|
|
1402
|
-
declare const calendarSystemEnum: z.ZodEnum<{
|
|
1403
|
-
[x: string]: any;
|
|
1404
|
-
}>;
|
|
1405
|
-
declare const assessmentTypeEnum: z.ZodEnum<{
|
|
1406
|
-
[x: string]: any;
|
|
1407
|
-
}>;
|
|
1408
|
-
declare const assessmentStatusEnum: z.ZodEnum<{
|
|
1409
|
-
[x: string]: any;
|
|
1410
|
-
}>;
|
|
1411
|
-
declare const submissionTypeEnum: z.ZodEnum<{
|
|
1412
|
-
[x: string]: any;
|
|
1413
|
-
}>;
|
|
1414
|
-
declare const examTypeEnum: z.ZodEnum<{
|
|
1415
|
-
[x: string]: any;
|
|
1416
|
-
}>;
|
|
1417
|
-
declare const examSecurityEnum: z.ZodEnum<{
|
|
1418
|
-
[x: string]: any;
|
|
1419
|
-
}>;
|
|
1420
|
-
declare const examStatusEnum: z.ZodEnum<{
|
|
1421
|
-
[x: string]: any;
|
|
1422
|
-
}>;
|
|
1423
|
-
declare const gradeStatusEnum: z.ZodEnum<{
|
|
1424
|
-
[x: string]: any;
|
|
1425
|
-
}>;
|
|
1426
|
-
declare const attendanceStatusEnum: z.ZodEnum<{
|
|
1427
|
-
[x: string]: any;
|
|
1428
|
-
}>;
|
|
1429
|
-
declare const proficiencyLevelEnum: z.ZodEnum<{
|
|
1430
|
-
[x: string]: any;
|
|
1431
|
-
}>;
|
|
1432
|
-
declare const dayOfWeekEnum: z.ZodEnum<{
|
|
1433
|
-
[x: string]: any;
|
|
1434
|
-
}>;
|
|
1435
|
-
declare const alertTypeEnum: z.ZodEnum<{
|
|
1436
|
-
[x: string]: any;
|
|
1437
|
-
}>;
|
|
1438
|
-
declare const alertPriorityEnum: z.ZodEnum<{
|
|
1439
|
-
[x: string]: any;
|
|
1440
|
-
}>;
|
|
1441
|
-
declare const alertStatusEnum: z.ZodEnum<{
|
|
1442
|
-
[x: string]: any;
|
|
1443
|
-
}>;
|
|
1444
|
-
declare const feeTypeStatusEnum: z.ZodEnum<{
|
|
1445
|
-
[x: string]: any;
|
|
1446
|
-
}>;
|
|
1447
|
-
declare const paymentTypeEnum: z.ZodEnum<{
|
|
1448
|
-
[x: string]: any;
|
|
1449
|
-
}>;
|
|
1450
|
-
declare const scheduleEnum: z.ZodEnum<{
|
|
1451
|
-
[x: string]: any;
|
|
1452
|
-
}>;
|
|
1453
|
-
declare const feeStatusEnum: z.ZodEnum<{
|
|
1454
|
-
[x: string]: any;
|
|
1455
|
-
}>;
|
|
1456
|
-
declare const feeInstallmentStatusEnum: z.ZodEnum<{
|
|
1457
|
-
[x: string]: any;
|
|
1458
|
-
}>;
|
|
1459
|
-
declare const paymentMethodEnum: z.ZodEnum<{
|
|
1460
|
-
[x: string]: any;
|
|
1461
|
-
}>;
|
|
1462
|
-
declare const paymentStatusEnum: z.ZodEnum<{
|
|
1463
|
-
[x: string]: any;
|
|
1464
|
-
}>;
|
|
1465
|
-
declare const eventTypeEnum: z.ZodEnum<{
|
|
1466
|
-
[x: string]: any;
|
|
1467
|
-
}>;
|
|
1468
|
-
declare const eventStatusEnum: z.ZodEnum<{
|
|
1469
|
-
[x: string]: any;
|
|
1470
|
-
}>;
|
|
1471
|
-
declare const eventVisibilityEnum: z.ZodEnum<{
|
|
1472
|
-
[x: string]: any;
|
|
1473
|
-
}>;
|
|
1474
|
-
declare const participantTypeEnum: z.ZodEnum<{
|
|
1475
|
-
[x: string]: any;
|
|
1476
|
-
}>;
|
|
1477
|
-
declare const expenseCategoryEnum: z.ZodEnum<{
|
|
1478
|
-
[x: string]: any;
|
|
1479
|
-
}>;
|
|
1480
|
-
declare const expenseStatusEnum: z.ZodEnum<{
|
|
1481
|
-
[x: string]: any;
|
|
1482
|
-
}>;
|
|
1483
|
-
declare const trackerModeEnum: z.ZodEnum<{
|
|
1484
|
-
[x: string]: any;
|
|
1485
|
-
}>;
|
|
1486
|
-
declare const driverStatusEnum: z.ZodEnum<{
|
|
1487
|
-
[x: string]: any;
|
|
1488
|
-
}>;
|
|
1489
|
-
declare const vehicleStatusEnum: z.ZodEnum<{
|
|
1490
|
-
[x: string]: any;
|
|
1491
|
-
}>;
|
|
1492
|
-
declare const vehicleTypeEnum: z.ZodEnum<{
|
|
1493
|
-
[x: string]: any;
|
|
1494
|
-
}>;
|
|
1495
|
-
declare const vehicleDocumentTypeEnum: z.ZodEnum<{
|
|
1496
|
-
[x: string]: any;
|
|
1497
|
-
}>;
|
|
1498
|
-
declare const busStatusEnum: z.ZodEnum<{
|
|
1499
|
-
[x: string]: any;
|
|
1500
|
-
}>;
|
|
1501
|
-
declare const refuelStatusEnum: z.ZodEnum<{
|
|
1502
|
-
[x: string]: any;
|
|
1503
|
-
}>;
|
|
1504
|
-
declare const fuelTypeEnum: z.ZodEnum<{
|
|
1505
|
-
[x: string]: any;
|
|
1506
|
-
}>;
|
|
1507
|
-
declare const maintenanceTypeEnum: z.ZodEnum<{
|
|
1508
|
-
[x: string]: any;
|
|
1509
|
-
}>;
|
|
1510
|
-
declare const maintenanceStatusEnum: z.ZodEnum<{
|
|
1511
|
-
[x: string]: any;
|
|
1512
|
-
}>;
|
|
1513
|
-
declare const maritalStatusEnum: z.ZodEnum<{
|
|
1514
|
-
[x: string]: any;
|
|
1515
|
-
}>;
|
|
1516
|
-
|
|
1517
|
-
declare class PermissionRepository {
|
|
1518
|
-
db: DB;
|
|
1519
|
-
getAll(): Promise<any>;
|
|
1520
|
-
getById(id: string): Promise<any>;
|
|
1521
|
-
getByName(name: string): Promise<any>;
|
|
1522
|
-
create(data: any): Promise<any>;
|
|
1523
|
-
update(id: string, data: any): Promise<any>;
|
|
1524
|
-
delete(id: string): Promise<any>;
|
|
1525
|
-
getPermissionsByRole(roleId: string): Promise<any>;
|
|
1526
|
-
getRolesByPermission(permissionId: string): Promise<any>;
|
|
1527
|
-
assignPermissionToRole(roleId: string, permissionId: string): Promise<any>;
|
|
1528
|
-
removePermissionFromRole(roleId: string, permissionId: string): Promise<any>;
|
|
1529
|
-
checkRoleHasPermission(roleId: string, permissionId: string): Promise<boolean>;
|
|
1530
|
-
deleteAll(): Promise<any>;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
declare class PermissionGuards {
|
|
1534
|
-
private tokenService;
|
|
1535
|
-
constructor(tokenService: TokenService);
|
|
1536
|
-
private getUserPermissions;
|
|
1537
|
-
private checkPermissionMatch;
|
|
1538
|
-
hasPermission(auth: any, ctx: any, requiredPermission: any): Promise<boolean>;
|
|
1539
920
|
}
|
|
1540
|
-
declare const Permission: (...permissions: any[]) => (target: any, propertyKey?: string) => void;
|
|
1541
921
|
|
|
922
|
+
/**
|
|
923
|
+
* PermissionValidator - Business validation for permission operations
|
|
924
|
+
* Handles database checks (unique, exists, role permissions)
|
|
925
|
+
* Schema validation is handled by DTOs in permission.dto.ts
|
|
926
|
+
*/
|
|
1542
927
|
declare class PermissionValidator {
|
|
1543
928
|
private permissionRepository;
|
|
1544
929
|
private roleValidator;
|
|
930
|
+
private t;
|
|
1545
931
|
constructor(permissionRepository: PermissionRepository, roleValidator: RoleValidator);
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
checkPermissionExists(id: string): Promise<
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
932
|
+
/**
|
|
933
|
+
* Check if permission exists by ID
|
|
934
|
+
*/
|
|
935
|
+
checkPermissionExists(id: string): Promise<{
|
|
936
|
+
description: string;
|
|
937
|
+
name: string;
|
|
938
|
+
id: string;
|
|
939
|
+
createdAt: string;
|
|
940
|
+
updatedAt: string;
|
|
941
|
+
resource: string;
|
|
942
|
+
action: string;
|
|
943
|
+
}>;
|
|
944
|
+
/**
|
|
945
|
+
* Check if permission exists by name
|
|
946
|
+
*/
|
|
947
|
+
checkPermissionExistsByName(name: string): Promise<{
|
|
948
|
+
description: string;
|
|
949
|
+
name: string;
|
|
950
|
+
id: string;
|
|
951
|
+
createdAt: string;
|
|
952
|
+
updatedAt: string;
|
|
953
|
+
resource: string;
|
|
954
|
+
action: string;
|
|
955
|
+
}>;
|
|
956
|
+
/**
|
|
957
|
+
* Check if permission name is unique
|
|
958
|
+
*/
|
|
959
|
+
checkPermissionNameUnique(name: string, excludeId?: string): Promise<void>;
|
|
960
|
+
/**
|
|
961
|
+
* Check if role exists (delegates to RoleValidator)
|
|
962
|
+
*/
|
|
963
|
+
checkRoleExists(id: string): Promise<{
|
|
964
|
+
description: string;
|
|
965
|
+
name: string;
|
|
966
|
+
id: string;
|
|
967
|
+
createdAt: string;
|
|
968
|
+
updatedAt: string;
|
|
969
|
+
}>;
|
|
970
|
+
/**
|
|
971
|
+
* Check if role exists by name (delegates to RoleValidator)
|
|
972
|
+
*/
|
|
973
|
+
checkRoleExistsByName(name: string): Promise<{
|
|
974
|
+
description: string;
|
|
975
|
+
name: string;
|
|
976
|
+
id: string;
|
|
977
|
+
createdAt: string;
|
|
978
|
+
updatedAt: string;
|
|
979
|
+
}>;
|
|
980
|
+
/**
|
|
981
|
+
* Check if role already has permission
|
|
982
|
+
*/
|
|
1554
983
|
checkRoleHasPermission(roleId: string, permissionId: string): Promise<void>;
|
|
1555
984
|
}
|
|
1556
985
|
|
|
@@ -1559,75 +988,272 @@ declare class PermissionService {
|
|
|
1559
988
|
private permissionValidator;
|
|
1560
989
|
private roleService;
|
|
1561
990
|
constructor(permissionRepository: PermissionRepository, permissionValidator: PermissionValidator, roleService: RoleService);
|
|
1562
|
-
getAll(): Promise<
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
991
|
+
getAll(): Promise<{
|
|
992
|
+
description: string;
|
|
993
|
+
name: string;
|
|
994
|
+
id: string;
|
|
995
|
+
createdAt: string;
|
|
996
|
+
updatedAt: string;
|
|
997
|
+
resource: string;
|
|
998
|
+
action: string;
|
|
999
|
+
}[]>;
|
|
1000
|
+
getById(id: string): Promise<{
|
|
1001
|
+
description: string;
|
|
1002
|
+
name: string;
|
|
1003
|
+
id: string;
|
|
1004
|
+
createdAt: string;
|
|
1005
|
+
updatedAt: string;
|
|
1006
|
+
resource: string;
|
|
1007
|
+
action: string;
|
|
1008
|
+
}>;
|
|
1009
|
+
getByName(name: string): Promise<{
|
|
1010
|
+
description: string;
|
|
1011
|
+
name: string;
|
|
1012
|
+
id: string;
|
|
1013
|
+
createdAt: string;
|
|
1014
|
+
updatedAt: string;
|
|
1015
|
+
resource: string;
|
|
1016
|
+
action: string;
|
|
1017
|
+
}>;
|
|
1018
|
+
getByResource(resource: string): Promise<{
|
|
1019
|
+
description: string;
|
|
1020
|
+
name: string;
|
|
1021
|
+
id: string;
|
|
1022
|
+
createdAt: string;
|
|
1023
|
+
updatedAt: string;
|
|
1024
|
+
resource: string;
|
|
1025
|
+
action: string;
|
|
1026
|
+
}[]>;
|
|
1027
|
+
create(data: any): Promise<{
|
|
1028
|
+
description: string;
|
|
1029
|
+
name: string;
|
|
1030
|
+
id: string;
|
|
1031
|
+
createdAt: string;
|
|
1032
|
+
updatedAt: string;
|
|
1033
|
+
resource: string;
|
|
1034
|
+
action: string;
|
|
1035
|
+
}>;
|
|
1036
|
+
update(id: string, data: any): Promise<{
|
|
1037
|
+
description: string;
|
|
1038
|
+
name: string;
|
|
1039
|
+
id: string;
|
|
1040
|
+
createdAt: string;
|
|
1041
|
+
updatedAt: string;
|
|
1042
|
+
resource: string;
|
|
1043
|
+
action: string;
|
|
1044
|
+
}>;
|
|
1045
|
+
delete(id: string): Promise<{
|
|
1046
|
+
description: string;
|
|
1047
|
+
name: string;
|
|
1048
|
+
id: string;
|
|
1049
|
+
createdAt: string;
|
|
1050
|
+
updatedAt: string;
|
|
1051
|
+
resource: string;
|
|
1052
|
+
action: string;
|
|
1053
|
+
}>;
|
|
1054
|
+
getPermissionsByRole(roleId: string): Promise<Pick<{
|
|
1055
|
+
description: string;
|
|
1056
|
+
name: string;
|
|
1057
|
+
id: string;
|
|
1058
|
+
createdAt: string;
|
|
1059
|
+
updatedAt: string;
|
|
1060
|
+
resource: string;
|
|
1061
|
+
action: string;
|
|
1062
|
+
}, "description" | "name" | "id" | "resource" | "action">[]>;
|
|
1063
|
+
getRolesByPermission(permissionId: string): Promise<Pick<{
|
|
1064
|
+
description: string;
|
|
1065
|
+
name: string;
|
|
1066
|
+
id: string;
|
|
1067
|
+
createdAt: string;
|
|
1068
|
+
updatedAt: string;
|
|
1069
|
+
}, "description" | "name" | "id">[]>;
|
|
1070
|
+
assignPermissionToRole(roleId: string, permissionId: string): Promise<{
|
|
1071
|
+
id: string;
|
|
1072
|
+
createdAt: string;
|
|
1073
|
+
updatedAt: string;
|
|
1074
|
+
roleId: string;
|
|
1075
|
+
permissionId: string;
|
|
1076
|
+
}>;
|
|
1077
|
+
removePermissionFromRole(roleId: string, permissionId: string): Promise<{
|
|
1078
|
+
id: string;
|
|
1079
|
+
createdAt: string;
|
|
1080
|
+
updatedAt: string;
|
|
1081
|
+
roleId: string;
|
|
1082
|
+
permissionId: string;
|
|
1083
|
+
}>;
|
|
1084
|
+
seedDefaultPermissions(defaultPermissions: any): Promise<{
|
|
1085
|
+
created: any[];
|
|
1086
|
+
skipped: any[];
|
|
1087
|
+
}>;
|
|
1088
|
+
seedDefaultRolePermissions(defaultRolePermissions: any): Promise<{
|
|
1089
|
+
assigned: any[];
|
|
1090
|
+
skipped: any[];
|
|
1091
|
+
}>;
|
|
1092
|
+
deleteAll(): Promise<{
|
|
1093
|
+
description: string;
|
|
1094
|
+
name: string;
|
|
1095
|
+
id: string;
|
|
1096
|
+
createdAt: string;
|
|
1097
|
+
updatedAt: string;
|
|
1098
|
+
resource: string;
|
|
1099
|
+
action: string;
|
|
1100
|
+
}[]>;
|
|
1576
1101
|
}
|
|
1577
1102
|
|
|
1103
|
+
declare const createPermissionDto: z.ZodObject<{
|
|
1104
|
+
name: z.ZodString;
|
|
1105
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1106
|
+
resource: z.ZodString;
|
|
1107
|
+
action: z.ZodString;
|
|
1108
|
+
}, z.core.$strip>;
|
|
1109
|
+
declare const updatePermissionDto: z.ZodObject<{
|
|
1110
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1111
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1112
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
1113
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1114
|
+
}, z.core.$strip>;
|
|
1115
|
+
declare const permissionIdParam: z.ZodObject<{
|
|
1116
|
+
id: z.ZodString;
|
|
1117
|
+
}, z.core.$strip>;
|
|
1118
|
+
declare const assignPermissionDto: z.ZodObject<{
|
|
1119
|
+
roleId: z.ZodString;
|
|
1120
|
+
permissionId: z.ZodString;
|
|
1121
|
+
}, z.core.$strip>;
|
|
1122
|
+
declare const checkPermissionDto: z.ZodObject<{
|
|
1123
|
+
userId: z.ZodString;
|
|
1124
|
+
resource: z.ZodString;
|
|
1125
|
+
action: z.ZodString;
|
|
1126
|
+
}, z.core.$strip>;
|
|
1127
|
+
type CreatePermissionDto = z.infer<typeof createPermissionDto>;
|
|
1128
|
+
type UpdatePermissionDto = z.infer<typeof updatePermissionDto>;
|
|
1129
|
+
type PermissionIdParam = z.infer<typeof permissionIdParam>;
|
|
1130
|
+
type AssignPermissionDto = z.infer<typeof assignPermissionDto>;
|
|
1131
|
+
type CheckPermissionDto = z.infer<typeof checkPermissionDto>;
|
|
1132
|
+
|
|
1578
1133
|
declare class PermissionController {
|
|
1579
1134
|
private permissionService;
|
|
1580
1135
|
constructor(permissionService: PermissionService);
|
|
1581
1136
|
getPermissions(): Promise<{
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1137
|
+
description: string;
|
|
1138
|
+
name: string;
|
|
1139
|
+
id: string;
|
|
1140
|
+
createdAt: string;
|
|
1141
|
+
updatedAt: string;
|
|
1142
|
+
resource: string;
|
|
1143
|
+
action: string;
|
|
1144
|
+
}[]>;
|
|
1145
|
+
getPermission(params: PermissionIdParam): Promise<{
|
|
1146
|
+
description: string;
|
|
1147
|
+
name: string;
|
|
1148
|
+
id: string;
|
|
1149
|
+
createdAt: string;
|
|
1150
|
+
updatedAt: string;
|
|
1151
|
+
resource: string;
|
|
1152
|
+
action: string;
|
|
1595
1153
|
}>;
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1154
|
+
create(body: CreatePermissionDto): Promise<{
|
|
1155
|
+
description: string;
|
|
1156
|
+
name: string;
|
|
1157
|
+
id: string;
|
|
1158
|
+
createdAt: string;
|
|
1159
|
+
updatedAt: string;
|
|
1160
|
+
resource: string;
|
|
1161
|
+
action: string;
|
|
1600
1162
|
}>;
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1163
|
+
update(params: PermissionIdParam, body: UpdatePermissionDto): Promise<{
|
|
1164
|
+
description: string;
|
|
1165
|
+
name: string;
|
|
1166
|
+
id: string;
|
|
1167
|
+
createdAt: string;
|
|
1168
|
+
updatedAt: string;
|
|
1169
|
+
resource: string;
|
|
1170
|
+
action: string;
|
|
1605
1171
|
}>;
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1172
|
+
delete(params: PermissionIdParam): Promise<{
|
|
1173
|
+
description: string;
|
|
1174
|
+
name: string;
|
|
1175
|
+
id: string;
|
|
1176
|
+
createdAt: string;
|
|
1177
|
+
updatedAt: string;
|
|
1178
|
+
resource: string;
|
|
1179
|
+
action: string;
|
|
1610
1180
|
}>;
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1181
|
+
getByRole(params: RoleIdParam): Promise<Pick<{
|
|
1182
|
+
description: string;
|
|
1183
|
+
name: string;
|
|
1184
|
+
id: string;
|
|
1185
|
+
createdAt: string;
|
|
1186
|
+
updatedAt: string;
|
|
1187
|
+
resource: string;
|
|
1188
|
+
action: string;
|
|
1189
|
+
}, "description" | "name" | "id" | "resource" | "action">[]>;
|
|
1190
|
+
getRolesByPermission(params: PermissionIdParam): Promise<Pick<{
|
|
1191
|
+
description: string;
|
|
1192
|
+
name: string;
|
|
1193
|
+
id: string;
|
|
1194
|
+
createdAt: string;
|
|
1195
|
+
updatedAt: string;
|
|
1196
|
+
}, "description" | "name" | "id">[]>;
|
|
1197
|
+
assignToRole(params: AssignPermissionDto): Promise<{
|
|
1198
|
+
id: string;
|
|
1199
|
+
createdAt: string;
|
|
1200
|
+
updatedAt: string;
|
|
1201
|
+
roleId: string;
|
|
1202
|
+
permissionId: string;
|
|
1615
1203
|
}>;
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
data: any;
|
|
1623
|
-
message: string;
|
|
1624
|
-
status: string;
|
|
1204
|
+
removeFromRole(params: AssignPermissionDto): Promise<{
|
|
1205
|
+
id: string;
|
|
1206
|
+
createdAt: string;
|
|
1207
|
+
updatedAt: string;
|
|
1208
|
+
roleId: string;
|
|
1209
|
+
permissionId: string;
|
|
1625
1210
|
}>;
|
|
1626
1211
|
deleteAll(): Promise<{
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1212
|
+
description: string;
|
|
1213
|
+
name: string;
|
|
1214
|
+
id: string;
|
|
1215
|
+
createdAt: string;
|
|
1216
|
+
updatedAt: string;
|
|
1217
|
+
resource: string;
|
|
1218
|
+
action: string;
|
|
1219
|
+
}[]>;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Shared query builders used across auth repositories.
|
|
1224
|
+
* Eliminates duplication between UserRepository and TokenRepository.
|
|
1225
|
+
*/
|
|
1226
|
+
declare class AuthQueries {
|
|
1227
|
+
private db;
|
|
1228
|
+
private schema;
|
|
1229
|
+
constructor(db: any, schema: AuthSchema);
|
|
1230
|
+
/**
|
|
1231
|
+
* Standard user selection fields with role join
|
|
1232
|
+
*/
|
|
1233
|
+
userSelection(): {
|
|
1234
|
+
id: any;
|
|
1235
|
+
email: any;
|
|
1236
|
+
emailVerified: any;
|
|
1237
|
+
image: any;
|
|
1238
|
+
status: any;
|
|
1239
|
+
roleId: any;
|
|
1240
|
+
role: any;
|
|
1241
|
+
createdAt: any;
|
|
1242
|
+
updatedAt: any;
|
|
1243
|
+
};
|
|
1244
|
+
/**
|
|
1245
|
+
* Get permissions for a user by their userId
|
|
1246
|
+
*/
|
|
1247
|
+
getUserPermissions(userId: string): Promise<string[]>;
|
|
1248
|
+
/**
|
|
1249
|
+
* Get role name for a user
|
|
1250
|
+
*/
|
|
1251
|
+
getRoleName(userId: string): Promise<string | null>;
|
|
1252
|
+
/**
|
|
1253
|
+
* Batch load permissions for multiple users (fixes N+1 query problem)
|
|
1254
|
+
* Returns a Map of roleId -> permissions[]
|
|
1255
|
+
*/
|
|
1256
|
+
batchLoadPermissionsByRole(): Promise<Map<string, string[]>>;
|
|
1631
1257
|
}
|
|
1632
1258
|
|
|
1633
1259
|
declare const avatarsPath: string;
|
|
@@ -1642,604 +1268,199 @@ declare const isEmpty: any;
|
|
|
1642
1268
|
declare const isPath: (img: any) => boolean;
|
|
1643
1269
|
declare const isFile: (img: any) => boolean;
|
|
1644
1270
|
|
|
1645
|
-
declare const
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
declare const
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
hasDefault: false;
|
|
1802
|
-
isPrimaryKey: false;
|
|
1803
|
-
isAutoincrement: false;
|
|
1804
|
-
hasRuntimeDefault: false;
|
|
1805
|
-
enumValues: [string, ...string[]];
|
|
1806
|
-
baseColumn: never;
|
|
1807
|
-
identity: undefined;
|
|
1808
|
-
generated: undefined;
|
|
1809
|
-
}, {}, {}>;
|
|
1810
|
-
image: drizzle_orm_pg_core.PgColumn<{
|
|
1811
|
-
name: "image";
|
|
1812
|
-
tableName: "users";
|
|
1813
|
-
dataType: "string";
|
|
1814
|
-
columnType: "PgText";
|
|
1815
|
-
data: string;
|
|
1816
|
-
driverParam: string;
|
|
1817
|
-
notNull: false;
|
|
1818
|
-
hasDefault: true;
|
|
1819
|
-
isPrimaryKey: false;
|
|
1820
|
-
isAutoincrement: false;
|
|
1821
|
-
hasRuntimeDefault: false;
|
|
1822
|
-
enumValues: [string, ...string[]];
|
|
1823
|
-
baseColumn: never;
|
|
1824
|
-
identity: undefined;
|
|
1825
|
-
generated: undefined;
|
|
1826
|
-
}, {}, {}>;
|
|
1827
|
-
status: drizzle_orm_pg_core.PgColumn<{
|
|
1828
|
-
name: "status";
|
|
1829
|
-
tableName: "users";
|
|
1830
|
-
dataType: "string";
|
|
1831
|
-
columnType: "PgEnumColumn";
|
|
1832
|
-
data: any;
|
|
1833
|
-
driverParam: string;
|
|
1834
|
-
notNull: false;
|
|
1835
|
-
hasDefault: true;
|
|
1836
|
-
isPrimaryKey: false;
|
|
1837
|
-
isAutoincrement: false;
|
|
1838
|
-
hasRuntimeDefault: false;
|
|
1839
|
-
enumValues: any;
|
|
1840
|
-
baseColumn: never;
|
|
1841
|
-
identity: undefined;
|
|
1842
|
-
generated: undefined;
|
|
1843
|
-
}, {}, {}>;
|
|
1844
|
-
roleId: drizzle_orm_pg_core.PgColumn<{
|
|
1845
|
-
name: "role_id";
|
|
1846
|
-
tableName: "users";
|
|
1847
|
-
dataType: "string";
|
|
1848
|
-
columnType: "PgText";
|
|
1849
|
-
data: string;
|
|
1850
|
-
driverParam: string;
|
|
1851
|
-
notNull: false;
|
|
1852
|
-
hasDefault: false;
|
|
1853
|
-
isPrimaryKey: false;
|
|
1854
|
-
isAutoincrement: false;
|
|
1855
|
-
hasRuntimeDefault: false;
|
|
1856
|
-
enumValues: [string, ...string[]];
|
|
1857
|
-
baseColumn: never;
|
|
1858
|
-
identity: undefined;
|
|
1859
|
-
generated: undefined;
|
|
1860
|
-
}, {}, {}>;
|
|
1861
|
-
lastLogin: drizzle_orm_pg_core.PgColumn<{
|
|
1862
|
-
name: "last_login";
|
|
1863
|
-
tableName: "users";
|
|
1864
|
-
dataType: "string";
|
|
1865
|
-
columnType: "PgTimestampString";
|
|
1866
|
-
data: string;
|
|
1867
|
-
driverParam: string;
|
|
1868
|
-
notNull: false;
|
|
1869
|
-
hasDefault: false;
|
|
1870
|
-
isPrimaryKey: false;
|
|
1871
|
-
isAutoincrement: false;
|
|
1872
|
-
hasRuntimeDefault: false;
|
|
1873
|
-
enumValues: undefined;
|
|
1874
|
-
baseColumn: never;
|
|
1875
|
-
identity: undefined;
|
|
1876
|
-
generated: undefined;
|
|
1877
|
-
}, {}, {}>;
|
|
1878
|
-
};
|
|
1879
|
-
dialect: "pg";
|
|
1880
|
-
}>;
|
|
1881
|
-
declare const tokensTable: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1882
|
-
name: "tokens";
|
|
1883
|
-
schema: undefined;
|
|
1884
|
-
columns: {
|
|
1885
|
-
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1886
|
-
name: "created_at";
|
|
1887
|
-
tableName: "tokens";
|
|
1888
|
-
dataType: "string";
|
|
1889
|
-
columnType: "PgTimestampString";
|
|
1890
|
-
data: string;
|
|
1891
|
-
driverParam: string;
|
|
1892
|
-
notNull: false;
|
|
1893
|
-
hasDefault: true;
|
|
1894
|
-
isPrimaryKey: false;
|
|
1895
|
-
isAutoincrement: false;
|
|
1896
|
-
hasRuntimeDefault: false;
|
|
1897
|
-
enumValues: undefined;
|
|
1898
|
-
baseColumn: never;
|
|
1899
|
-
identity: undefined;
|
|
1900
|
-
generated: undefined;
|
|
1901
|
-
}, {}, {}>;
|
|
1902
|
-
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
1903
|
-
name: "updated_at";
|
|
1904
|
-
tableName: "tokens";
|
|
1905
|
-
dataType: "string";
|
|
1906
|
-
columnType: "PgTimestampString";
|
|
1907
|
-
data: string;
|
|
1908
|
-
driverParam: string;
|
|
1909
|
-
notNull: false;
|
|
1910
|
-
hasDefault: true;
|
|
1911
|
-
isPrimaryKey: false;
|
|
1912
|
-
isAutoincrement: false;
|
|
1913
|
-
hasRuntimeDefault: false;
|
|
1914
|
-
enumValues: undefined;
|
|
1915
|
-
baseColumn: never;
|
|
1916
|
-
identity: undefined;
|
|
1917
|
-
generated: undefined;
|
|
1918
|
-
}, {}, {}>;
|
|
1919
|
-
id: drizzle_orm_pg_core.PgColumn<{
|
|
1920
|
-
name: "id";
|
|
1921
|
-
tableName: "tokens";
|
|
1922
|
-
dataType: "string";
|
|
1923
|
-
columnType: "PgText";
|
|
1924
|
-
data: string;
|
|
1925
|
-
driverParam: string;
|
|
1926
|
-
notNull: true;
|
|
1927
|
-
hasDefault: true;
|
|
1928
|
-
isPrimaryKey: true;
|
|
1929
|
-
isAutoincrement: false;
|
|
1930
|
-
hasRuntimeDefault: true;
|
|
1931
|
-
enumValues: [string, ...string[]];
|
|
1932
|
-
baseColumn: never;
|
|
1933
|
-
identity: undefined;
|
|
1934
|
-
generated: undefined;
|
|
1935
|
-
}, {}, {}>;
|
|
1936
|
-
userId: drizzle_orm_pg_core.PgColumn<{
|
|
1937
|
-
name: "user_id";
|
|
1938
|
-
tableName: "tokens";
|
|
1939
|
-
dataType: "string";
|
|
1940
|
-
columnType: "PgText";
|
|
1941
|
-
data: string;
|
|
1942
|
-
driverParam: string;
|
|
1943
|
-
notNull: true;
|
|
1944
|
-
hasDefault: false;
|
|
1945
|
-
isPrimaryKey: false;
|
|
1946
|
-
isAutoincrement: false;
|
|
1947
|
-
hasRuntimeDefault: false;
|
|
1948
|
-
enumValues: [string, ...string[]];
|
|
1949
|
-
baseColumn: never;
|
|
1950
|
-
identity: undefined;
|
|
1951
|
-
generated: undefined;
|
|
1952
|
-
}, {}, {}>;
|
|
1953
|
-
token: drizzle_orm_pg_core.PgColumn<{
|
|
1954
|
-
name: "token";
|
|
1955
|
-
tableName: "tokens";
|
|
1956
|
-
dataType: "string";
|
|
1957
|
-
columnType: "PgText";
|
|
1958
|
-
data: string;
|
|
1959
|
-
driverParam: string;
|
|
1960
|
-
notNull: true;
|
|
1961
|
-
hasDefault: false;
|
|
1962
|
-
isPrimaryKey: false;
|
|
1963
|
-
isAutoincrement: false;
|
|
1964
|
-
hasRuntimeDefault: false;
|
|
1965
|
-
enumValues: [string, ...string[]];
|
|
1966
|
-
baseColumn: never;
|
|
1967
|
-
identity: undefined;
|
|
1968
|
-
generated: undefined;
|
|
1969
|
-
}, {}, {}>;
|
|
1970
|
-
type: drizzle_orm_pg_core.PgColumn<{
|
|
1971
|
-
name: "type";
|
|
1972
|
-
tableName: "tokens";
|
|
1973
|
-
dataType: "string";
|
|
1974
|
-
columnType: "PgEnumColumn";
|
|
1975
|
-
data: any;
|
|
1976
|
-
driverParam: string;
|
|
1977
|
-
notNull: false;
|
|
1978
|
-
hasDefault: true;
|
|
1979
|
-
isPrimaryKey: false;
|
|
1980
|
-
isAutoincrement: false;
|
|
1981
|
-
hasRuntimeDefault: false;
|
|
1982
|
-
enumValues: any;
|
|
1983
|
-
baseColumn: never;
|
|
1984
|
-
identity: undefined;
|
|
1985
|
-
generated: undefined;
|
|
1986
|
-
}, {}, {}>;
|
|
1987
|
-
status: drizzle_orm_pg_core.PgColumn<{
|
|
1988
|
-
name: "status";
|
|
1989
|
-
tableName: "tokens";
|
|
1990
|
-
dataType: "string";
|
|
1991
|
-
columnType: "PgEnumColumn";
|
|
1992
|
-
data: any;
|
|
1993
|
-
driverParam: string;
|
|
1994
|
-
notNull: false;
|
|
1995
|
-
hasDefault: true;
|
|
1996
|
-
isPrimaryKey: false;
|
|
1997
|
-
isAutoincrement: false;
|
|
1998
|
-
hasRuntimeDefault: false;
|
|
1999
|
-
enumValues: any;
|
|
2000
|
-
baseColumn: never;
|
|
2001
|
-
identity: undefined;
|
|
2002
|
-
generated: undefined;
|
|
2003
|
-
}, {}, {}>;
|
|
2004
|
-
expiresAt: drizzle_orm_pg_core.PgColumn<{
|
|
2005
|
-
name: "expires_at";
|
|
2006
|
-
tableName: "tokens";
|
|
2007
|
-
dataType: "string";
|
|
2008
|
-
columnType: "PgTimestampString";
|
|
2009
|
-
data: string;
|
|
2010
|
-
driverParam: string;
|
|
2011
|
-
notNull: true;
|
|
2012
|
-
hasDefault: false;
|
|
2013
|
-
isPrimaryKey: false;
|
|
2014
|
-
isAutoincrement: false;
|
|
2015
|
-
hasRuntimeDefault: false;
|
|
2016
|
-
enumValues: undefined;
|
|
2017
|
-
baseColumn: never;
|
|
2018
|
-
identity: undefined;
|
|
2019
|
-
generated: undefined;
|
|
2020
|
-
}, {}, {}>;
|
|
2021
|
-
};
|
|
2022
|
-
dialect: "pg";
|
|
2023
|
-
}>;
|
|
2024
|
-
declare const permissionsTable: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2025
|
-
name: "permissions";
|
|
2026
|
-
schema: undefined;
|
|
2027
|
-
columns: {
|
|
2028
|
-
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
2029
|
-
name: "created_at";
|
|
2030
|
-
tableName: "permissions";
|
|
2031
|
-
dataType: "string";
|
|
2032
|
-
columnType: "PgTimestampString";
|
|
2033
|
-
data: string;
|
|
2034
|
-
driverParam: string;
|
|
2035
|
-
notNull: false;
|
|
2036
|
-
hasDefault: true;
|
|
2037
|
-
isPrimaryKey: false;
|
|
2038
|
-
isAutoincrement: false;
|
|
2039
|
-
hasRuntimeDefault: false;
|
|
2040
|
-
enumValues: undefined;
|
|
2041
|
-
baseColumn: never;
|
|
2042
|
-
identity: undefined;
|
|
2043
|
-
generated: undefined;
|
|
2044
|
-
}, {}, {}>;
|
|
2045
|
-
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2046
|
-
name: "updated_at";
|
|
2047
|
-
tableName: "permissions";
|
|
2048
|
-
dataType: "string";
|
|
2049
|
-
columnType: "PgTimestampString";
|
|
2050
|
-
data: string;
|
|
2051
|
-
driverParam: string;
|
|
2052
|
-
notNull: false;
|
|
2053
|
-
hasDefault: true;
|
|
2054
|
-
isPrimaryKey: false;
|
|
2055
|
-
isAutoincrement: false;
|
|
2056
|
-
hasRuntimeDefault: false;
|
|
2057
|
-
enumValues: undefined;
|
|
2058
|
-
baseColumn: never;
|
|
2059
|
-
identity: undefined;
|
|
2060
|
-
generated: undefined;
|
|
2061
|
-
}, {}, {}>;
|
|
2062
|
-
id: drizzle_orm_pg_core.PgColumn<{
|
|
2063
|
-
name: "id";
|
|
2064
|
-
tableName: "permissions";
|
|
2065
|
-
dataType: "string";
|
|
2066
|
-
columnType: "PgText";
|
|
2067
|
-
data: string;
|
|
2068
|
-
driverParam: string;
|
|
2069
|
-
notNull: true;
|
|
2070
|
-
hasDefault: true;
|
|
2071
|
-
isPrimaryKey: true;
|
|
2072
|
-
isAutoincrement: false;
|
|
2073
|
-
hasRuntimeDefault: true;
|
|
2074
|
-
enumValues: [string, ...string[]];
|
|
2075
|
-
baseColumn: never;
|
|
2076
|
-
identity: undefined;
|
|
2077
|
-
generated: undefined;
|
|
2078
|
-
}, {}, {}>;
|
|
2079
|
-
name: drizzle_orm_pg_core.PgColumn<{
|
|
2080
|
-
name: "name";
|
|
2081
|
-
tableName: "permissions";
|
|
2082
|
-
dataType: "string";
|
|
2083
|
-
columnType: "PgText";
|
|
2084
|
-
data: string;
|
|
2085
|
-
driverParam: string;
|
|
2086
|
-
notNull: true;
|
|
2087
|
-
hasDefault: false;
|
|
2088
|
-
isPrimaryKey: false;
|
|
2089
|
-
isAutoincrement: false;
|
|
2090
|
-
hasRuntimeDefault: false;
|
|
2091
|
-
enumValues: [string, ...string[]];
|
|
2092
|
-
baseColumn: never;
|
|
2093
|
-
identity: undefined;
|
|
2094
|
-
generated: undefined;
|
|
2095
|
-
}, {}, {}>;
|
|
2096
|
-
description: drizzle_orm_pg_core.PgColumn<{
|
|
2097
|
-
name: "description";
|
|
2098
|
-
tableName: "permissions";
|
|
2099
|
-
dataType: "string";
|
|
2100
|
-
columnType: "PgText";
|
|
2101
|
-
data: string;
|
|
2102
|
-
driverParam: string;
|
|
2103
|
-
notNull: false;
|
|
2104
|
-
hasDefault: false;
|
|
2105
|
-
isPrimaryKey: false;
|
|
2106
|
-
isAutoincrement: false;
|
|
2107
|
-
hasRuntimeDefault: false;
|
|
2108
|
-
enumValues: [string, ...string[]];
|
|
2109
|
-
baseColumn: never;
|
|
2110
|
-
identity: undefined;
|
|
2111
|
-
generated: undefined;
|
|
2112
|
-
}, {}, {}>;
|
|
2113
|
-
resource: drizzle_orm_pg_core.PgColumn<{
|
|
2114
|
-
name: "resource";
|
|
2115
|
-
tableName: "permissions";
|
|
2116
|
-
dataType: "string";
|
|
2117
|
-
columnType: "PgText";
|
|
2118
|
-
data: string;
|
|
2119
|
-
driverParam: string;
|
|
2120
|
-
notNull: true;
|
|
2121
|
-
hasDefault: false;
|
|
2122
|
-
isPrimaryKey: false;
|
|
2123
|
-
isAutoincrement: false;
|
|
2124
|
-
hasRuntimeDefault: false;
|
|
2125
|
-
enumValues: [string, ...string[]];
|
|
2126
|
-
baseColumn: never;
|
|
2127
|
-
identity: undefined;
|
|
2128
|
-
generated: undefined;
|
|
2129
|
-
}, {}, {}>;
|
|
2130
|
-
action: drizzle_orm_pg_core.PgColumn<{
|
|
2131
|
-
name: "action";
|
|
2132
|
-
tableName: "permissions";
|
|
2133
|
-
dataType: "string";
|
|
2134
|
-
columnType: "PgText";
|
|
2135
|
-
data: string;
|
|
2136
|
-
driverParam: string;
|
|
2137
|
-
notNull: true;
|
|
2138
|
-
hasDefault: false;
|
|
2139
|
-
isPrimaryKey: false;
|
|
2140
|
-
isAutoincrement: false;
|
|
2141
|
-
hasRuntimeDefault: false;
|
|
2142
|
-
enumValues: [string, ...string[]];
|
|
2143
|
-
baseColumn: never;
|
|
2144
|
-
identity: undefined;
|
|
2145
|
-
generated: undefined;
|
|
2146
|
-
}, {}, {}>;
|
|
2147
|
-
};
|
|
2148
|
-
dialect: "pg";
|
|
2149
|
-
}>;
|
|
2150
|
-
declare const rolePermissionsTable: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2151
|
-
name: "role_permissions";
|
|
2152
|
-
schema: undefined;
|
|
2153
|
-
columns: {
|
|
2154
|
-
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
2155
|
-
name: "created_at";
|
|
2156
|
-
tableName: "role_permissions";
|
|
2157
|
-
dataType: "string";
|
|
2158
|
-
columnType: "PgTimestampString";
|
|
2159
|
-
data: string;
|
|
2160
|
-
driverParam: string;
|
|
2161
|
-
notNull: false;
|
|
2162
|
-
hasDefault: true;
|
|
2163
|
-
isPrimaryKey: false;
|
|
2164
|
-
isAutoincrement: false;
|
|
2165
|
-
hasRuntimeDefault: false;
|
|
2166
|
-
enumValues: undefined;
|
|
2167
|
-
baseColumn: never;
|
|
2168
|
-
identity: undefined;
|
|
2169
|
-
generated: undefined;
|
|
2170
|
-
}, {}, {}>;
|
|
2171
|
-
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2172
|
-
name: "updated_at";
|
|
2173
|
-
tableName: "role_permissions";
|
|
2174
|
-
dataType: "string";
|
|
2175
|
-
columnType: "PgTimestampString";
|
|
2176
|
-
data: string;
|
|
2177
|
-
driverParam: string;
|
|
2178
|
-
notNull: false;
|
|
2179
|
-
hasDefault: true;
|
|
2180
|
-
isPrimaryKey: false;
|
|
2181
|
-
isAutoincrement: false;
|
|
2182
|
-
hasRuntimeDefault: false;
|
|
2183
|
-
enumValues: undefined;
|
|
2184
|
-
baseColumn: never;
|
|
2185
|
-
identity: undefined;
|
|
2186
|
-
generated: undefined;
|
|
2187
|
-
}, {}, {}>;
|
|
2188
|
-
id: drizzle_orm_pg_core.PgColumn<{
|
|
2189
|
-
name: "id";
|
|
2190
|
-
tableName: "role_permissions";
|
|
2191
|
-
dataType: "string";
|
|
2192
|
-
columnType: "PgText";
|
|
2193
|
-
data: string;
|
|
2194
|
-
driverParam: string;
|
|
2195
|
-
notNull: true;
|
|
2196
|
-
hasDefault: true;
|
|
2197
|
-
isPrimaryKey: true;
|
|
2198
|
-
isAutoincrement: false;
|
|
2199
|
-
hasRuntimeDefault: true;
|
|
2200
|
-
enumValues: [string, ...string[]];
|
|
2201
|
-
baseColumn: never;
|
|
2202
|
-
identity: undefined;
|
|
2203
|
-
generated: undefined;
|
|
2204
|
-
}, {}, {}>;
|
|
2205
|
-
roleId: drizzle_orm_pg_core.PgColumn<{
|
|
2206
|
-
name: "role_id";
|
|
2207
|
-
tableName: "role_permissions";
|
|
2208
|
-
dataType: "string";
|
|
2209
|
-
columnType: "PgText";
|
|
2210
|
-
data: string;
|
|
2211
|
-
driverParam: string;
|
|
2212
|
-
notNull: true;
|
|
2213
|
-
hasDefault: false;
|
|
2214
|
-
isPrimaryKey: false;
|
|
2215
|
-
isAutoincrement: false;
|
|
2216
|
-
hasRuntimeDefault: false;
|
|
2217
|
-
enumValues: [string, ...string[]];
|
|
2218
|
-
baseColumn: never;
|
|
2219
|
-
identity: undefined;
|
|
2220
|
-
generated: undefined;
|
|
2221
|
-
}, {}, {}>;
|
|
2222
|
-
permissionId: drizzle_orm_pg_core.PgColumn<{
|
|
2223
|
-
name: "permission_id";
|
|
2224
|
-
tableName: "role_permissions";
|
|
2225
|
-
dataType: "string";
|
|
2226
|
-
columnType: "PgText";
|
|
2227
|
-
data: string;
|
|
2228
|
-
driverParam: string;
|
|
2229
|
-
notNull: true;
|
|
2230
|
-
hasDefault: false;
|
|
2231
|
-
isPrimaryKey: false;
|
|
2232
|
-
isAutoincrement: false;
|
|
2233
|
-
hasRuntimeDefault: false;
|
|
2234
|
-
enumValues: [string, ...string[]];
|
|
2235
|
-
baseColumn: never;
|
|
2236
|
-
identity: undefined;
|
|
2237
|
-
generated: undefined;
|
|
2238
|
-
}, {}, {}>;
|
|
2239
|
-
};
|
|
2240
|
-
dialect: "pg";
|
|
2241
|
-
}>;
|
|
1271
|
+
declare const createTokenDto: z.ZodObject<{
|
|
1272
|
+
userId: z.ZodString;
|
|
1273
|
+
token: z.ZodString;
|
|
1274
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
1275
|
+
access: "access";
|
|
1276
|
+
refresh: "refresh";
|
|
1277
|
+
}>>;
|
|
1278
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
1279
|
+
active: "active";
|
|
1280
|
+
revoked: "revoked";
|
|
1281
|
+
expired: "expired";
|
|
1282
|
+
}>>;
|
|
1283
|
+
expiresAt: z.ZodString;
|
|
1284
|
+
}, z.core.$strip>;
|
|
1285
|
+
declare const updateTokenDto: z.ZodObject<{
|
|
1286
|
+
status: z.ZodEnum<{
|
|
1287
|
+
active: "active";
|
|
1288
|
+
revoked: "revoked";
|
|
1289
|
+
expired: "expired";
|
|
1290
|
+
}>;
|
|
1291
|
+
}, z.core.$strip>;
|
|
1292
|
+
declare const tokenIdParam: z.ZodObject<{
|
|
1293
|
+
id: z.ZodString;
|
|
1294
|
+
}, z.core.$strip>;
|
|
1295
|
+
declare const verifyTokenDto: z.ZodObject<{
|
|
1296
|
+
token: z.ZodString;
|
|
1297
|
+
}, z.core.$strip>;
|
|
1298
|
+
declare const refreshTokenDto: z.ZodObject<{
|
|
1299
|
+
refreshToken: z.ZodString;
|
|
1300
|
+
}, z.core.$strip>;
|
|
1301
|
+
declare const revokeTokenDto: z.ZodObject<{
|
|
1302
|
+
userId: z.ZodString;
|
|
1303
|
+
}, z.core.$strip>;
|
|
1304
|
+
type CreateTokenDto = z.infer<typeof createTokenDto>;
|
|
1305
|
+
type UpdateTokenDto = z.infer<typeof updateTokenDto>;
|
|
1306
|
+
type TokenIdParam = z.infer<typeof tokenIdParam>;
|
|
1307
|
+
type VerifyTokenDto = z.infer<typeof verifyTokenDto>;
|
|
1308
|
+
type RefreshTokenDto = z.infer<typeof refreshTokenDto>;
|
|
1309
|
+
type RevokeTokenDto = z.infer<typeof revokeTokenDto>;
|
|
1310
|
+
|
|
1311
|
+
declare class UserController {
|
|
1312
|
+
private userService;
|
|
1313
|
+
constructor(userService: UserService);
|
|
1314
|
+
getUsers(): Promise<SanitizedUser[]>;
|
|
1315
|
+
getLang(): Promise<{
|
|
1316
|
+
language: string;
|
|
1317
|
+
}>;
|
|
1318
|
+
updateLang(params: LanguageParam): Promise<string>;
|
|
1319
|
+
getUser(params: UserIdParam): Promise<SanitizedUser>;
|
|
1320
|
+
getByEmail(params: EmailParam): Promise<SanitizedUser>;
|
|
1321
|
+
getRole(params: UserIdInParam): Promise<string>;
|
|
1322
|
+
create(body: CreateUserDto): Promise<SanitizedUser>;
|
|
1323
|
+
update(params: UserIdParam, body: UpdateUserDto): Promise<SanitizedUser>;
|
|
1324
|
+
delete(params: UserIdParam): Promise<SanitizedUser>;
|
|
1325
|
+
deleteAll(): Promise<SanitizedUser[]>;
|
|
1326
|
+
assignRole(params: AssignRoleParams): Promise<SanitizedUser>;
|
|
1327
|
+
removeRole(params: UserIdInParam): Promise<SanitizedUser>;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
declare const USER_STATUS: readonly ["active", "inactive", "pending"];
|
|
1331
|
+
declare const TOKEN_STATUS: readonly ["active", "revoked", "expired"];
|
|
1332
|
+
declare const TOKEN_TYPE: readonly ["access", "refresh"];
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Shared user configuration for seeding
|
|
1336
|
+
*/
|
|
1337
|
+
interface SeedUserConfig {
|
|
1338
|
+
email: string;
|
|
1339
|
+
password: string;
|
|
1340
|
+
roleName: string;
|
|
1341
|
+
emailVerified?: boolean;
|
|
1342
|
+
status?: 'active' | 'inactive' | 'pending';
|
|
1343
|
+
image?: string;
|
|
1344
|
+
username?: string;
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Low-level factory config (for use with SeedService)
|
|
1348
|
+
*/
|
|
1349
|
+
interface AuthSeedConfig {
|
|
1350
|
+
adminEmail: string;
|
|
1351
|
+
adminPass: string;
|
|
1352
|
+
roles?: Array<{
|
|
1353
|
+
name: string;
|
|
1354
|
+
description?: string;
|
|
1355
|
+
}>;
|
|
1356
|
+
permissions?: Array<{
|
|
1357
|
+
action: string;
|
|
1358
|
+
resource: string;
|
|
1359
|
+
name: string;
|
|
1360
|
+
description?: string;
|
|
1361
|
+
}>;
|
|
1362
|
+
additionalUsers?: SeedUserConfig[];
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* High-level standalone function config
|
|
1366
|
+
*/
|
|
1367
|
+
interface SeedAuthDataConfig {
|
|
1368
|
+
/** Drizzle database instance (required) */
|
|
1369
|
+
db: any;
|
|
1370
|
+
/** Admin email (required) */
|
|
1371
|
+
adminEmail: string;
|
|
1372
|
+
/** Admin password (required) */
|
|
1373
|
+
adminPassword: string;
|
|
1374
|
+
/** Additional users to seed (optional) */
|
|
1375
|
+
users?: SeedUserConfig[];
|
|
1376
|
+
/** Custom roles (optional - uses defaults if omitted) */
|
|
1377
|
+
roles?: Array<{
|
|
1378
|
+
name: string;
|
|
1379
|
+
description?: string;
|
|
1380
|
+
}>;
|
|
1381
|
+
/** Custom permissions (optional - uses defaults if omitted) */
|
|
1382
|
+
permissions?: Array<{
|
|
1383
|
+
action: string;
|
|
1384
|
+
resource: string;
|
|
1385
|
+
name: string;
|
|
1386
|
+
description?: string;
|
|
1387
|
+
}>;
|
|
1388
|
+
/** Show verbose logging (optional) */
|
|
1389
|
+
verbose?: boolean;
|
|
1390
|
+
/** Conflict handling strategy (optional) */
|
|
1391
|
+
onConflict?: 'skip' | 'replace' | 'fail';
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Result of seedAuthData operation
|
|
1395
|
+
*/
|
|
1396
|
+
interface SeedAuthDataResult {
|
|
1397
|
+
inserted: number;
|
|
1398
|
+
skipped: number;
|
|
1399
|
+
failed: number;
|
|
1400
|
+
users: Array<{
|
|
1401
|
+
id: string;
|
|
1402
|
+
email: string;
|
|
1403
|
+
roleId: string;
|
|
1404
|
+
}>;
|
|
1405
|
+
roles: Array<{
|
|
1406
|
+
id: string;
|
|
1407
|
+
name: string;
|
|
1408
|
+
}>;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Composable seed definition factory for najm-auth plugin.
|
|
1413
|
+
*
|
|
1414
|
+
* Provides default roles, permissions, and admin user with proper validation and password hashing.
|
|
1415
|
+
*
|
|
1416
|
+
* @example
|
|
1417
|
+
* ```typescript
|
|
1418
|
+
* const seeder = server.container.get(SeedService);
|
|
1419
|
+
*
|
|
1420
|
+
* await seeder.run({
|
|
1421
|
+
* ...authSeed({ adminEmail: 'admin@test.com', adminPass: 'Admin123!' }),
|
|
1422
|
+
* // ... your app-specific seeds
|
|
1423
|
+
* });
|
|
1424
|
+
* ```
|
|
1425
|
+
*/
|
|
1426
|
+
declare const authSeed: (config: AuthSeedConfig) => Record<string, SeedEntry>;
|
|
2242
1427
|
|
|
2243
|
-
|
|
1428
|
+
/**
|
|
1429
|
+
* Standalone function to seed authentication data.
|
|
1430
|
+
* Handles Server setup, seeding, and cleanup automatically.
|
|
1431
|
+
*
|
|
1432
|
+
* @example
|
|
1433
|
+
* ```typescript
|
|
1434
|
+
* // In a seed script
|
|
1435
|
+
* import { seedAuthData } from 'najm-auth';
|
|
1436
|
+
* import { db } from './database';
|
|
1437
|
+
*
|
|
1438
|
+
* await seedAuthData({
|
|
1439
|
+
* db,
|
|
1440
|
+
* adminEmail: 'admin@app.com',
|
|
1441
|
+
* adminPassword: 'Secret123!',
|
|
1442
|
+
* users: [
|
|
1443
|
+
* { email: 'user@app.com', password: 'User123!', roleName: 'user' }
|
|
1444
|
+
* ]
|
|
1445
|
+
* });
|
|
1446
|
+
* ```
|
|
1447
|
+
*
|
|
1448
|
+
* @example
|
|
1449
|
+
* ```typescript
|
|
1450
|
+
* // In a service method
|
|
1451
|
+
* @Service()
|
|
1452
|
+
* class SetupService {
|
|
1453
|
+
* async seedDefaultData() {
|
|
1454
|
+
* await seedAuthData({
|
|
1455
|
+
* db: this.db,
|
|
1456
|
+
* adminEmail: process.env.ADMIN_EMAIL!,
|
|
1457
|
+
* adminPassword: process.env.ADMIN_PASSWORD!,
|
|
1458
|
+
* verbose: true
|
|
1459
|
+
* });
|
|
1460
|
+
* }
|
|
1461
|
+
* }
|
|
1462
|
+
* ```
|
|
1463
|
+
*/
|
|
1464
|
+
declare function seedAuthData(config: SeedAuthDataConfig): Promise<SeedAuthDataResult>;
|
|
2244
1465
|
|
|
2245
|
-
export {
|
|
1466
|
+
export { AUTH_CONFIG, en as AUTH_EN, AUTH_LOCALES, AUTH_MODULE, AUTH_PERMISSIONS, AUTH_ROLE, AUTH_SCHEMA, AUTH_SUPPORTED_LANGUAGES, AUTH_USER, type AssignPermissionDto, type AssignRoleDto, type AssignRoleParams, type AuthConfig, AuthController, AuthGuard, type AuthPluginConfig, AuthQueries, type AuthSchema, type AuthSeedConfig, AuthService, type AuthUser, Can, type ChangePasswordDto, type CheckPermissionDto, type ConfirmResetPasswordDto, CookieManager, type CreatePermissionDto, type CreateRoleDto, type CreateTokenDto, type CreateUserDto, type EmailParam, EncryptionService, type JwtConfig, type JwtPayload, type LanguageParam, type LoginDto, NewPermission, NewRoleEntity, NewUser, Permission, PermissionController, PermissionGuard, type PermissionIdParam, PermissionRepository, PermissionService, PermissionValidator, ROLES, ROLE_GROUPS, type RefreshTokenDto, type ResetPasswordDto, type RevokeTokenDto, Role, RoleController, RoleEntity, RoleGuard, type RoleIdParam, type RoleInput, RolePermission, RoleRepository, RoleService, type RoleType, RoleValidator, type SanitizedUser, type SeedAuthDataConfig, type SeedAuthDataResult, type SeedUserConfig, TOKEN_STATUS, TOKEN_TYPE, type TokenIdParam, type TokenPair, TokenRepository, TokenService, USER_STATUS, type UpdatePermissionDto, type UpdateRoleDto, type UpdateTokenDto, type UpdateUserDto, User, UserController, type UserIdInParam, type UserIdParam, UserRepository, UserService, UserValidator, type UserWithPermissions, type VerifyTokenDto, assignPermissionDto, assignRoleDto, assignRoleParams, auth$1 as auth, authSeed, avatarsPath, calculateAge, calculateYearsOfExperience, canCreate, canDelete, canManage, canRead, canUpdate, changePasswordDto, checkPermissionDto, clean, confirmResetPasswordDto, createPermissionDto, createRoleDto, createTokenDto, createUserDto, emailParam, formatDate, getAuthLocale, getAvatarFile, isAdmin, isAdministrator, isAuth, isEmpty, isFile, isPath, languageParam, loginDto, parseSchema, permissionIdParam, pickProps, refreshTokenDto, resetPasswordDto, revokeTokenDto, roleIdParam, seedAuthData, tokenIdParam, updatePermissionDto, updateRoleDto, updateTokenDto, updateUserDto, userIdInParam, userIdParam, verifyTokenDto };
|