@brite-future-schools-contracts/contracts 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3OMU2YSE.js +478 -0
- package/dist/chunk-3OMU2YSE.js.map +1 -0
- package/dist/chunk-R4XE3SFR.js +1 -0
- package/dist/chunk-S3BK5YEH.js +131 -0
- package/dist/chunk-S3BK5YEH.js.map +1 -0
- package/dist/contracts/index.cjs +415 -2
- package/dist/contracts/index.cjs.map +1 -1
- package/dist/contracts/index.d.cts +941 -1
- package/dist/contracts/index.d.ts +941 -1
- package/dist/contracts/index.js +32 -4
- package/dist/index.cjs +683 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -2
- package/dist/index.d.ts +134 -2
- package/dist/index.js +265 -5
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.cjs +373 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +564 -1
- package/dist/schemas/index.d.ts +564 -1
- package/dist/schemas/index.js +46 -2
- package/package.json +1 -1
- package/dist/chunk-AEZO7MJD.js +0 -127
- package/dist/chunk-AEZO7MJD.js.map +0 -1
- package/dist/chunk-IR6JUP6L.js +0 -48
- package/dist/chunk-IR6JUP6L.js.map +0 -1
- package/dist/chunk-PCHAGP5X.js +0 -1
- /package/dist/{chunk-PCHAGP5X.js.map → chunk-R4XE3SFR.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -31,8 +31,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
BranchRefSchema: () => BranchRefSchema,
|
|
34
|
+
BulkUploadStudentRowSchema: () => BulkUploadStudentRowSchema,
|
|
35
|
+
BulkUploadStudentsInputSchema: () => BulkUploadStudentsInputSchema,
|
|
36
|
+
BulkUploadStudentsOutputSchema: () => BulkUploadStudentsOutputSchema,
|
|
34
37
|
ChangePasswordInputSchema: () => ChangePasswordInputSchema,
|
|
38
|
+
ClassSummarySchema: () => ClassSummarySchema,
|
|
39
|
+
CreateDepartmentInputSchema: () => CreateDepartmentInputSchema,
|
|
40
|
+
CreateStaffInputSchema: () => CreateStaffInputSchema,
|
|
41
|
+
CreateStaffOutputSchema: () => CreateStaffOutputSchema,
|
|
42
|
+
CreateStudentInputSchema: () => CreateStudentInputSchema,
|
|
43
|
+
CreateStudentOutputSchema: () => CreateStudentOutputSchema,
|
|
35
44
|
CuidSchema: () => CuidSchema,
|
|
45
|
+
DepartmentSchema: () => DepartmentSchema,
|
|
46
|
+
EmploymentTypeSchema: () => EmploymentTypeSchema,
|
|
47
|
+
GenderSchema: () => GenderSchema,
|
|
48
|
+
GradeLevelSchema: () => GradeLevelSchema,
|
|
49
|
+
LinkGuardianInputSchema: () => LinkGuardianInputSchema,
|
|
50
|
+
ListStaffInputSchema: () => ListStaffInputSchema,
|
|
51
|
+
ListStudentsInputSchema: () => ListStudentsInputSchema,
|
|
36
52
|
LoginInputSchema: () => LoginInputSchema,
|
|
37
53
|
LoginOutputSchema: () => LoginOutputSchema,
|
|
38
54
|
LogoutInputSchema: () => LogoutInputSchema,
|
|
@@ -41,23 +57,81 @@ __export(src_exports, {
|
|
|
41
57
|
RefreshTokenOutputSchema: () => RefreshTokenOutputSchema,
|
|
42
58
|
RequestPasswordResetInputSchema: () => RequestPasswordResetInputSchema,
|
|
43
59
|
ResetPasswordInputSchema: () => ResetPasswordInputSchema,
|
|
60
|
+
RoleNameSchema: () => RoleNameSchema,
|
|
44
61
|
SessionUserOutputSchema: () => SessionUserOutputSchema,
|
|
45
62
|
SessionUserRoleSchema: () => SessionUserRoleSchema,
|
|
46
63
|
SessionUserSubRoleSchema: () => SessionUserSubRoleSchema,
|
|
47
64
|
SoftDeleteSchema: () => SoftDeleteSchema,
|
|
65
|
+
StaffListItemSchema: () => StaffListItemSchema,
|
|
66
|
+
StaffProfileSchema: () => StaffProfileSchema,
|
|
67
|
+
StudentListItemSchema: () => StudentListItemSchema,
|
|
68
|
+
StudentProfileSchema: () => StudentProfileSchema,
|
|
69
|
+
StudentStatusSchema: () => StudentStatusSchema,
|
|
48
70
|
SwitchBranchInputSchema: () => SwitchBranchInputSchema,
|
|
49
71
|
TimestampsSchema: () => TimestampsSchema,
|
|
50
72
|
UuidSchema: () => UuidSchema,
|
|
51
73
|
authContract: () => authContract,
|
|
74
|
+
bulkUploadStudentsContract: () => bulkUploadStudentsContract,
|
|
75
|
+
canAccessAdminDashboard: () => canAccessAdminDashboard,
|
|
76
|
+
canManageStaff: () => canManageStaff,
|
|
77
|
+
canManageStudents: () => canManageStudents,
|
|
78
|
+
canMarkClassAttendance: () => canMarkClassAttendance,
|
|
79
|
+
canMarkStaffAttendance: () => canMarkStaffAttendance,
|
|
80
|
+
canViewClassAttendance: () => canViewClassAttendance,
|
|
81
|
+
canViewStaffAttendance: () => canViewStaffAttendance,
|
|
82
|
+
canViewStaffList: () => canViewStaffList,
|
|
83
|
+
canViewStudentList: () => canViewStudentList,
|
|
52
84
|
changePasswordContract: () => changePasswordContract,
|
|
85
|
+
createDepartmentContract: () => createDepartmentContract,
|
|
86
|
+
createStaffContract: () => createStaffContract,
|
|
87
|
+
createStudentContract: () => createStudentContract,
|
|
53
88
|
getMeContract: () => getMeContract,
|
|
89
|
+
getStaffByIdContract: () => getStaffByIdContract,
|
|
90
|
+
getStudentByIdContract: () => getStudentByIdContract,
|
|
91
|
+
hrContract: () => hrContract,
|
|
92
|
+
isBoardingMaster: () => isBoardingMaster,
|
|
93
|
+
isBursar: () => isBursar,
|
|
94
|
+
isCaretaker: () => isCaretaker,
|
|
95
|
+
isClassTeacher: () => isClassTeacher,
|
|
96
|
+
isCounsellor: () => isCounsellor,
|
|
97
|
+
isDeputyPrincipal: () => isDeputyPrincipal,
|
|
98
|
+
isDirector: () => isDirector,
|
|
99
|
+
isDriver: () => isDriver,
|
|
100
|
+
isHOD: () => isHOD,
|
|
101
|
+
isHrAdmin: () => isHrAdmin,
|
|
102
|
+
isIndividualSponsor: () => isIndividualSponsor,
|
|
103
|
+
isItAdmin: () => isItAdmin,
|
|
104
|
+
isKitchenManager: () => isKitchenManager,
|
|
105
|
+
isKitchenStaff: () => isKitchenStaff,
|
|
106
|
+
isLabTechnician: () => isLabTechnician,
|
|
107
|
+
isLibrarian: () => isLibrarian,
|
|
108
|
+
isOrgSponsor: () => isOrgSponsor,
|
|
109
|
+
isParent: () => isParent,
|
|
110
|
+
isPrefect: () => isPrefect,
|
|
111
|
+
isPrincipal: () => isPrincipal,
|
|
112
|
+
isProprietor: () => isProprietor,
|
|
113
|
+
isSchoolNurse: () => isSchoolNurse,
|
|
114
|
+
isSecurity: () => isSecurity,
|
|
115
|
+
isSeniorLeadership: () => isSeniorLeadership,
|
|
116
|
+
isSportsCoach: () => isSportsCoach,
|
|
117
|
+
isStaff: () => isStaff,
|
|
118
|
+
isStudent: () => isStudent,
|
|
119
|
+
isSubjectTeacher: () => isSubjectTeacher,
|
|
120
|
+
isSystemAdmin: () => isSystemAdmin,
|
|
121
|
+
linkGuardianContract: () => linkGuardianContract,
|
|
122
|
+
listClassesContract: () => listClassesContract,
|
|
123
|
+
listDepartmentsContract: () => listDepartmentsContract,
|
|
124
|
+
listStaffContract: () => listStaffContract,
|
|
125
|
+
listStudentsContract: () => listStudentsContract,
|
|
54
126
|
loginContract: () => loginContract,
|
|
55
127
|
logoutContract: () => logoutContract,
|
|
56
128
|
paginatedOutputSchema: () => paginatedOutputSchema,
|
|
57
129
|
refreshTokenContract: () => refreshTokenContract,
|
|
58
130
|
requestPasswordResetContract: () => requestPasswordResetContract,
|
|
59
131
|
resetPasswordContract: () => resetPasswordContract,
|
|
60
|
-
|
|
132
|
+
studentsContract: () => studentsContract,
|
|
133
|
+
switchBranchContract: () => switchBranchContract,
|
|
134
|
+
updateStaffStatusContract: () => updateStaffStatusContract
|
|
61
135
|
});
|
|
62
136
|
module.exports = __toCommonJS(src_exports);
|
|
63
137
|
|
|
@@ -166,10 +240,339 @@ var SwitchBranchInputSchema = z2.object({
|
|
|
166
240
|
branchId: CuidSchema.meta({ description: "Branch to switch the active session to" })
|
|
167
241
|
});
|
|
168
242
|
|
|
243
|
+
// src/schemas/hr.ts
|
|
244
|
+
var z3 = __toESM(require("zod"), 1);
|
|
245
|
+
var EmploymentTypeSchema = z3.enum([
|
|
246
|
+
"permanent",
|
|
247
|
+
"contract",
|
|
248
|
+
"temporary",
|
|
249
|
+
"intern"
|
|
250
|
+
]);
|
|
251
|
+
var RoleNameSchema = z3.enum([
|
|
252
|
+
"PROPRIETOR",
|
|
253
|
+
"DIRECTOR",
|
|
254
|
+
"SYSTEM_ADMIN",
|
|
255
|
+
"PRINCIPAL",
|
|
256
|
+
"DEPUTY_PRINCIPAL",
|
|
257
|
+
"HOD",
|
|
258
|
+
"CLASS_TEACHER",
|
|
259
|
+
"SUBJECT_TEACHER",
|
|
260
|
+
"BURSAR",
|
|
261
|
+
"HR_ADMIN",
|
|
262
|
+
"SCHOOL_NURSE",
|
|
263
|
+
"LIBRARIAN",
|
|
264
|
+
"LAB_TECHNICIAN",
|
|
265
|
+
"SPORTS_COACH",
|
|
266
|
+
"COUNSELLOR",
|
|
267
|
+
"CARETAKER",
|
|
268
|
+
"SECURITY",
|
|
269
|
+
"KITCHEN_STAFF",
|
|
270
|
+
"KITCHEN_MANAGER",
|
|
271
|
+
"DRIVER",
|
|
272
|
+
"IT_ADMIN",
|
|
273
|
+
"BOARDING_MASTER",
|
|
274
|
+
"PREFECT",
|
|
275
|
+
"STUDENT",
|
|
276
|
+
"PARENT",
|
|
277
|
+
"ORG_SPONSOR",
|
|
278
|
+
"INDIVIDUAL_SPONSOR"
|
|
279
|
+
]);
|
|
280
|
+
var CreateStaffInputSchema = z3.object({
|
|
281
|
+
// Personal details
|
|
282
|
+
firstName: z3.string().min(1).max(100),
|
|
283
|
+
middleName: z3.string().max(100).optional(),
|
|
284
|
+
lastName: z3.string().min(1).max(100),
|
|
285
|
+
email: z3.email(),
|
|
286
|
+
phone: z3.string().min(9).max(30),
|
|
287
|
+
nationalId: z3.string().min(1).max(20),
|
|
288
|
+
// Role assignment
|
|
289
|
+
roleName: RoleNameSchema.meta({
|
|
290
|
+
description: "System role to assign \u2014 determines dashboard access and permissions"
|
|
291
|
+
}),
|
|
292
|
+
isPrimaryRole: z3.boolean().default(true),
|
|
293
|
+
// Employment details
|
|
294
|
+
departmentId: UuidSchema.optional(),
|
|
295
|
+
designation: z3.string().min(1).max(100).meta({
|
|
296
|
+
description: 'Job title, e.g. "Mathematics Teacher", "Head of Finance"'
|
|
297
|
+
}),
|
|
298
|
+
employmentType: EmploymentTypeSchema,
|
|
299
|
+
contractStart: z3.iso.date().meta({ description: "ISO date, e.g. 2026-01-15" }),
|
|
300
|
+
contractEnd: z3.iso.date().optional(),
|
|
301
|
+
// Payroll
|
|
302
|
+
basicSalary: z3.number().positive(),
|
|
303
|
+
houseAllowance: z3.number().nonnegative().default(0),
|
|
304
|
+
transportAllowance: z3.number().nonnegative().default(0),
|
|
305
|
+
helbDeduction: z3.number().nonnegative().default(0),
|
|
306
|
+
saccoDeduction: z3.number().nonnegative().default(0),
|
|
307
|
+
// Banking
|
|
308
|
+
bankName: z3.string().max(100).optional(),
|
|
309
|
+
bankAccount: z3.string().max(30).optional(),
|
|
310
|
+
bankBranch: z3.string().max(100).optional(),
|
|
311
|
+
// Statutory
|
|
312
|
+
tscNumber: z3.string().max(30).optional(),
|
|
313
|
+
kraPin: z3.string().max(20).optional(),
|
|
314
|
+
nhifNo: z3.string().max(20).optional(),
|
|
315
|
+
nssfNo: z3.string().max(20).optional()
|
|
316
|
+
});
|
|
317
|
+
var StaffProfileSchema = z3.object({
|
|
318
|
+
// Staff record
|
|
319
|
+
id: UuidSchema,
|
|
320
|
+
userId: UuidSchema,
|
|
321
|
+
branchId: UuidSchema,
|
|
322
|
+
firstName: z3.string(),
|
|
323
|
+
middleName: z3.string().nullable(),
|
|
324
|
+
lastName: z3.string(),
|
|
325
|
+
phone: z3.string(),
|
|
326
|
+
nationalId: z3.string(),
|
|
327
|
+
tscNumber: z3.string().nullable(),
|
|
328
|
+
kraPin: z3.string().nullable(),
|
|
329
|
+
nhifNo: z3.string().nullable(),
|
|
330
|
+
nssfNo: z3.string().nullable(),
|
|
331
|
+
designation: z3.string(),
|
|
332
|
+
employmentType: EmploymentTypeSchema,
|
|
333
|
+
contractStart: z3.string(),
|
|
334
|
+
contractEnd: z3.string().nullable(),
|
|
335
|
+
basicSalary: z3.string(),
|
|
336
|
+
houseAllowance: z3.string(),
|
|
337
|
+
transportAllowance: z3.string(),
|
|
338
|
+
helbDeduction: z3.string().nullable(),
|
|
339
|
+
saccoDeduction: z3.string().nullable(),
|
|
340
|
+
bankName: z3.string().nullable(),
|
|
341
|
+
bankAccount: z3.string().nullable(),
|
|
342
|
+
bankBranch: z3.string().nullable(),
|
|
343
|
+
status: z3.string(),
|
|
344
|
+
createdAt: z3.string(),
|
|
345
|
+
// From users join
|
|
346
|
+
email: z3.string(),
|
|
347
|
+
mustChangePassword: z3.boolean(),
|
|
348
|
+
// Department (nullable — not all staff are in a department)
|
|
349
|
+
departmentId: UuidSchema.nullable(),
|
|
350
|
+
departmentName: z3.string().nullable(),
|
|
351
|
+
// Primary role
|
|
352
|
+
roleName: RoleNameSchema.nullable(),
|
|
353
|
+
roleId: UuidSchema.nullable()
|
|
354
|
+
});
|
|
355
|
+
var StaffListItemSchema = z3.object({
|
|
356
|
+
id: UuidSchema,
|
|
357
|
+
userId: UuidSchema,
|
|
358
|
+
firstName: z3.string(),
|
|
359
|
+
middleName: z3.string().nullable(),
|
|
360
|
+
lastName: z3.string(),
|
|
361
|
+
email: z3.string(),
|
|
362
|
+
phone: z3.string(),
|
|
363
|
+
designation: z3.string(),
|
|
364
|
+
employmentType: EmploymentTypeSchema,
|
|
365
|
+
status: z3.string(),
|
|
366
|
+
departmentName: z3.string().nullable(),
|
|
367
|
+
roleName: RoleNameSchema.nullable(),
|
|
368
|
+
createdAt: z3.string()
|
|
369
|
+
});
|
|
370
|
+
var ListStaffInputSchema = PaginationInputSchema.extend({
|
|
371
|
+
search: z3.string().optional().meta({
|
|
372
|
+
description: "Search by name or email"
|
|
373
|
+
}),
|
|
374
|
+
departmentId: UuidSchema.optional(),
|
|
375
|
+
roleName: RoleNameSchema.optional(),
|
|
376
|
+
status: z3.enum(["active", "inactive"]).optional()
|
|
377
|
+
});
|
|
378
|
+
var CreateStaffOutputSchema = z3.object({
|
|
379
|
+
staffId: UuidSchema,
|
|
380
|
+
userId: UuidSchema,
|
|
381
|
+
email: z3.string(),
|
|
382
|
+
/** Temp password was emailed — not returned in response for security */
|
|
383
|
+
emailSent: z3.boolean()
|
|
384
|
+
});
|
|
385
|
+
var DepartmentSchema = z3.object({
|
|
386
|
+
id: UuidSchema,
|
|
387
|
+
branchId: UuidSchema,
|
|
388
|
+
name: z3.string(),
|
|
389
|
+
hodId: UuidSchema.nullable()
|
|
390
|
+
});
|
|
391
|
+
var CreateDepartmentInputSchema = z3.object({
|
|
392
|
+
name: z3.string().min(1).max(100),
|
|
393
|
+
hodId: UuidSchema.optional()
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// src/schemas/students.ts
|
|
397
|
+
var z4 = __toESM(require("zod"), 1);
|
|
398
|
+
var GenderSchema = z4.enum(["male", "female"]);
|
|
399
|
+
var StudentStatusSchema = z4.enum([
|
|
400
|
+
"active",
|
|
401
|
+
"transferred",
|
|
402
|
+
"graduated",
|
|
403
|
+
"suspended",
|
|
404
|
+
"withdrawn"
|
|
405
|
+
]);
|
|
406
|
+
var GradeLevelSchema = z4.enum([
|
|
407
|
+
"PP1",
|
|
408
|
+
"PP2",
|
|
409
|
+
"G1",
|
|
410
|
+
"G2",
|
|
411
|
+
"G3",
|
|
412
|
+
"G4",
|
|
413
|
+
"G5",
|
|
414
|
+
"G6",
|
|
415
|
+
"G7",
|
|
416
|
+
"G8",
|
|
417
|
+
"G9"
|
|
418
|
+
]);
|
|
419
|
+
var CreateStudentInputSchema = z4.object({
|
|
420
|
+
// Identity
|
|
421
|
+
firstName: z4.string().min(1).max(100),
|
|
422
|
+
middleName: z4.string().max(100).optional(),
|
|
423
|
+
lastName: z4.string().min(1).max(100),
|
|
424
|
+
dateOfBirth: z4.iso.date().meta({ description: "ISO date, e.g. 2015-03-22" }),
|
|
425
|
+
gender: GenderSchema,
|
|
426
|
+
admissionNo: z4.string().min(1).max(50).meta({
|
|
427
|
+
description: "School-assigned admission number \u2014 must be unique per branch"
|
|
428
|
+
}),
|
|
429
|
+
nemisNo: z4.string().max(50).optional(),
|
|
430
|
+
admissionDate: z4.iso.date(),
|
|
431
|
+
bloodGroup: z4.string().max(10).optional(),
|
|
432
|
+
medicalNotes: z4.string().optional(),
|
|
433
|
+
// Class placement (optional at creation — can be enrolled later)
|
|
434
|
+
classId: UuidSchema.optional().meta({
|
|
435
|
+
description: "Class to enrol student in for the current term"
|
|
436
|
+
}),
|
|
437
|
+
termId: UuidSchema.optional().meta({
|
|
438
|
+
description: "Term for class enrolment \u2014 required if classId is provided"
|
|
439
|
+
}),
|
|
440
|
+
// Guardian (optional at creation — can be linked later)
|
|
441
|
+
guardian: z4.object({
|
|
442
|
+
firstName: z4.string().min(1).max(100),
|
|
443
|
+
middleName: z4.string().max(100).optional(),
|
|
444
|
+
lastName: z4.string().min(1).max(100),
|
|
445
|
+
relationship: z4.string().min(1).max(50).meta({
|
|
446
|
+
description: "e.g. mother, father, uncle, guardian"
|
|
447
|
+
}),
|
|
448
|
+
phone: z4.string().min(9).max(30),
|
|
449
|
+
email: z4.email().optional(),
|
|
450
|
+
nationalId: z4.string().max(20).optional(),
|
|
451
|
+
occupation: z4.string().max(100).optional()
|
|
452
|
+
}).optional()
|
|
453
|
+
});
|
|
454
|
+
var StudentProfileSchema = z4.object({
|
|
455
|
+
id: UuidSchema,
|
|
456
|
+
branchId: UuidSchema,
|
|
457
|
+
admissionNo: z4.string(),
|
|
458
|
+
nemisNo: z4.string().nullable(),
|
|
459
|
+
firstName: z4.string(),
|
|
460
|
+
middleName: z4.string().nullable(),
|
|
461
|
+
lastName: z4.string(),
|
|
462
|
+
dateOfBirth: z4.string(),
|
|
463
|
+
gender: GenderSchema,
|
|
464
|
+
photoUrl: z4.string().nullable(),
|
|
465
|
+
bloodGroup: z4.string().nullable(),
|
|
466
|
+
medicalNotes: z4.string().nullable(),
|
|
467
|
+
admissionDate: z4.string(),
|
|
468
|
+
status: StudentStatusSchema,
|
|
469
|
+
createdAt: z4.string(),
|
|
470
|
+
// Current class (from latest enrollment)
|
|
471
|
+
currentClass: z4.object({
|
|
472
|
+
classId: UuidSchema,
|
|
473
|
+
className: z4.string(),
|
|
474
|
+
gradeLevel: GradeLevelSchema,
|
|
475
|
+
termId: UuidSchema,
|
|
476
|
+
termName: z4.string()
|
|
477
|
+
}).nullable(),
|
|
478
|
+
// Guardians
|
|
479
|
+
guardians: z4.array(z4.object({
|
|
480
|
+
id: UuidSchema,
|
|
481
|
+
firstName: z4.string(),
|
|
482
|
+
middleName: z4.string().nullable(),
|
|
483
|
+
lastName: z4.string(),
|
|
484
|
+
relationship: z4.string(),
|
|
485
|
+
phone: z4.string(),
|
|
486
|
+
email: z4.string().nullable(),
|
|
487
|
+
isPrimary: z4.boolean()
|
|
488
|
+
}))
|
|
489
|
+
});
|
|
490
|
+
var StudentListItemSchema = z4.object({
|
|
491
|
+
id: UuidSchema,
|
|
492
|
+
admissionNo: z4.string(),
|
|
493
|
+
firstName: z4.string(),
|
|
494
|
+
middleName: z4.string().nullable(),
|
|
495
|
+
lastName: z4.string(),
|
|
496
|
+
gender: GenderSchema,
|
|
497
|
+
status: StudentStatusSchema,
|
|
498
|
+
className: z4.string().nullable(),
|
|
499
|
+
gradeLevel: GradeLevelSchema.nullable(),
|
|
500
|
+
primaryGuardianName: z4.string().nullable(),
|
|
501
|
+
primaryGuardianPhone: z4.string().nullable(),
|
|
502
|
+
createdAt: z4.string()
|
|
503
|
+
});
|
|
504
|
+
var ListStudentsInputSchema = PaginationInputSchema.extend({
|
|
505
|
+
search: z4.string().optional().meta({
|
|
506
|
+
description: "Search by name or admission number"
|
|
507
|
+
}),
|
|
508
|
+
classId: UuidSchema.optional(),
|
|
509
|
+
gradeLevel: GradeLevelSchema.optional(),
|
|
510
|
+
status: StudentStatusSchema.optional(),
|
|
511
|
+
termId: UuidSchema.optional()
|
|
512
|
+
});
|
|
513
|
+
var BulkUploadStudentRowSchema = z4.object({
|
|
514
|
+
firstName: z4.string().min(1),
|
|
515
|
+
middleName: z4.string().optional(),
|
|
516
|
+
lastName: z4.string().min(1),
|
|
517
|
+
dateOfBirth: z4.string().min(1).meta({ description: "Any parseable date string" }),
|
|
518
|
+
gender: z4.string().min(1).meta({ description: "male | female (case-insensitive)" }),
|
|
519
|
+
admissionNo: z4.string().min(1),
|
|
520
|
+
nemisNo: z4.string().optional(),
|
|
521
|
+
admissionDate: z4.string().optional(),
|
|
522
|
+
bloodGroup: z4.string().optional(),
|
|
523
|
+
// Guardian columns (all optional in CSV)
|
|
524
|
+
guardianFirstName: z4.string().optional(),
|
|
525
|
+
guardianLastName: z4.string().optional(),
|
|
526
|
+
guardianRelationship: z4.string().optional(),
|
|
527
|
+
guardianPhone: z4.string().optional(),
|
|
528
|
+
guardianEmail: z4.string().optional()
|
|
529
|
+
});
|
|
530
|
+
var BulkUploadStudentsInputSchema = z4.object({
|
|
531
|
+
classId: UuidSchema.meta({
|
|
532
|
+
description: "Class to enrol all uploaded students into"
|
|
533
|
+
}),
|
|
534
|
+
termId: UuidSchema,
|
|
535
|
+
rows: z4.array(BulkUploadStudentRowSchema).min(1).max(500)
|
|
536
|
+
});
|
|
537
|
+
var BulkUploadStudentsOutputSchema = z4.object({
|
|
538
|
+
created: z4.int().nonnegative(),
|
|
539
|
+
skipped: z4.int().nonnegative(),
|
|
540
|
+
errors: z4.array(z4.object({
|
|
541
|
+
row: z4.int().positive(),
|
|
542
|
+
admissionNo: z4.string().optional(),
|
|
543
|
+
reason: z4.string()
|
|
544
|
+
}))
|
|
545
|
+
});
|
|
546
|
+
var CreateStudentOutputSchema = z4.object({
|
|
547
|
+
studentId: UuidSchema,
|
|
548
|
+
admissionNo: z4.string()
|
|
549
|
+
});
|
|
550
|
+
var LinkGuardianInputSchema = z4.object({
|
|
551
|
+
studentId: UuidSchema,
|
|
552
|
+
firstName: z4.string().min(1).max(100),
|
|
553
|
+
middleName: z4.string().max(100).optional(),
|
|
554
|
+
lastName: z4.string().min(1).max(100),
|
|
555
|
+
relationship: z4.string().min(1).max(50),
|
|
556
|
+
phone: z4.string().min(9).max(30),
|
|
557
|
+
email: z4.email().optional(),
|
|
558
|
+
nationalId: z4.string().max(20).optional(),
|
|
559
|
+
occupation: z4.string().max(100).optional(),
|
|
560
|
+
isPrimary: z4.boolean().default(false)
|
|
561
|
+
});
|
|
562
|
+
var ClassSummarySchema = z4.object({
|
|
563
|
+
id: UuidSchema,
|
|
564
|
+
name: z4.string(),
|
|
565
|
+
gradeLevel: GradeLevelSchema,
|
|
566
|
+
gradeName: z4.string(),
|
|
567
|
+
capacity: z4.number().nullable(),
|
|
568
|
+
enrolledCount: z4.number(),
|
|
569
|
+
classTeacherId: UuidSchema.nullable()
|
|
570
|
+
});
|
|
571
|
+
|
|
169
572
|
// src/contracts/auth.ts
|
|
170
573
|
var import_contract = require("@orpc/contract");
|
|
171
|
-
var
|
|
172
|
-
var EmptyOutputSchema =
|
|
574
|
+
var z5 = __toESM(require("zod"), 1);
|
|
575
|
+
var EmptyOutputSchema = z5.object({}).meta({ description: "Empty success response" });
|
|
173
576
|
var loginContract = import_contract.oc.route({ method: "POST", path: "/auth/login" }).input(LoginInputSchema).output(LoginOutputSchema);
|
|
174
577
|
var refreshTokenContract = import_contract.oc.route({ method: "POST", path: "/auth/refresh" }).input(RefreshTokenInputSchema).output(RefreshTokenOutputSchema);
|
|
175
578
|
var logoutContract = import_contract.oc.route({ method: "POST", path: "/auth/logout" }).input(LogoutInputSchema).output(EmptyOutputSchema);
|
|
@@ -188,11 +591,229 @@ var authContract = {
|
|
|
188
591
|
resetPassword: resetPasswordContract,
|
|
189
592
|
switchBranch: switchBranchContract
|
|
190
593
|
};
|
|
594
|
+
|
|
595
|
+
// src/contracts/hr.ts
|
|
596
|
+
var import_contract2 = require("@orpc/contract");
|
|
597
|
+
var z6 = __toESM(require("zod"), 1);
|
|
598
|
+
var EmptyOutput = z6.object({});
|
|
599
|
+
var createStaffContract = import_contract2.oc.route({ method: "POST", path: "/hr/staff" }).input(CreateStaffInputSchema).output(CreateStaffOutputSchema);
|
|
600
|
+
var listStaffContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff" }).input(ListStaffInputSchema).output(z6.object({
|
|
601
|
+
items: z6.array(StaffListItemSchema),
|
|
602
|
+
total: z6.number(),
|
|
603
|
+
nextCursor: UuidSchema.nullable()
|
|
604
|
+
}));
|
|
605
|
+
var getStaffByIdContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff/{id}" }).input(z6.object({ id: UuidSchema })).output(StaffProfileSchema);
|
|
606
|
+
var updateStaffStatusContract = import_contract2.oc.route({ method: "PATCH", path: "/hr/staff/{id}/status" }).input(z6.object({
|
|
607
|
+
id: UuidSchema,
|
|
608
|
+
status: z6.enum(["active", "inactive", "suspended"])
|
|
609
|
+
})).output(EmptyOutput);
|
|
610
|
+
var listDepartmentsContract = import_contract2.oc.route({ method: "GET", path: "/hr/departments" }).input(z6.object({ branchId: UuidSchema.optional() })).output(z6.array(DepartmentSchema));
|
|
611
|
+
var createDepartmentContract = import_contract2.oc.route({ method: "POST", path: "/hr/departments" }).input(CreateDepartmentInputSchema).output(DepartmentSchema);
|
|
612
|
+
var hrContract = {
|
|
613
|
+
createStaff: createStaffContract,
|
|
614
|
+
listStaff: listStaffContract,
|
|
615
|
+
getStaffById: getStaffByIdContract,
|
|
616
|
+
updateStaffStatus: updateStaffStatusContract,
|
|
617
|
+
listDepartments: listDepartmentsContract,
|
|
618
|
+
createDepartment: createDepartmentContract
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
// src/contracts/students.ts
|
|
622
|
+
var import_contract3 = require("@orpc/contract");
|
|
623
|
+
var z7 = __toESM(require("zod"), 1);
|
|
624
|
+
var EmptyOutput2 = z7.object({});
|
|
625
|
+
var createStudentContract = import_contract3.oc.route({ method: "POST", path: "/students" }).input(CreateStudentInputSchema).output(CreateStudentOutputSchema);
|
|
626
|
+
var bulkUploadStudentsContract = import_contract3.oc.route({ method: "POST", path: "/students/bulk" }).input(BulkUploadStudentsInputSchema).output(BulkUploadStudentsOutputSchema);
|
|
627
|
+
var listStudentsContract = import_contract3.oc.route({ method: "GET", path: "/students" }).input(ListStudentsInputSchema).output(z7.object({
|
|
628
|
+
items: z7.array(StudentListItemSchema),
|
|
629
|
+
total: z7.number(),
|
|
630
|
+
nextCursor: UuidSchema.nullable()
|
|
631
|
+
}));
|
|
632
|
+
var getStudentByIdContract = import_contract3.oc.route({ method: "GET", path: "/students/{id}" }).input(z7.object({ id: UuidSchema })).output(StudentProfileSchema);
|
|
633
|
+
var linkGuardianContract = import_contract3.oc.route({ method: "POST", path: "/students/guardians" }).input(LinkGuardianInputSchema).output(z7.object({ guardianId: UuidSchema }));
|
|
634
|
+
var listClassesContract = import_contract3.oc.route({ method: "GET", path: "/students/classes" }).input(z7.object({
|
|
635
|
+
termId: UuidSchema.optional(),
|
|
636
|
+
gradeLevel: z7.string().optional()
|
|
637
|
+
})).output(z7.array(ClassSummarySchema));
|
|
638
|
+
var studentsContract = {
|
|
639
|
+
create: createStudentContract,
|
|
640
|
+
bulkUpload: bulkUploadStudentsContract,
|
|
641
|
+
list: listStudentsContract,
|
|
642
|
+
getById: getStudentByIdContract,
|
|
643
|
+
linkGuardian: linkGuardianContract,
|
|
644
|
+
listClasses: listClassesContract
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
// src/roles/helpers.ts
|
|
648
|
+
function hasRole(user, role) {
|
|
649
|
+
return user.roles.some(
|
|
650
|
+
(r) => r.name === role && r.branchId === user.activeBranchId
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
function isProprietor(user) {
|
|
654
|
+
return hasRole(user, "PROPRIETOR");
|
|
655
|
+
}
|
|
656
|
+
function isDirector(user) {
|
|
657
|
+
return hasRole(user, "DIRECTOR");
|
|
658
|
+
}
|
|
659
|
+
function isSystemAdmin(user) {
|
|
660
|
+
return hasRole(user, "SYSTEM_ADMIN");
|
|
661
|
+
}
|
|
662
|
+
function isPrincipal(user) {
|
|
663
|
+
return hasRole(user, "PRINCIPAL");
|
|
664
|
+
}
|
|
665
|
+
function isDeputyPrincipal(user) {
|
|
666
|
+
return hasRole(user, "DEPUTY_PRINCIPAL");
|
|
667
|
+
}
|
|
668
|
+
function isSeniorLeadership(user) {
|
|
669
|
+
return isProprietor(user) || isDirector(user) || isPrincipal(user) || isDeputyPrincipal(user);
|
|
670
|
+
}
|
|
671
|
+
function isHOD(user) {
|
|
672
|
+
return hasRole(user, "HOD");
|
|
673
|
+
}
|
|
674
|
+
function isClassTeacher(user) {
|
|
675
|
+
return hasRole(user, "CLASS_TEACHER");
|
|
676
|
+
}
|
|
677
|
+
function isSubjectTeacher(user) {
|
|
678
|
+
return hasRole(user, "SUBJECT_TEACHER");
|
|
679
|
+
}
|
|
680
|
+
function isSchoolNurse(user) {
|
|
681
|
+
return hasRole(user, "SCHOOL_NURSE");
|
|
682
|
+
}
|
|
683
|
+
function isLibrarian(user) {
|
|
684
|
+
return hasRole(user, "LIBRARIAN");
|
|
685
|
+
}
|
|
686
|
+
function isLabTechnician(user) {
|
|
687
|
+
return hasRole(user, "LAB_TECHNICIAN");
|
|
688
|
+
}
|
|
689
|
+
function isSportsCoach(user) {
|
|
690
|
+
return hasRole(user, "SPORTS_COACH");
|
|
691
|
+
}
|
|
692
|
+
function isCounsellor(user) {
|
|
693
|
+
return hasRole(user, "COUNSELLOR");
|
|
694
|
+
}
|
|
695
|
+
function isCaretaker(user) {
|
|
696
|
+
return hasRole(user, "CARETAKER");
|
|
697
|
+
}
|
|
698
|
+
function isSecurity(user) {
|
|
699
|
+
return hasRole(user, "SECURITY");
|
|
700
|
+
}
|
|
701
|
+
function isBoardingMaster(user) {
|
|
702
|
+
return hasRole(user, "BOARDING_MASTER");
|
|
703
|
+
}
|
|
704
|
+
function isBursar(user) {
|
|
705
|
+
return hasRole(user, "BURSAR");
|
|
706
|
+
}
|
|
707
|
+
function isHrAdmin(user) {
|
|
708
|
+
return hasRole(user, "HR_ADMIN");
|
|
709
|
+
}
|
|
710
|
+
function isDriver(user) {
|
|
711
|
+
return hasRole(user, "DRIVER");
|
|
712
|
+
}
|
|
713
|
+
function isKitchenStaff(user) {
|
|
714
|
+
return hasRole(user, "KITCHEN_STAFF");
|
|
715
|
+
}
|
|
716
|
+
function isKitchenManager(user) {
|
|
717
|
+
return hasRole(user, "KITCHEN_MANAGER");
|
|
718
|
+
}
|
|
719
|
+
function isItAdmin(user) {
|
|
720
|
+
return hasRole(user, "IT_ADMIN");
|
|
721
|
+
}
|
|
722
|
+
function isPrefect(user) {
|
|
723
|
+
return hasRole(user, "PREFECT");
|
|
724
|
+
}
|
|
725
|
+
function isStudent(user) {
|
|
726
|
+
return hasRole(user, "STUDENT");
|
|
727
|
+
}
|
|
728
|
+
function isParent(user) {
|
|
729
|
+
return hasRole(user, "PARENT");
|
|
730
|
+
}
|
|
731
|
+
function isOrgSponsor(user) {
|
|
732
|
+
return hasRole(user, "ORG_SPONSOR");
|
|
733
|
+
}
|
|
734
|
+
function isIndividualSponsor(user) {
|
|
735
|
+
return hasRole(user, "INDIVIDUAL_SPONSOR");
|
|
736
|
+
}
|
|
737
|
+
function isStaff(user) {
|
|
738
|
+
const staffRoles = [
|
|
739
|
+
"PROPRIETOR",
|
|
740
|
+
"DIRECTOR",
|
|
741
|
+
"SYSTEM_ADMIN",
|
|
742
|
+
"PRINCIPAL",
|
|
743
|
+
"DEPUTY_PRINCIPAL",
|
|
744
|
+
"HOD",
|
|
745
|
+
"CLASS_TEACHER",
|
|
746
|
+
"SUBJECT_TEACHER",
|
|
747
|
+
"BURSAR",
|
|
748
|
+
"HR_ADMIN",
|
|
749
|
+
"SCHOOL_NURSE",
|
|
750
|
+
"LIBRARIAN",
|
|
751
|
+
"LAB_TECHNICIAN",
|
|
752
|
+
"SPORTS_COACH",
|
|
753
|
+
"COUNSELLOR",
|
|
754
|
+
"CARETAKER",
|
|
755
|
+
"SECURITY",
|
|
756
|
+
"KITCHEN_STAFF",
|
|
757
|
+
"KITCHEN_MANAGER",
|
|
758
|
+
"DRIVER",
|
|
759
|
+
"IT_ADMIN",
|
|
760
|
+
"BOARDING_MASTER",
|
|
761
|
+
"PREFECT"
|
|
762
|
+
];
|
|
763
|
+
return user.roles.some(
|
|
764
|
+
(r) => staffRoles.includes(r.name) && r.branchId === user.activeBranchId
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// src/permissions/index.ts
|
|
769
|
+
function canMarkClassAttendance(user) {
|
|
770
|
+
return isClassTeacher(user) || isHOD(user) || isPrincipal(user) || isDeputyPrincipal(user) || isSystemAdmin(user);
|
|
771
|
+
}
|
|
772
|
+
function canViewClassAttendance(user) {
|
|
773
|
+
return canMarkClassAttendance(user) || isDirector(user) || isProprietor(user);
|
|
774
|
+
}
|
|
775
|
+
function canMarkStaffAttendance(user) {
|
|
776
|
+
return isHrAdmin(user) || isPrincipal(user) || isDeputyPrincipal(user) || isSystemAdmin(user);
|
|
777
|
+
}
|
|
778
|
+
function canViewStaffAttendance(user) {
|
|
779
|
+
return canMarkStaffAttendance(user) || isDirector(user) || isProprietor(user);
|
|
780
|
+
}
|
|
781
|
+
function canViewStaffList(user) {
|
|
782
|
+
return isHrAdmin(user) || isPrincipal(user) || isDeputyPrincipal(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
783
|
+
}
|
|
784
|
+
function canManageStaff(user) {
|
|
785
|
+
return isHrAdmin(user) || isPrincipal(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
786
|
+
}
|
|
787
|
+
function canViewStudentList(user) {
|
|
788
|
+
return isClassTeacher(user) || isHOD(user) || isPrincipal(user) || isDeputyPrincipal(user) || isHrAdmin(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
789
|
+
}
|
|
790
|
+
function canManageStudents(user) {
|
|
791
|
+
return isPrincipal(user) || isDeputyPrincipal(user) || isHrAdmin(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
792
|
+
}
|
|
793
|
+
function canAccessAdminDashboard(user) {
|
|
794
|
+
return !isStudent(user) && !isParent(user) && !isPrefect(user) && !isOrgSponsor(user) && !isIndividualSponsor(user);
|
|
795
|
+
}
|
|
191
796
|
// Annotate the CommonJS export names for ESM import in node:
|
|
192
797
|
0 && (module.exports = {
|
|
193
798
|
BranchRefSchema,
|
|
799
|
+
BulkUploadStudentRowSchema,
|
|
800
|
+
BulkUploadStudentsInputSchema,
|
|
801
|
+
BulkUploadStudentsOutputSchema,
|
|
194
802
|
ChangePasswordInputSchema,
|
|
803
|
+
ClassSummarySchema,
|
|
804
|
+
CreateDepartmentInputSchema,
|
|
805
|
+
CreateStaffInputSchema,
|
|
806
|
+
CreateStaffOutputSchema,
|
|
807
|
+
CreateStudentInputSchema,
|
|
808
|
+
CreateStudentOutputSchema,
|
|
195
809
|
CuidSchema,
|
|
810
|
+
DepartmentSchema,
|
|
811
|
+
EmploymentTypeSchema,
|
|
812
|
+
GenderSchema,
|
|
813
|
+
GradeLevelSchema,
|
|
814
|
+
LinkGuardianInputSchema,
|
|
815
|
+
ListStaffInputSchema,
|
|
816
|
+
ListStudentsInputSchema,
|
|
196
817
|
LoginInputSchema,
|
|
197
818
|
LoginOutputSchema,
|
|
198
819
|
LogoutInputSchema,
|
|
@@ -201,22 +822,80 @@ var authContract = {
|
|
|
201
822
|
RefreshTokenOutputSchema,
|
|
202
823
|
RequestPasswordResetInputSchema,
|
|
203
824
|
ResetPasswordInputSchema,
|
|
825
|
+
RoleNameSchema,
|
|
204
826
|
SessionUserOutputSchema,
|
|
205
827
|
SessionUserRoleSchema,
|
|
206
828
|
SessionUserSubRoleSchema,
|
|
207
829
|
SoftDeleteSchema,
|
|
830
|
+
StaffListItemSchema,
|
|
831
|
+
StaffProfileSchema,
|
|
832
|
+
StudentListItemSchema,
|
|
833
|
+
StudentProfileSchema,
|
|
834
|
+
StudentStatusSchema,
|
|
208
835
|
SwitchBranchInputSchema,
|
|
209
836
|
TimestampsSchema,
|
|
210
837
|
UuidSchema,
|
|
211
838
|
authContract,
|
|
839
|
+
bulkUploadStudentsContract,
|
|
840
|
+
canAccessAdminDashboard,
|
|
841
|
+
canManageStaff,
|
|
842
|
+
canManageStudents,
|
|
843
|
+
canMarkClassAttendance,
|
|
844
|
+
canMarkStaffAttendance,
|
|
845
|
+
canViewClassAttendance,
|
|
846
|
+
canViewStaffAttendance,
|
|
847
|
+
canViewStaffList,
|
|
848
|
+
canViewStudentList,
|
|
212
849
|
changePasswordContract,
|
|
850
|
+
createDepartmentContract,
|
|
851
|
+
createStaffContract,
|
|
852
|
+
createStudentContract,
|
|
213
853
|
getMeContract,
|
|
854
|
+
getStaffByIdContract,
|
|
855
|
+
getStudentByIdContract,
|
|
856
|
+
hrContract,
|
|
857
|
+
isBoardingMaster,
|
|
858
|
+
isBursar,
|
|
859
|
+
isCaretaker,
|
|
860
|
+
isClassTeacher,
|
|
861
|
+
isCounsellor,
|
|
862
|
+
isDeputyPrincipal,
|
|
863
|
+
isDirector,
|
|
864
|
+
isDriver,
|
|
865
|
+
isHOD,
|
|
866
|
+
isHrAdmin,
|
|
867
|
+
isIndividualSponsor,
|
|
868
|
+
isItAdmin,
|
|
869
|
+
isKitchenManager,
|
|
870
|
+
isKitchenStaff,
|
|
871
|
+
isLabTechnician,
|
|
872
|
+
isLibrarian,
|
|
873
|
+
isOrgSponsor,
|
|
874
|
+
isParent,
|
|
875
|
+
isPrefect,
|
|
876
|
+
isPrincipal,
|
|
877
|
+
isProprietor,
|
|
878
|
+
isSchoolNurse,
|
|
879
|
+
isSecurity,
|
|
880
|
+
isSeniorLeadership,
|
|
881
|
+
isSportsCoach,
|
|
882
|
+
isStaff,
|
|
883
|
+
isStudent,
|
|
884
|
+
isSubjectTeacher,
|
|
885
|
+
isSystemAdmin,
|
|
886
|
+
linkGuardianContract,
|
|
887
|
+
listClassesContract,
|
|
888
|
+
listDepartmentsContract,
|
|
889
|
+
listStaffContract,
|
|
890
|
+
listStudentsContract,
|
|
214
891
|
loginContract,
|
|
215
892
|
logoutContract,
|
|
216
893
|
paginatedOutputSchema,
|
|
217
894
|
refreshTokenContract,
|
|
218
895
|
requestPasswordResetContract,
|
|
219
896
|
resetPasswordContract,
|
|
220
|
-
|
|
897
|
+
studentsContract,
|
|
898
|
+
switchBranchContract,
|
|
899
|
+
updateStaffStatusContract
|
|
221
900
|
});
|
|
222
901
|
//# sourceMappingURL=index.cjs.map
|