@brite-future-schools-contracts/contracts 2.0.3 → 2.0.5
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-S3BK5YEH.js → chunk-3IZCDZ2P.js} +29 -3
- package/dist/chunk-3IZCDZ2P.js.map +1 -0
- package/dist/{chunk-3OMU2YSE.js → chunk-7Q4RWA5S.js} +73 -2
- package/dist/chunk-7Q4RWA5S.js.map +1 -0
- package/dist/chunk-PDCM3NIB.js +1 -0
- package/dist/contracts/index.cjs +88 -0
- package/dist/contracts/index.cjs.map +1 -1
- package/dist/contracts/index.d.cts +132 -1
- package/dist/contracts/index.d.ts +132 -1
- package/dist/contracts/index.js +12 -2
- package/dist/index.cjs +351 -21
- 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 +219 -3
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.cjs +80 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +105 -1
- package/dist/schemas/index.d.ts +105 -1
- package/dist/schemas/index.js +20 -2
- package/package.json +1 -1
- package/dist/chunk-3OMU2YSE.js.map +0 -1
- package/dist/chunk-R4XE3SFR.js +0 -1
- package/dist/chunk-S3BK5YEH.js.map +0 -1
- /package/dist/{chunk-R4XE3SFR.js.map → chunk-PDCM3NIB.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -30,11 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
AttendanceRecordInputSchema: () => AttendanceRecordInputSchema,
|
|
34
|
+
AttendanceStatusSchema: () => AttendanceStatusSchema,
|
|
33
35
|
BranchRefSchema: () => BranchRefSchema,
|
|
34
36
|
BulkUploadStudentRowSchema: () => BulkUploadStudentRowSchema,
|
|
35
37
|
BulkUploadStudentsInputSchema: () => BulkUploadStudentsInputSchema,
|
|
36
38
|
BulkUploadStudentsOutputSchema: () => BulkUploadStudentsOutputSchema,
|
|
37
39
|
ChangePasswordInputSchema: () => ChangePasswordInputSchema,
|
|
40
|
+
ClassAttendanceRowSchema: () => ClassAttendanceRowSchema,
|
|
38
41
|
ClassSummarySchema: () => ClassSummarySchema,
|
|
39
42
|
CreateDepartmentInputSchema: () => CreateDepartmentInputSchema,
|
|
40
43
|
CreateStaffInputSchema: () => CreateStaffInputSchema,
|
|
@@ -45,6 +48,8 @@ __export(src_exports, {
|
|
|
45
48
|
DepartmentSchema: () => DepartmentSchema,
|
|
46
49
|
EmploymentTypeSchema: () => EmploymentTypeSchema,
|
|
47
50
|
GenderSchema: () => GenderSchema,
|
|
51
|
+
GetByClassInputSchema: () => GetByClassInputSchema,
|
|
52
|
+
GetByStudentInputSchema: () => GetByStudentInputSchema,
|
|
48
53
|
GradeLevelSchema: () => GradeLevelSchema,
|
|
49
54
|
LinkGuardianInputSchema: () => LinkGuardianInputSchema,
|
|
50
55
|
ListStaffInputSchema: () => ListStaffInputSchema,
|
|
@@ -52,6 +57,8 @@ __export(src_exports, {
|
|
|
52
57
|
LoginInputSchema: () => LoginInputSchema,
|
|
53
58
|
LoginOutputSchema: () => LoginOutputSchema,
|
|
54
59
|
LogoutInputSchema: () => LogoutInputSchema,
|
|
60
|
+
MarkAttendanceInputSchema: () => MarkAttendanceInputSchema,
|
|
61
|
+
MarkAttendanceOutputSchema: () => MarkAttendanceOutputSchema,
|
|
55
62
|
PaginationInputSchema: () => PaginationInputSchema,
|
|
56
63
|
RefreshTokenInputSchema: () => RefreshTokenInputSchema,
|
|
57
64
|
RefreshTokenOutputSchema: () => RefreshTokenOutputSchema,
|
|
@@ -64,29 +71,74 @@ __export(src_exports, {
|
|
|
64
71
|
SoftDeleteSchema: () => SoftDeleteSchema,
|
|
65
72
|
StaffListItemSchema: () => StaffListItemSchema,
|
|
66
73
|
StaffProfileSchema: () => StaffProfileSchema,
|
|
74
|
+
StudentAttendanceRowSchema: () => StudentAttendanceRowSchema,
|
|
67
75
|
StudentListItemSchema: () => StudentListItemSchema,
|
|
68
76
|
StudentProfileSchema: () => StudentProfileSchema,
|
|
69
77
|
StudentStatusSchema: () => StudentStatusSchema,
|
|
70
78
|
SwitchBranchInputSchema: () => SwitchBranchInputSchema,
|
|
79
|
+
TermSchema: () => TermSchema,
|
|
71
80
|
TimestampsSchema: () => TimestampsSchema,
|
|
72
81
|
UuidSchema: () => UuidSchema,
|
|
82
|
+
attendanceContract: () => attendanceContract,
|
|
73
83
|
authContract: () => authContract,
|
|
74
84
|
bulkUploadStudentsContract: () => bulkUploadStudentsContract,
|
|
85
|
+
canAccessAdminDashboard: () => canAccessAdminDashboard,
|
|
86
|
+
canManageStaff: () => canManageStaff,
|
|
87
|
+
canManageStudents: () => canManageStudents,
|
|
88
|
+
canMarkClassAttendance: () => canMarkClassAttendance,
|
|
89
|
+
canMarkStaffAttendance: () => canMarkStaffAttendance,
|
|
90
|
+
canViewClassAttendance: () => canViewClassAttendance,
|
|
91
|
+
canViewStaffAttendance: () => canViewStaffAttendance,
|
|
92
|
+
canViewStaffList: () => canViewStaffList,
|
|
93
|
+
canViewStudentList: () => canViewStudentList,
|
|
75
94
|
changePasswordContract: () => changePasswordContract,
|
|
76
95
|
createDepartmentContract: () => createDepartmentContract,
|
|
77
96
|
createStaffContract: () => createStaffContract,
|
|
78
97
|
createStudentContract: () => createStudentContract,
|
|
98
|
+
getByClassContract: () => getByClassContract,
|
|
99
|
+
getByStudentContract: () => getByStudentContract,
|
|
79
100
|
getMeContract: () => getMeContract,
|
|
80
101
|
getStaffByIdContract: () => getStaffByIdContract,
|
|
81
102
|
getStudentByIdContract: () => getStudentByIdContract,
|
|
82
103
|
hrContract: () => hrContract,
|
|
104
|
+
isBoardingMaster: () => isBoardingMaster,
|
|
105
|
+
isBursar: () => isBursar,
|
|
106
|
+
isCaretaker: () => isCaretaker,
|
|
107
|
+
isClassTeacher: () => isClassTeacher,
|
|
108
|
+
isCounsellor: () => isCounsellor,
|
|
109
|
+
isDeputyPrincipal: () => isDeputyPrincipal,
|
|
110
|
+
isDirector: () => isDirector,
|
|
111
|
+
isDriver: () => isDriver,
|
|
112
|
+
isHOD: () => isHOD,
|
|
113
|
+
isHrAdmin: () => isHrAdmin,
|
|
114
|
+
isIndividualSponsor: () => isIndividualSponsor,
|
|
115
|
+
isItAdmin: () => isItAdmin,
|
|
116
|
+
isKitchenManager: () => isKitchenManager,
|
|
117
|
+
isKitchenStaff: () => isKitchenStaff,
|
|
118
|
+
isLabTechnician: () => isLabTechnician,
|
|
119
|
+
isLibrarian: () => isLibrarian,
|
|
120
|
+
isOrgSponsor: () => isOrgSponsor,
|
|
121
|
+
isParent: () => isParent,
|
|
122
|
+
isPrefect: () => isPrefect,
|
|
123
|
+
isPrincipal: () => isPrincipal,
|
|
124
|
+
isProprietor: () => isProprietor,
|
|
125
|
+
isSchoolNurse: () => isSchoolNurse,
|
|
126
|
+
isSecurity: () => isSecurity,
|
|
127
|
+
isSeniorLeadership: () => isSeniorLeadership,
|
|
128
|
+
isSportsCoach: () => isSportsCoach,
|
|
129
|
+
isStaff: () => isStaff,
|
|
130
|
+
isStudent: () => isStudent,
|
|
131
|
+
isSubjectTeacher: () => isSubjectTeacher,
|
|
132
|
+
isSystemAdmin: () => isSystemAdmin,
|
|
83
133
|
linkGuardianContract: () => linkGuardianContract,
|
|
84
134
|
listClassesContract: () => listClassesContract,
|
|
85
135
|
listDepartmentsContract: () => listDepartmentsContract,
|
|
86
136
|
listStaffContract: () => listStaffContract,
|
|
87
137
|
listStudentsContract: () => listStudentsContract,
|
|
138
|
+
listTermsContract: () => listTermsContract,
|
|
88
139
|
loginContract: () => loginContract,
|
|
89
140
|
logoutContract: () => logoutContract,
|
|
141
|
+
markAttendanceContract: () => markAttendanceContract,
|
|
90
142
|
paginatedOutputSchema: () => paginatedOutputSchema,
|
|
91
143
|
refreshTokenContract: () => refreshTokenContract,
|
|
92
144
|
requestPasswordResetContract: () => requestPasswordResetContract,
|
|
@@ -531,10 +583,72 @@ var ClassSummarySchema = z4.object({
|
|
|
531
583
|
classTeacherId: UuidSchema.nullable()
|
|
532
584
|
});
|
|
533
585
|
|
|
586
|
+
// src/schemas/attendance.ts
|
|
587
|
+
var z5 = __toESM(require("zod"), 1);
|
|
588
|
+
var AttendanceStatusSchema = z5.enum([
|
|
589
|
+
"present",
|
|
590
|
+
"absent",
|
|
591
|
+
"late",
|
|
592
|
+
"excused"
|
|
593
|
+
]);
|
|
594
|
+
var TermSchema = z5.object({
|
|
595
|
+
id: UuidSchema,
|
|
596
|
+
branchId: UuidSchema,
|
|
597
|
+
academicYearId: UuidSchema,
|
|
598
|
+
name: z5.string(),
|
|
599
|
+
startDate: z5.string(),
|
|
600
|
+
endDate: z5.string(),
|
|
601
|
+
isCurrent: z5.boolean()
|
|
602
|
+
});
|
|
603
|
+
var AttendanceRecordInputSchema = z5.object({
|
|
604
|
+
studentId: UuidSchema,
|
|
605
|
+
status: AttendanceStatusSchema,
|
|
606
|
+
notes: z5.string().max(500).optional()
|
|
607
|
+
});
|
|
608
|
+
var MarkAttendanceInputSchema = z5.object({
|
|
609
|
+
classId: UuidSchema,
|
|
610
|
+
termId: UuidSchema,
|
|
611
|
+
date: z5.iso.date(),
|
|
612
|
+
records: z5.array(AttendanceRecordInputSchema).min(1)
|
|
613
|
+
});
|
|
614
|
+
var MarkAttendanceOutputSchema = z5.object({
|
|
615
|
+
count: z5.number(),
|
|
616
|
+
date: z5.string(),
|
|
617
|
+
classId: UuidSchema
|
|
618
|
+
});
|
|
619
|
+
var GetByClassInputSchema = z5.object({
|
|
620
|
+
classId: UuidSchema,
|
|
621
|
+
date: z5.iso.date()
|
|
622
|
+
});
|
|
623
|
+
var ClassAttendanceRowSchema = z5.object({
|
|
624
|
+
id: UuidSchema,
|
|
625
|
+
studentId: UuidSchema,
|
|
626
|
+
firstName: z5.string(),
|
|
627
|
+
middleName: z5.string().nullable(),
|
|
628
|
+
lastName: z5.string(),
|
|
629
|
+
admissionNo: z5.string(),
|
|
630
|
+
status: AttendanceStatusSchema,
|
|
631
|
+
notes: z5.string().nullable(),
|
|
632
|
+
markedBy: UuidSchema,
|
|
633
|
+
updatedAt: z5.string()
|
|
634
|
+
});
|
|
635
|
+
var GetByStudentInputSchema = z5.object({
|
|
636
|
+
studentId: UuidSchema,
|
|
637
|
+
termId: UuidSchema
|
|
638
|
+
});
|
|
639
|
+
var StudentAttendanceRowSchema = z5.object({
|
|
640
|
+
id: UuidSchema,
|
|
641
|
+
date: z5.string(),
|
|
642
|
+
status: AttendanceStatusSchema,
|
|
643
|
+
notes: z5.string().nullable(),
|
|
644
|
+
classId: UuidSchema,
|
|
645
|
+
className: z5.string()
|
|
646
|
+
});
|
|
647
|
+
|
|
534
648
|
// src/contracts/auth.ts
|
|
535
649
|
var import_contract = require("@orpc/contract");
|
|
536
|
-
var
|
|
537
|
-
var EmptyOutputSchema =
|
|
650
|
+
var z6 = __toESM(require("zod"), 1);
|
|
651
|
+
var EmptyOutputSchema = z6.object({}).meta({ description: "Empty success response" });
|
|
538
652
|
var loginContract = import_contract.oc.route({ method: "POST", path: "/auth/login" }).input(LoginInputSchema).output(LoginOutputSchema);
|
|
539
653
|
var refreshTokenContract = import_contract.oc.route({ method: "POST", path: "/auth/refresh" }).input(RefreshTokenInputSchema).output(RefreshTokenOutputSchema);
|
|
540
654
|
var logoutContract = import_contract.oc.route({ method: "POST", path: "/auth/logout" }).input(LogoutInputSchema).output(EmptyOutputSchema);
|
|
@@ -556,20 +670,20 @@ var authContract = {
|
|
|
556
670
|
|
|
557
671
|
// src/contracts/hr.ts
|
|
558
672
|
var import_contract2 = require("@orpc/contract");
|
|
559
|
-
var
|
|
560
|
-
var EmptyOutput =
|
|
673
|
+
var z7 = __toESM(require("zod"), 1);
|
|
674
|
+
var EmptyOutput = z7.object({});
|
|
561
675
|
var createStaffContract = import_contract2.oc.route({ method: "POST", path: "/hr/staff" }).input(CreateStaffInputSchema).output(CreateStaffOutputSchema);
|
|
562
|
-
var listStaffContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff" }).input(ListStaffInputSchema).output(
|
|
563
|
-
items:
|
|
564
|
-
total:
|
|
676
|
+
var listStaffContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff" }).input(ListStaffInputSchema).output(z7.object({
|
|
677
|
+
items: z7.array(StaffListItemSchema),
|
|
678
|
+
total: z7.number(),
|
|
565
679
|
nextCursor: UuidSchema.nullable()
|
|
566
680
|
}));
|
|
567
|
-
var getStaffByIdContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff/{id}" }).input(
|
|
568
|
-
var updateStaffStatusContract = import_contract2.oc.route({ method: "PATCH", path: "/hr/staff/{id}/status" }).input(
|
|
681
|
+
var getStaffByIdContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff/{id}" }).input(z7.object({ id: UuidSchema })).output(StaffProfileSchema);
|
|
682
|
+
var updateStaffStatusContract = import_contract2.oc.route({ method: "PATCH", path: "/hr/staff/{id}/status" }).input(z7.object({
|
|
569
683
|
id: UuidSchema,
|
|
570
|
-
status:
|
|
684
|
+
status: z7.enum(["active", "inactive", "suspended"])
|
|
571
685
|
})).output(EmptyOutput);
|
|
572
|
-
var listDepartmentsContract = import_contract2.oc.route({ method: "GET", path: "/hr/departments" }).input(
|
|
686
|
+
var listDepartmentsContract = import_contract2.oc.route({ method: "GET", path: "/hr/departments" }).input(z7.object({ branchId: UuidSchema.optional() })).output(z7.array(DepartmentSchema));
|
|
573
687
|
var createDepartmentContract = import_contract2.oc.route({ method: "POST", path: "/hr/departments" }).input(CreateDepartmentInputSchema).output(DepartmentSchema);
|
|
574
688
|
var hrContract = {
|
|
575
689
|
createStaff: createStaffContract,
|
|
@@ -582,21 +696,21 @@ var hrContract = {
|
|
|
582
696
|
|
|
583
697
|
// src/contracts/students.ts
|
|
584
698
|
var import_contract3 = require("@orpc/contract");
|
|
585
|
-
var
|
|
586
|
-
var EmptyOutput2 =
|
|
699
|
+
var z8 = __toESM(require("zod"), 1);
|
|
700
|
+
var EmptyOutput2 = z8.object({});
|
|
587
701
|
var createStudentContract = import_contract3.oc.route({ method: "POST", path: "/students" }).input(CreateStudentInputSchema).output(CreateStudentOutputSchema);
|
|
588
702
|
var bulkUploadStudentsContract = import_contract3.oc.route({ method: "POST", path: "/students/bulk" }).input(BulkUploadStudentsInputSchema).output(BulkUploadStudentsOutputSchema);
|
|
589
|
-
var listStudentsContract = import_contract3.oc.route({ method: "GET", path: "/students" }).input(ListStudentsInputSchema).output(
|
|
590
|
-
items:
|
|
591
|
-
total:
|
|
703
|
+
var listStudentsContract = import_contract3.oc.route({ method: "GET", path: "/students" }).input(ListStudentsInputSchema).output(z8.object({
|
|
704
|
+
items: z8.array(StudentListItemSchema),
|
|
705
|
+
total: z8.number(),
|
|
592
706
|
nextCursor: UuidSchema.nullable()
|
|
593
707
|
}));
|
|
594
|
-
var getStudentByIdContract = import_contract3.oc.route({ method: "GET", path: "/students/{id}" }).input(
|
|
595
|
-
var linkGuardianContract = import_contract3.oc.route({ method: "POST", path: "/students/guardians" }).input(LinkGuardianInputSchema).output(
|
|
596
|
-
var listClassesContract = import_contract3.oc.route({ method: "GET", path: "/students/classes" }).input(
|
|
708
|
+
var getStudentByIdContract = import_contract3.oc.route({ method: "GET", path: "/students/{id}" }).input(z8.object({ id: UuidSchema })).output(StudentProfileSchema);
|
|
709
|
+
var linkGuardianContract = import_contract3.oc.route({ method: "POST", path: "/students/guardians" }).input(LinkGuardianInputSchema).output(z8.object({ guardianId: UuidSchema }));
|
|
710
|
+
var listClassesContract = import_contract3.oc.route({ method: "GET", path: "/students/classes" }).input(z8.object({
|
|
597
711
|
termId: UuidSchema.optional(),
|
|
598
|
-
gradeLevel:
|
|
599
|
-
})).output(
|
|
712
|
+
gradeLevel: z8.string().optional()
|
|
713
|
+
})).output(z8.array(ClassSummarySchema));
|
|
600
714
|
var studentsContract = {
|
|
601
715
|
create: createStudentContract,
|
|
602
716
|
bulkUpload: bulkUploadStudentsContract,
|
|
@@ -605,13 +719,180 @@ var studentsContract = {
|
|
|
605
719
|
linkGuardian: linkGuardianContract,
|
|
606
720
|
listClasses: listClassesContract
|
|
607
721
|
};
|
|
722
|
+
|
|
723
|
+
// src/contracts/attendance.ts
|
|
724
|
+
var import_contract4 = require("@orpc/contract");
|
|
725
|
+
var z9 = __toESM(require("zod"), 1);
|
|
726
|
+
var markAttendanceContract = import_contract4.oc.route({ method: "POST", path: "/attendance/class/mark" }).input(MarkAttendanceInputSchema).output(MarkAttendanceOutputSchema);
|
|
727
|
+
var getByClassContract = import_contract4.oc.route({ method: "GET", path: "/attendance/class" }).input(GetByClassInputSchema).output(z9.array(ClassAttendanceRowSchema));
|
|
728
|
+
var getByStudentContract = import_contract4.oc.route({ method: "GET", path: "/attendance/student" }).input(GetByStudentInputSchema).output(z9.array(StudentAttendanceRowSchema));
|
|
729
|
+
var listTermsContract = import_contract4.oc.route({ method: "GET", path: "/terms" }).input(z9.object({})).output(z9.array(TermSchema));
|
|
730
|
+
var attendanceContract = {
|
|
731
|
+
mark: markAttendanceContract,
|
|
732
|
+
getByClass: getByClassContract,
|
|
733
|
+
getByStudent: getByStudentContract,
|
|
734
|
+
listTerms: listTermsContract
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
// src/roles/helpers.ts
|
|
738
|
+
function hasRole(user, role) {
|
|
739
|
+
return user.roles.some(
|
|
740
|
+
(r) => r.name === role && r.branchId === user.activeBranchId
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
function isProprietor(user) {
|
|
744
|
+
return hasRole(user, "PROPRIETOR");
|
|
745
|
+
}
|
|
746
|
+
function isDirector(user) {
|
|
747
|
+
return hasRole(user, "DIRECTOR");
|
|
748
|
+
}
|
|
749
|
+
function isSystemAdmin(user) {
|
|
750
|
+
return hasRole(user, "SYSTEM_ADMIN");
|
|
751
|
+
}
|
|
752
|
+
function isPrincipal(user) {
|
|
753
|
+
return hasRole(user, "PRINCIPAL");
|
|
754
|
+
}
|
|
755
|
+
function isDeputyPrincipal(user) {
|
|
756
|
+
return hasRole(user, "DEPUTY_PRINCIPAL");
|
|
757
|
+
}
|
|
758
|
+
function isSeniorLeadership(user) {
|
|
759
|
+
return isProprietor(user) || isDirector(user) || isPrincipal(user) || isDeputyPrincipal(user);
|
|
760
|
+
}
|
|
761
|
+
function isHOD(user) {
|
|
762
|
+
return hasRole(user, "HOD");
|
|
763
|
+
}
|
|
764
|
+
function isClassTeacher(user) {
|
|
765
|
+
return hasRole(user, "CLASS_TEACHER");
|
|
766
|
+
}
|
|
767
|
+
function isSubjectTeacher(user) {
|
|
768
|
+
return hasRole(user, "SUBJECT_TEACHER");
|
|
769
|
+
}
|
|
770
|
+
function isSchoolNurse(user) {
|
|
771
|
+
return hasRole(user, "SCHOOL_NURSE");
|
|
772
|
+
}
|
|
773
|
+
function isLibrarian(user) {
|
|
774
|
+
return hasRole(user, "LIBRARIAN");
|
|
775
|
+
}
|
|
776
|
+
function isLabTechnician(user) {
|
|
777
|
+
return hasRole(user, "LAB_TECHNICIAN");
|
|
778
|
+
}
|
|
779
|
+
function isSportsCoach(user) {
|
|
780
|
+
return hasRole(user, "SPORTS_COACH");
|
|
781
|
+
}
|
|
782
|
+
function isCounsellor(user) {
|
|
783
|
+
return hasRole(user, "COUNSELLOR");
|
|
784
|
+
}
|
|
785
|
+
function isCaretaker(user) {
|
|
786
|
+
return hasRole(user, "CARETAKER");
|
|
787
|
+
}
|
|
788
|
+
function isSecurity(user) {
|
|
789
|
+
return hasRole(user, "SECURITY");
|
|
790
|
+
}
|
|
791
|
+
function isBoardingMaster(user) {
|
|
792
|
+
return hasRole(user, "BOARDING_MASTER");
|
|
793
|
+
}
|
|
794
|
+
function isBursar(user) {
|
|
795
|
+
return hasRole(user, "BURSAR");
|
|
796
|
+
}
|
|
797
|
+
function isHrAdmin(user) {
|
|
798
|
+
return hasRole(user, "HR_ADMIN");
|
|
799
|
+
}
|
|
800
|
+
function isDriver(user) {
|
|
801
|
+
return hasRole(user, "DRIVER");
|
|
802
|
+
}
|
|
803
|
+
function isKitchenStaff(user) {
|
|
804
|
+
return hasRole(user, "KITCHEN_STAFF");
|
|
805
|
+
}
|
|
806
|
+
function isKitchenManager(user) {
|
|
807
|
+
return hasRole(user, "KITCHEN_MANAGER");
|
|
808
|
+
}
|
|
809
|
+
function isItAdmin(user) {
|
|
810
|
+
return hasRole(user, "IT_ADMIN");
|
|
811
|
+
}
|
|
812
|
+
function isPrefect(user) {
|
|
813
|
+
return hasRole(user, "PREFECT");
|
|
814
|
+
}
|
|
815
|
+
function isStudent(user) {
|
|
816
|
+
return hasRole(user, "STUDENT");
|
|
817
|
+
}
|
|
818
|
+
function isParent(user) {
|
|
819
|
+
return hasRole(user, "PARENT");
|
|
820
|
+
}
|
|
821
|
+
function isOrgSponsor(user) {
|
|
822
|
+
return hasRole(user, "ORG_SPONSOR");
|
|
823
|
+
}
|
|
824
|
+
function isIndividualSponsor(user) {
|
|
825
|
+
return hasRole(user, "INDIVIDUAL_SPONSOR");
|
|
826
|
+
}
|
|
827
|
+
function isStaff(user) {
|
|
828
|
+
const staffRoles = [
|
|
829
|
+
"PROPRIETOR",
|
|
830
|
+
"DIRECTOR",
|
|
831
|
+
"SYSTEM_ADMIN",
|
|
832
|
+
"PRINCIPAL",
|
|
833
|
+
"DEPUTY_PRINCIPAL",
|
|
834
|
+
"HOD",
|
|
835
|
+
"CLASS_TEACHER",
|
|
836
|
+
"SUBJECT_TEACHER",
|
|
837
|
+
"BURSAR",
|
|
838
|
+
"HR_ADMIN",
|
|
839
|
+
"SCHOOL_NURSE",
|
|
840
|
+
"LIBRARIAN",
|
|
841
|
+
"LAB_TECHNICIAN",
|
|
842
|
+
"SPORTS_COACH",
|
|
843
|
+
"COUNSELLOR",
|
|
844
|
+
"CARETAKER",
|
|
845
|
+
"SECURITY",
|
|
846
|
+
"KITCHEN_STAFF",
|
|
847
|
+
"KITCHEN_MANAGER",
|
|
848
|
+
"DRIVER",
|
|
849
|
+
"IT_ADMIN",
|
|
850
|
+
"BOARDING_MASTER",
|
|
851
|
+
"PREFECT"
|
|
852
|
+
];
|
|
853
|
+
return user.roles.some(
|
|
854
|
+
(r) => staffRoles.includes(r.name) && r.branchId === user.activeBranchId
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// src/permissions/index.ts
|
|
859
|
+
function canMarkClassAttendance(user) {
|
|
860
|
+
return isClassTeacher(user) || isHOD(user) || isPrincipal(user) || isDeputyPrincipal(user) || isSystemAdmin(user);
|
|
861
|
+
}
|
|
862
|
+
function canViewClassAttendance(user) {
|
|
863
|
+
return canMarkClassAttendance(user) || isDirector(user) || isProprietor(user);
|
|
864
|
+
}
|
|
865
|
+
function canMarkStaffAttendance(user) {
|
|
866
|
+
return isHrAdmin(user) || isPrincipal(user) || isDeputyPrincipal(user) || isSystemAdmin(user);
|
|
867
|
+
}
|
|
868
|
+
function canViewStaffAttendance(user) {
|
|
869
|
+
return canMarkStaffAttendance(user) || isDirector(user) || isProprietor(user);
|
|
870
|
+
}
|
|
871
|
+
function canViewStaffList(user) {
|
|
872
|
+
return isHrAdmin(user) || isPrincipal(user) || isDeputyPrincipal(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
873
|
+
}
|
|
874
|
+
function canManageStaff(user) {
|
|
875
|
+
return isHrAdmin(user) || isPrincipal(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
876
|
+
}
|
|
877
|
+
function canViewStudentList(user) {
|
|
878
|
+
return isClassTeacher(user) || isHOD(user) || isPrincipal(user) || isDeputyPrincipal(user) || isHrAdmin(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
879
|
+
}
|
|
880
|
+
function canManageStudents(user) {
|
|
881
|
+
return isPrincipal(user) || isDeputyPrincipal(user) || isHrAdmin(user) || isSystemAdmin(user) || isDirector(user) || isProprietor(user);
|
|
882
|
+
}
|
|
883
|
+
function canAccessAdminDashboard(user) {
|
|
884
|
+
return !isStudent(user) && !isParent(user) && !isPrefect(user) && !isOrgSponsor(user) && !isIndividualSponsor(user);
|
|
885
|
+
}
|
|
608
886
|
// Annotate the CommonJS export names for ESM import in node:
|
|
609
887
|
0 && (module.exports = {
|
|
888
|
+
AttendanceRecordInputSchema,
|
|
889
|
+
AttendanceStatusSchema,
|
|
610
890
|
BranchRefSchema,
|
|
611
891
|
BulkUploadStudentRowSchema,
|
|
612
892
|
BulkUploadStudentsInputSchema,
|
|
613
893
|
BulkUploadStudentsOutputSchema,
|
|
614
894
|
ChangePasswordInputSchema,
|
|
895
|
+
ClassAttendanceRowSchema,
|
|
615
896
|
ClassSummarySchema,
|
|
616
897
|
CreateDepartmentInputSchema,
|
|
617
898
|
CreateStaffInputSchema,
|
|
@@ -622,6 +903,8 @@ var studentsContract = {
|
|
|
622
903
|
DepartmentSchema,
|
|
623
904
|
EmploymentTypeSchema,
|
|
624
905
|
GenderSchema,
|
|
906
|
+
GetByClassInputSchema,
|
|
907
|
+
GetByStudentInputSchema,
|
|
625
908
|
GradeLevelSchema,
|
|
626
909
|
LinkGuardianInputSchema,
|
|
627
910
|
ListStaffInputSchema,
|
|
@@ -629,6 +912,8 @@ var studentsContract = {
|
|
|
629
912
|
LoginInputSchema,
|
|
630
913
|
LoginOutputSchema,
|
|
631
914
|
LogoutInputSchema,
|
|
915
|
+
MarkAttendanceInputSchema,
|
|
916
|
+
MarkAttendanceOutputSchema,
|
|
632
917
|
PaginationInputSchema,
|
|
633
918
|
RefreshTokenInputSchema,
|
|
634
919
|
RefreshTokenOutputSchema,
|
|
@@ -641,29 +926,74 @@ var studentsContract = {
|
|
|
641
926
|
SoftDeleteSchema,
|
|
642
927
|
StaffListItemSchema,
|
|
643
928
|
StaffProfileSchema,
|
|
929
|
+
StudentAttendanceRowSchema,
|
|
644
930
|
StudentListItemSchema,
|
|
645
931
|
StudentProfileSchema,
|
|
646
932
|
StudentStatusSchema,
|
|
647
933
|
SwitchBranchInputSchema,
|
|
934
|
+
TermSchema,
|
|
648
935
|
TimestampsSchema,
|
|
649
936
|
UuidSchema,
|
|
937
|
+
attendanceContract,
|
|
650
938
|
authContract,
|
|
651
939
|
bulkUploadStudentsContract,
|
|
940
|
+
canAccessAdminDashboard,
|
|
941
|
+
canManageStaff,
|
|
942
|
+
canManageStudents,
|
|
943
|
+
canMarkClassAttendance,
|
|
944
|
+
canMarkStaffAttendance,
|
|
945
|
+
canViewClassAttendance,
|
|
946
|
+
canViewStaffAttendance,
|
|
947
|
+
canViewStaffList,
|
|
948
|
+
canViewStudentList,
|
|
652
949
|
changePasswordContract,
|
|
653
950
|
createDepartmentContract,
|
|
654
951
|
createStaffContract,
|
|
655
952
|
createStudentContract,
|
|
953
|
+
getByClassContract,
|
|
954
|
+
getByStudentContract,
|
|
656
955
|
getMeContract,
|
|
657
956
|
getStaffByIdContract,
|
|
658
957
|
getStudentByIdContract,
|
|
659
958
|
hrContract,
|
|
959
|
+
isBoardingMaster,
|
|
960
|
+
isBursar,
|
|
961
|
+
isCaretaker,
|
|
962
|
+
isClassTeacher,
|
|
963
|
+
isCounsellor,
|
|
964
|
+
isDeputyPrincipal,
|
|
965
|
+
isDirector,
|
|
966
|
+
isDriver,
|
|
967
|
+
isHOD,
|
|
968
|
+
isHrAdmin,
|
|
969
|
+
isIndividualSponsor,
|
|
970
|
+
isItAdmin,
|
|
971
|
+
isKitchenManager,
|
|
972
|
+
isKitchenStaff,
|
|
973
|
+
isLabTechnician,
|
|
974
|
+
isLibrarian,
|
|
975
|
+
isOrgSponsor,
|
|
976
|
+
isParent,
|
|
977
|
+
isPrefect,
|
|
978
|
+
isPrincipal,
|
|
979
|
+
isProprietor,
|
|
980
|
+
isSchoolNurse,
|
|
981
|
+
isSecurity,
|
|
982
|
+
isSeniorLeadership,
|
|
983
|
+
isSportsCoach,
|
|
984
|
+
isStaff,
|
|
985
|
+
isStudent,
|
|
986
|
+
isSubjectTeacher,
|
|
987
|
+
isSystemAdmin,
|
|
660
988
|
linkGuardianContract,
|
|
661
989
|
listClassesContract,
|
|
662
990
|
listDepartmentsContract,
|
|
663
991
|
listStaffContract,
|
|
664
992
|
listStudentsContract,
|
|
993
|
+
listTermsContract,
|
|
665
994
|
loginContract,
|
|
666
995
|
logoutContract,
|
|
996
|
+
markAttendanceContract,
|
|
667
997
|
paginatedOutputSchema,
|
|
668
998
|
refreshTokenContract,
|
|
669
999
|
requestPasswordResetContract,
|