@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.
@@ -0,0 +1,131 @@
1
+ import {
2
+ BulkUploadStudentsInputSchema,
3
+ BulkUploadStudentsOutputSchema,
4
+ ChangePasswordInputSchema,
5
+ ClassSummarySchema,
6
+ CreateDepartmentInputSchema,
7
+ CreateStaffInputSchema,
8
+ CreateStaffOutputSchema,
9
+ CreateStudentInputSchema,
10
+ CreateStudentOutputSchema,
11
+ DepartmentSchema,
12
+ LinkGuardianInputSchema,
13
+ ListStaffInputSchema,
14
+ ListStudentsInputSchema,
15
+ LoginInputSchema,
16
+ LoginOutputSchema,
17
+ LogoutInputSchema,
18
+ RefreshTokenInputSchema,
19
+ RefreshTokenOutputSchema,
20
+ RequestPasswordResetInputSchema,
21
+ ResetPasswordInputSchema,
22
+ SessionUserOutputSchema,
23
+ StaffListItemSchema,
24
+ StaffProfileSchema,
25
+ StudentListItemSchema,
26
+ StudentProfileSchema,
27
+ SwitchBranchInputSchema,
28
+ UuidSchema
29
+ } from "./chunk-3OMU2YSE.js";
30
+
31
+ // src/contracts/auth.ts
32
+ import { oc } from "@orpc/contract";
33
+ import * as z from "zod";
34
+ var EmptyOutputSchema = z.object({}).meta({ description: "Empty success response" });
35
+ var loginContract = oc.route({ method: "POST", path: "/auth/login" }).input(LoginInputSchema).output(LoginOutputSchema);
36
+ var refreshTokenContract = oc.route({ method: "POST", path: "/auth/refresh" }).input(RefreshTokenInputSchema).output(RefreshTokenOutputSchema);
37
+ var logoutContract = oc.route({ method: "POST", path: "/auth/logout" }).input(LogoutInputSchema).output(EmptyOutputSchema);
38
+ var getMeContract = oc.route({ method: "GET", path: "/auth/me" }).output(SessionUserOutputSchema);
39
+ var changePasswordContract = oc.route({ method: "POST", path: "/auth/change-password" }).input(ChangePasswordInputSchema).output(EmptyOutputSchema);
40
+ var requestPasswordResetContract = oc.route({ method: "POST", path: "/auth/request-password-reset" }).input(RequestPasswordResetInputSchema).output(EmptyOutputSchema);
41
+ var resetPasswordContract = oc.route({ method: "POST", path: "/auth/reset-password" }).input(ResetPasswordInputSchema).output(EmptyOutputSchema);
42
+ var switchBranchContract = oc.route({ method: "POST", path: "/auth/switch-branch" }).input(SwitchBranchInputSchema).output(SessionUserOutputSchema);
43
+ var authContract = {
44
+ login: loginContract,
45
+ refreshToken: refreshTokenContract,
46
+ logout: logoutContract,
47
+ me: getMeContract,
48
+ changePassword: changePasswordContract,
49
+ requestPasswordReset: requestPasswordResetContract,
50
+ resetPassword: resetPasswordContract,
51
+ switchBranch: switchBranchContract
52
+ };
53
+
54
+ // src/contracts/hr.ts
55
+ import { oc as oc2 } from "@orpc/contract";
56
+ import * as z2 from "zod";
57
+ var EmptyOutput = z2.object({});
58
+ var createStaffContract = oc2.route({ method: "POST", path: "/hr/staff" }).input(CreateStaffInputSchema).output(CreateStaffOutputSchema);
59
+ var listStaffContract = oc2.route({ method: "GET", path: "/hr/staff" }).input(ListStaffInputSchema).output(z2.object({
60
+ items: z2.array(StaffListItemSchema),
61
+ total: z2.number(),
62
+ nextCursor: UuidSchema.nullable()
63
+ }));
64
+ var getStaffByIdContract = oc2.route({ method: "GET", path: "/hr/staff/{id}" }).input(z2.object({ id: UuidSchema })).output(StaffProfileSchema);
65
+ var updateStaffStatusContract = oc2.route({ method: "PATCH", path: "/hr/staff/{id}/status" }).input(z2.object({
66
+ id: UuidSchema,
67
+ status: z2.enum(["active", "inactive", "suspended"])
68
+ })).output(EmptyOutput);
69
+ var listDepartmentsContract = oc2.route({ method: "GET", path: "/hr/departments" }).input(z2.object({ branchId: UuidSchema.optional() })).output(z2.array(DepartmentSchema));
70
+ var createDepartmentContract = oc2.route({ method: "POST", path: "/hr/departments" }).input(CreateDepartmentInputSchema).output(DepartmentSchema);
71
+ var hrContract = {
72
+ createStaff: createStaffContract,
73
+ listStaff: listStaffContract,
74
+ getStaffById: getStaffByIdContract,
75
+ updateStaffStatus: updateStaffStatusContract,
76
+ listDepartments: listDepartmentsContract,
77
+ createDepartment: createDepartmentContract
78
+ };
79
+
80
+ // src/contracts/students.ts
81
+ import { oc as oc3 } from "@orpc/contract";
82
+ import * as z3 from "zod";
83
+ var EmptyOutput2 = z3.object({});
84
+ var createStudentContract = oc3.route({ method: "POST", path: "/students" }).input(CreateStudentInputSchema).output(CreateStudentOutputSchema);
85
+ var bulkUploadStudentsContract = oc3.route({ method: "POST", path: "/students/bulk" }).input(BulkUploadStudentsInputSchema).output(BulkUploadStudentsOutputSchema);
86
+ var listStudentsContract = oc3.route({ method: "GET", path: "/students" }).input(ListStudentsInputSchema).output(z3.object({
87
+ items: z3.array(StudentListItemSchema),
88
+ total: z3.number(),
89
+ nextCursor: UuidSchema.nullable()
90
+ }));
91
+ var getStudentByIdContract = oc3.route({ method: "GET", path: "/students/{id}" }).input(z3.object({ id: UuidSchema })).output(StudentProfileSchema);
92
+ var linkGuardianContract = oc3.route({ method: "POST", path: "/students/guardians" }).input(LinkGuardianInputSchema).output(z3.object({ guardianId: UuidSchema }));
93
+ var listClassesContract = oc3.route({ method: "GET", path: "/students/classes" }).input(z3.object({
94
+ termId: UuidSchema.optional(),
95
+ gradeLevel: z3.string().optional()
96
+ })).output(z3.array(ClassSummarySchema));
97
+ var studentsContract = {
98
+ create: createStudentContract,
99
+ bulkUpload: bulkUploadStudentsContract,
100
+ list: listStudentsContract,
101
+ getById: getStudentByIdContract,
102
+ linkGuardian: linkGuardianContract,
103
+ listClasses: listClassesContract
104
+ };
105
+
106
+ export {
107
+ loginContract,
108
+ refreshTokenContract,
109
+ logoutContract,
110
+ getMeContract,
111
+ changePasswordContract,
112
+ requestPasswordResetContract,
113
+ resetPasswordContract,
114
+ switchBranchContract,
115
+ authContract,
116
+ createStaffContract,
117
+ listStaffContract,
118
+ getStaffByIdContract,
119
+ updateStaffStatusContract,
120
+ listDepartmentsContract,
121
+ createDepartmentContract,
122
+ hrContract,
123
+ createStudentContract,
124
+ bulkUploadStudentsContract,
125
+ listStudentsContract,
126
+ getStudentByIdContract,
127
+ linkGuardianContract,
128
+ listClassesContract,
129
+ studentsContract
130
+ };
131
+ //# sourceMappingURL=chunk-S3BK5YEH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/contracts/auth.ts","../src/contracts/hr.ts","../src/contracts/students.ts"],"sourcesContent":["/**\n * Brite Future Schools — bfs-contracts\n * Auth oRPC contract.\n *\n * Defines the API surface for authentication. The bfs-api module\n * imports this and passes it to `implement()` — no logic lives here.\n *\n * HTTP method + path pairs follow REST conventions and feed into the\n * OpenAPI spec that oRPC generates automatically.\n *\n * Phase History:\n * Phase 0.1 (2026-06-05): Initial creation\n *\n * @module src/contracts/auth\n * @since Phase 0.1\n */\n\nimport { oc } from '@orpc/contract'\nimport * as z from 'zod'\nimport {\n ChangePasswordInputSchema,\n LoginInputSchema,\n LoginOutputSchema,\n LogoutInputSchema,\n RefreshTokenInputSchema,\n RefreshTokenOutputSchema,\n RequestPasswordResetInputSchema,\n ResetPasswordInputSchema,\n SessionUserOutputSchema,\n SwitchBranchInputSchema,\n} from '../schemas/auth.js'\n\n/** Reusable empty-success output — used by mutations that return nothing */\nconst EmptyOutputSchema = z.object({}).meta({ description: 'Empty success response' })\n\n// ── Individual procedure contracts ────────────────────────────────────────────\n\n/** Exchange email + password for access/refresh token pair */\nexport const loginContract = oc\n .route({ method: 'POST', path: '/auth/login' })\n .input(LoginInputSchema)\n .output(LoginOutputSchema)\n\n/** Exchange a refresh token for a new access token */\nexport const refreshTokenContract = oc\n .route({ method: 'POST', path: '/auth/refresh' })\n .input(RefreshTokenInputSchema)\n .output(RefreshTokenOutputSchema)\n\n/** Revoke the current refresh token and end the session */\nexport const logoutContract = oc\n .route({ method: 'POST', path: '/auth/logout' })\n .input(LogoutInputSchema)\n .output(EmptyOutputSchema)\n\n/** Return the session user object for the current access token */\nexport const getMeContract = oc\n .route({ method: 'GET', path: '/auth/me' })\n .output(SessionUserOutputSchema)\n\n/** Change password (authenticated, requires current password) */\nexport const changePasswordContract = oc\n .route({ method: 'POST', path: '/auth/change-password' })\n .input(ChangePasswordInputSchema)\n .output(EmptyOutputSchema)\n\n/** Request a password-reset email */\nexport const requestPasswordResetContract = oc\n .route({ method: 'POST', path: '/auth/request-password-reset' })\n .input(RequestPasswordResetInputSchema)\n .output(EmptyOutputSchema)\n\n/** Complete a password reset using the emailed one-time token */\nexport const resetPasswordContract = oc\n .route({ method: 'POST', path: '/auth/reset-password' })\n .input(ResetPasswordInputSchema)\n .output(EmptyOutputSchema)\n\n/** Switch the active branch within an existing session */\nexport const switchBranchContract = oc\n .route({ method: 'POST', path: '/auth/switch-branch' })\n .input(SwitchBranchInputSchema)\n .output(SessionUserOutputSchema)\n\n// ── Auth contract router ──────────────────────────────────────────────────────\n\nexport const authContract = {\n login: loginContract,\n refreshToken: refreshTokenContract,\n logout: logoutContract,\n me: getMeContract,\n changePassword: changePasswordContract,\n requestPasswordReset: requestPasswordResetContract,\n resetPassword: resetPasswordContract,\n switchBranch: switchBranchContract,\n}\n","/**\n * Brite Future Schools — bfs-contracts\n * HR oRPC contract — staff and department procedure definitions.\n *\n * Phase History:\n * Phase 1 (2026-06-07): Initial creation\n *\n * @module src/contracts/hr\n * @since Phase 1\n */\n\nimport { oc } from '@orpc/contract'\nimport * as z from 'zod'\nimport { UuidSchema, PaginationInputSchema } from '../schemas/base.js'\nimport {\n CreateStaffInputSchema,\n CreateStaffOutputSchema,\n StaffProfileSchema,\n StaffListItemSchema,\n ListStaffInputSchema,\n DepartmentSchema,\n CreateDepartmentInputSchema,\n} from '../schemas/hr.js'\n\nconst EmptyOutput = z.object({})\n\n// ── Staff ──────────────────────────────────────────────────────────────────────\n\nexport const createStaffContract = oc\n .route({ method: 'POST', path: '/hr/staff' })\n .input(CreateStaffInputSchema)\n .output(CreateStaffOutputSchema)\n\nexport const listStaffContract = oc\n .route({ method: 'GET', path: '/hr/staff' })\n .input(ListStaffInputSchema)\n .output(z.object({\n items: z.array(StaffListItemSchema),\n total: z.number(),\n nextCursor: UuidSchema.nullable(),\n }))\n\nexport const getStaffByIdContract = oc\n .route({ method: 'GET', path: '/hr/staff/{id}' })\n .input(z.object({ id: UuidSchema }))\n .output(StaffProfileSchema)\n\nexport const updateStaffStatusContract = oc\n .route({ method: 'PATCH', path: '/hr/staff/{id}/status' })\n .input(z.object({\n id: UuidSchema,\n status: z.enum(['active', 'inactive', 'suspended']),\n }))\n .output(EmptyOutput)\n\n// ── Departments ────────────────────────────────────────────────────────────────\n\nexport const listDepartmentsContract = oc\n .route({ method: 'GET', path: '/hr/departments' })\n .input(z.object({ branchId: UuidSchema.optional() }))\n .output(z.array(DepartmentSchema))\n\nexport const createDepartmentContract = oc\n .route({ method: 'POST', path: '/hr/departments' })\n .input(CreateDepartmentInputSchema)\n .output(DepartmentSchema)\n\n// ── HR contract router ─────────────────────────────────────────────────────────\n\nexport const hrContract = {\n createStaff: createStaffContract,\n listStaff: listStaffContract,\n getStaffById: getStaffByIdContract,\n updateStaffStatus: updateStaffStatusContract,\n listDepartments: listDepartmentsContract,\n createDepartment: createDepartmentContract,\n}","/**\n * Brite Future Schools — bfs-contracts\n * Students oRPC contract — student and guardian procedure definitions.\n *\n * Phase History:\n * Phase 1 (2026-06-07): Initial creation\n *\n * @module src/contracts/students\n * @since Phase 1\n */\n\nimport { oc } from '@orpc/contract'\nimport * as z from 'zod'\nimport { UuidSchema } from '../schemas/base.js'\nimport {\n CreateStudentInputSchema,\n CreateStudentOutputSchema,\n StudentProfileSchema,\n StudentListItemSchema,\n ListStudentsInputSchema,\n BulkUploadStudentsInputSchema,\n BulkUploadStudentsOutputSchema,\n LinkGuardianInputSchema,\n ClassSummarySchema,\n} from '../schemas/students.js'\n\nconst EmptyOutput = z.object({})\n\n// ── Students ───────────────────────────────────────────────────────────────────\n\nexport const createStudentContract = oc\n .route({ method: 'POST', path: '/students' })\n .input(CreateStudentInputSchema)\n .output(CreateStudentOutputSchema)\n\nexport const bulkUploadStudentsContract = oc\n .route({ method: 'POST', path: '/students/bulk' })\n .input(BulkUploadStudentsInputSchema)\n .output(BulkUploadStudentsOutputSchema)\n\nexport const listStudentsContract = oc\n .route({ method: 'GET', path: '/students' })\n .input(ListStudentsInputSchema)\n .output(z.object({\n items: z.array(StudentListItemSchema),\n total: z.number(),\n nextCursor: UuidSchema.nullable(),\n }))\n\nexport const getStudentByIdContract = oc\n .route({ method: 'GET', path: '/students/{id}' })\n .input(z.object({ id: UuidSchema }))\n .output(StudentProfileSchema)\n\n// ── Guardians ──────────────────────────────────────────────────────────────────\n\nexport const linkGuardianContract = oc\n .route({ method: 'POST', path: '/students/guardians' })\n .input(LinkGuardianInputSchema)\n .output(z.object({ guardianId: UuidSchema }))\n\n// ── Classes (selector data) ────────────────────────────────────────────────────\n\nexport const listClassesContract = oc\n .route({ method: 'GET', path: '/students/classes' })\n .input(z.object({\n termId: UuidSchema.optional(),\n gradeLevel: z.string().optional(),\n }))\n .output(z.array(ClassSummarySchema))\n\n// ── Students contract router ───────────────────────────────────────────────────\n\nexport const studentsContract = {\n create: createStudentContract,\n bulkUpload: bulkUploadStudentsContract,\n list: listStudentsContract,\n getById: getStudentByIdContract,\n linkGuardian: linkGuardianContract,\n listClasses: listClassesContract,\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,UAAU;AACnB,YAAY,OAAO;AAenB,IAAM,oBAAsB,SAAO,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,yBAAyB,CAAC;AAK9E,IAAM,gBAAgB,GAC1B,MAAM,EAAE,QAAQ,QAAQ,MAAM,cAAc,CAAC,EAC7C,MAAM,gBAAgB,EACtB,OAAO,iBAAiB;AAGpB,IAAM,uBAAuB,GACjC,MAAM,EAAE,QAAQ,QAAQ,MAAM,gBAAgB,CAAC,EAC/C,MAAM,uBAAuB,EAC7B,OAAO,wBAAwB;AAG3B,IAAM,iBAAiB,GAC3B,MAAM,EAAE,QAAQ,QA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C,OAAS,UAAO;AAAA,EAChB,YAAY,WAAW,SAAS;AACpC,CAAC,CAAC;AAEC,IAAM,yBAAyBA,IACjC,MAAM,EAAE,QAAQ,OAAO,MAAM,iBAAiB,CAAC,EAC/C,MAAQ,UAAO,EAAE,IAAI,WAAW,CAAC,CAAC,EAClC,OAAO,oBAAoB;AAIzB,IAAM,uBAAuBA,IAC/B,MAAM,EAAE,QAAQ,QAAQ,MAAM,sBAAsB,CAAC,EACrD,MAAM,uBAAuB,EAC7B,OAAS,UAAO,EAAE,YAAY,WAAW,CAAC,CAAC;AAIzC,IAAM,sBAAsBA,IAC9B,MAAM,EAAE,QAAQ,OAAO,MAAM,oBAAoB,CAAC,EAClD,MAAQ,UAAO;AAAA,EACZ,QAAQ,WAAW,SAAS;AAAA,EAC5B,YAAc,UAAO,EAAE,SAAS;AACpC,CAAC,CAAC,EACD,OAAS,SAAM,kBAAkB,CAAC;AAIhC,IAAM,mBAAmB;AAAA,EAC5B,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,SAAS;AAAA,EACT,cAAc;AAAA,EACd,aAAa;AACjB;","names":["oc","z","oc","oc","z","EmptyOutput","oc"]}
@@ -31,14 +31,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var contracts_exports = {};
32
32
  __export(contracts_exports, {
33
33
  authContract: () => authContract,
34
+ bulkUploadStudentsContract: () => bulkUploadStudentsContract,
34
35
  changePasswordContract: () => changePasswordContract,
36
+ createDepartmentContract: () => createDepartmentContract,
37
+ createStaffContract: () => createStaffContract,
38
+ createStudentContract: () => createStudentContract,
35
39
  getMeContract: () => getMeContract,
40
+ getStaffByIdContract: () => getStaffByIdContract,
41
+ getStudentByIdContract: () => getStudentByIdContract,
42
+ hrContract: () => hrContract,
43
+ linkGuardianContract: () => linkGuardianContract,
44
+ listClassesContract: () => listClassesContract,
45
+ listDepartmentsContract: () => listDepartmentsContract,
46
+ listStaffContract: () => listStaffContract,
47
+ listStudentsContract: () => listStudentsContract,
36
48
  loginContract: () => loginContract,
37
49
  logoutContract: () => logoutContract,
38
50
  refreshTokenContract: () => refreshTokenContract,
39
51
  requestPasswordResetContract: () => requestPasswordResetContract,
40
52
  resetPasswordContract: () => resetPasswordContract,
41
- switchBranchContract: () => switchBranchContract
53
+ studentsContract: () => studentsContract,
54
+ switchBranchContract: () => switchBranchContract,
55
+ updateStaffStatusContract: () => updateStaffStatusContract
42
56
  });
43
57
  module.exports = __toCommonJS(contracts_exports);
44
58
 
@@ -164,16 +178,415 @@ var authContract = {
164
178
  resetPassword: resetPasswordContract,
165
179
  switchBranch: switchBranchContract
166
180
  };
181
+
182
+ // src/contracts/hr.ts
183
+ var import_contract2 = require("@orpc/contract");
184
+ var z5 = __toESM(require("zod"), 1);
185
+
186
+ // src/schemas/hr.ts
187
+ var z4 = __toESM(require("zod"), 1);
188
+ var EmploymentTypeSchema = z4.enum([
189
+ "permanent",
190
+ "contract",
191
+ "temporary",
192
+ "intern"
193
+ ]);
194
+ var RoleNameSchema = z4.enum([
195
+ "PROPRIETOR",
196
+ "DIRECTOR",
197
+ "SYSTEM_ADMIN",
198
+ "PRINCIPAL",
199
+ "DEPUTY_PRINCIPAL",
200
+ "HOD",
201
+ "CLASS_TEACHER",
202
+ "SUBJECT_TEACHER",
203
+ "BURSAR",
204
+ "HR_ADMIN",
205
+ "SCHOOL_NURSE",
206
+ "LIBRARIAN",
207
+ "LAB_TECHNICIAN",
208
+ "SPORTS_COACH",
209
+ "COUNSELLOR",
210
+ "CARETAKER",
211
+ "SECURITY",
212
+ "KITCHEN_STAFF",
213
+ "KITCHEN_MANAGER",
214
+ "DRIVER",
215
+ "IT_ADMIN",
216
+ "BOARDING_MASTER",
217
+ "PREFECT",
218
+ "STUDENT",
219
+ "PARENT",
220
+ "ORG_SPONSOR",
221
+ "INDIVIDUAL_SPONSOR"
222
+ ]);
223
+ var CreateStaffInputSchema = z4.object({
224
+ // Personal details
225
+ firstName: z4.string().min(1).max(100),
226
+ middleName: z4.string().max(100).optional(),
227
+ lastName: z4.string().min(1).max(100),
228
+ email: z4.email(),
229
+ phone: z4.string().min(9).max(30),
230
+ nationalId: z4.string().min(1).max(20),
231
+ // Role assignment
232
+ roleName: RoleNameSchema.meta({
233
+ description: "System role to assign \u2014 determines dashboard access and permissions"
234
+ }),
235
+ isPrimaryRole: z4.boolean().default(true),
236
+ // Employment details
237
+ departmentId: UuidSchema.optional(),
238
+ designation: z4.string().min(1).max(100).meta({
239
+ description: 'Job title, e.g. "Mathematics Teacher", "Head of Finance"'
240
+ }),
241
+ employmentType: EmploymentTypeSchema,
242
+ contractStart: z4.iso.date().meta({ description: "ISO date, e.g. 2026-01-15" }),
243
+ contractEnd: z4.iso.date().optional(),
244
+ // Payroll
245
+ basicSalary: z4.number().positive(),
246
+ houseAllowance: z4.number().nonnegative().default(0),
247
+ transportAllowance: z4.number().nonnegative().default(0),
248
+ helbDeduction: z4.number().nonnegative().default(0),
249
+ saccoDeduction: z4.number().nonnegative().default(0),
250
+ // Banking
251
+ bankName: z4.string().max(100).optional(),
252
+ bankAccount: z4.string().max(30).optional(),
253
+ bankBranch: z4.string().max(100).optional(),
254
+ // Statutory
255
+ tscNumber: z4.string().max(30).optional(),
256
+ kraPin: z4.string().max(20).optional(),
257
+ nhifNo: z4.string().max(20).optional(),
258
+ nssfNo: z4.string().max(20).optional()
259
+ });
260
+ var StaffProfileSchema = z4.object({
261
+ // Staff record
262
+ id: UuidSchema,
263
+ userId: UuidSchema,
264
+ branchId: UuidSchema,
265
+ firstName: z4.string(),
266
+ middleName: z4.string().nullable(),
267
+ lastName: z4.string(),
268
+ phone: z4.string(),
269
+ nationalId: z4.string(),
270
+ tscNumber: z4.string().nullable(),
271
+ kraPin: z4.string().nullable(),
272
+ nhifNo: z4.string().nullable(),
273
+ nssfNo: z4.string().nullable(),
274
+ designation: z4.string(),
275
+ employmentType: EmploymentTypeSchema,
276
+ contractStart: z4.string(),
277
+ contractEnd: z4.string().nullable(),
278
+ basicSalary: z4.string(),
279
+ houseAllowance: z4.string(),
280
+ transportAllowance: z4.string(),
281
+ helbDeduction: z4.string().nullable(),
282
+ saccoDeduction: z4.string().nullable(),
283
+ bankName: z4.string().nullable(),
284
+ bankAccount: z4.string().nullable(),
285
+ bankBranch: z4.string().nullable(),
286
+ status: z4.string(),
287
+ createdAt: z4.string(),
288
+ // From users join
289
+ email: z4.string(),
290
+ mustChangePassword: z4.boolean(),
291
+ // Department (nullable — not all staff are in a department)
292
+ departmentId: UuidSchema.nullable(),
293
+ departmentName: z4.string().nullable(),
294
+ // Primary role
295
+ roleName: RoleNameSchema.nullable(),
296
+ roleId: UuidSchema.nullable()
297
+ });
298
+ var StaffListItemSchema = z4.object({
299
+ id: UuidSchema,
300
+ userId: UuidSchema,
301
+ firstName: z4.string(),
302
+ middleName: z4.string().nullable(),
303
+ lastName: z4.string(),
304
+ email: z4.string(),
305
+ phone: z4.string(),
306
+ designation: z4.string(),
307
+ employmentType: EmploymentTypeSchema,
308
+ status: z4.string(),
309
+ departmentName: z4.string().nullable(),
310
+ roleName: RoleNameSchema.nullable(),
311
+ createdAt: z4.string()
312
+ });
313
+ var ListStaffInputSchema = PaginationInputSchema.extend({
314
+ search: z4.string().optional().meta({
315
+ description: "Search by name or email"
316
+ }),
317
+ departmentId: UuidSchema.optional(),
318
+ roleName: RoleNameSchema.optional(),
319
+ status: z4.enum(["active", "inactive"]).optional()
320
+ });
321
+ var CreateStaffOutputSchema = z4.object({
322
+ staffId: UuidSchema,
323
+ userId: UuidSchema,
324
+ email: z4.string(),
325
+ /** Temp password was emailed — not returned in response for security */
326
+ emailSent: z4.boolean()
327
+ });
328
+ var DepartmentSchema = z4.object({
329
+ id: UuidSchema,
330
+ branchId: UuidSchema,
331
+ name: z4.string(),
332
+ hodId: UuidSchema.nullable()
333
+ });
334
+ var CreateDepartmentInputSchema = z4.object({
335
+ name: z4.string().min(1).max(100),
336
+ hodId: UuidSchema.optional()
337
+ });
338
+
339
+ // src/contracts/hr.ts
340
+ var EmptyOutput = z5.object({});
341
+ var createStaffContract = import_contract2.oc.route({ method: "POST", path: "/hr/staff" }).input(CreateStaffInputSchema).output(CreateStaffOutputSchema);
342
+ var listStaffContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff" }).input(ListStaffInputSchema).output(z5.object({
343
+ items: z5.array(StaffListItemSchema),
344
+ total: z5.number(),
345
+ nextCursor: UuidSchema.nullable()
346
+ }));
347
+ var getStaffByIdContract = import_contract2.oc.route({ method: "GET", path: "/hr/staff/{id}" }).input(z5.object({ id: UuidSchema })).output(StaffProfileSchema);
348
+ var updateStaffStatusContract = import_contract2.oc.route({ method: "PATCH", path: "/hr/staff/{id}/status" }).input(z5.object({
349
+ id: UuidSchema,
350
+ status: z5.enum(["active", "inactive", "suspended"])
351
+ })).output(EmptyOutput);
352
+ var listDepartmentsContract = import_contract2.oc.route({ method: "GET", path: "/hr/departments" }).input(z5.object({ branchId: UuidSchema.optional() })).output(z5.array(DepartmentSchema));
353
+ var createDepartmentContract = import_contract2.oc.route({ method: "POST", path: "/hr/departments" }).input(CreateDepartmentInputSchema).output(DepartmentSchema);
354
+ var hrContract = {
355
+ createStaff: createStaffContract,
356
+ listStaff: listStaffContract,
357
+ getStaffById: getStaffByIdContract,
358
+ updateStaffStatus: updateStaffStatusContract,
359
+ listDepartments: listDepartmentsContract,
360
+ createDepartment: createDepartmentContract
361
+ };
362
+
363
+ // src/contracts/students.ts
364
+ var import_contract3 = require("@orpc/contract");
365
+ var z7 = __toESM(require("zod"), 1);
366
+
367
+ // src/schemas/students.ts
368
+ var z6 = __toESM(require("zod"), 1);
369
+ var GenderSchema = z6.enum(["male", "female"]);
370
+ var StudentStatusSchema = z6.enum([
371
+ "active",
372
+ "transferred",
373
+ "graduated",
374
+ "suspended",
375
+ "withdrawn"
376
+ ]);
377
+ var GradeLevelSchema = z6.enum([
378
+ "PP1",
379
+ "PP2",
380
+ "G1",
381
+ "G2",
382
+ "G3",
383
+ "G4",
384
+ "G5",
385
+ "G6",
386
+ "G7",
387
+ "G8",
388
+ "G9"
389
+ ]);
390
+ var CreateStudentInputSchema = z6.object({
391
+ // Identity
392
+ firstName: z6.string().min(1).max(100),
393
+ middleName: z6.string().max(100).optional(),
394
+ lastName: z6.string().min(1).max(100),
395
+ dateOfBirth: z6.iso.date().meta({ description: "ISO date, e.g. 2015-03-22" }),
396
+ gender: GenderSchema,
397
+ admissionNo: z6.string().min(1).max(50).meta({
398
+ description: "School-assigned admission number \u2014 must be unique per branch"
399
+ }),
400
+ nemisNo: z6.string().max(50).optional(),
401
+ admissionDate: z6.iso.date(),
402
+ bloodGroup: z6.string().max(10).optional(),
403
+ medicalNotes: z6.string().optional(),
404
+ // Class placement (optional at creation — can be enrolled later)
405
+ classId: UuidSchema.optional().meta({
406
+ description: "Class to enrol student in for the current term"
407
+ }),
408
+ termId: UuidSchema.optional().meta({
409
+ description: "Term for class enrolment \u2014 required if classId is provided"
410
+ }),
411
+ // Guardian (optional at creation — can be linked later)
412
+ guardian: z6.object({
413
+ firstName: z6.string().min(1).max(100),
414
+ middleName: z6.string().max(100).optional(),
415
+ lastName: z6.string().min(1).max(100),
416
+ relationship: z6.string().min(1).max(50).meta({
417
+ description: "e.g. mother, father, uncle, guardian"
418
+ }),
419
+ phone: z6.string().min(9).max(30),
420
+ email: z6.email().optional(),
421
+ nationalId: z6.string().max(20).optional(),
422
+ occupation: z6.string().max(100).optional()
423
+ }).optional()
424
+ });
425
+ var StudentProfileSchema = z6.object({
426
+ id: UuidSchema,
427
+ branchId: UuidSchema,
428
+ admissionNo: z6.string(),
429
+ nemisNo: z6.string().nullable(),
430
+ firstName: z6.string(),
431
+ middleName: z6.string().nullable(),
432
+ lastName: z6.string(),
433
+ dateOfBirth: z6.string(),
434
+ gender: GenderSchema,
435
+ photoUrl: z6.string().nullable(),
436
+ bloodGroup: z6.string().nullable(),
437
+ medicalNotes: z6.string().nullable(),
438
+ admissionDate: z6.string(),
439
+ status: StudentStatusSchema,
440
+ createdAt: z6.string(),
441
+ // Current class (from latest enrollment)
442
+ currentClass: z6.object({
443
+ classId: UuidSchema,
444
+ className: z6.string(),
445
+ gradeLevel: GradeLevelSchema,
446
+ termId: UuidSchema,
447
+ termName: z6.string()
448
+ }).nullable(),
449
+ // Guardians
450
+ guardians: z6.array(z6.object({
451
+ id: UuidSchema,
452
+ firstName: z6.string(),
453
+ middleName: z6.string().nullable(),
454
+ lastName: z6.string(),
455
+ relationship: z6.string(),
456
+ phone: z6.string(),
457
+ email: z6.string().nullable(),
458
+ isPrimary: z6.boolean()
459
+ }))
460
+ });
461
+ var StudentListItemSchema = z6.object({
462
+ id: UuidSchema,
463
+ admissionNo: z6.string(),
464
+ firstName: z6.string(),
465
+ middleName: z6.string().nullable(),
466
+ lastName: z6.string(),
467
+ gender: GenderSchema,
468
+ status: StudentStatusSchema,
469
+ className: z6.string().nullable(),
470
+ gradeLevel: GradeLevelSchema.nullable(),
471
+ primaryGuardianName: z6.string().nullable(),
472
+ primaryGuardianPhone: z6.string().nullable(),
473
+ createdAt: z6.string()
474
+ });
475
+ var ListStudentsInputSchema = PaginationInputSchema.extend({
476
+ search: z6.string().optional().meta({
477
+ description: "Search by name or admission number"
478
+ }),
479
+ classId: UuidSchema.optional(),
480
+ gradeLevel: GradeLevelSchema.optional(),
481
+ status: StudentStatusSchema.optional(),
482
+ termId: UuidSchema.optional()
483
+ });
484
+ var BulkUploadStudentRowSchema = z6.object({
485
+ firstName: z6.string().min(1),
486
+ middleName: z6.string().optional(),
487
+ lastName: z6.string().min(1),
488
+ dateOfBirth: z6.string().min(1).meta({ description: "Any parseable date string" }),
489
+ gender: z6.string().min(1).meta({ description: "male | female (case-insensitive)" }),
490
+ admissionNo: z6.string().min(1),
491
+ nemisNo: z6.string().optional(),
492
+ admissionDate: z6.string().optional(),
493
+ bloodGroup: z6.string().optional(),
494
+ // Guardian columns (all optional in CSV)
495
+ guardianFirstName: z6.string().optional(),
496
+ guardianLastName: z6.string().optional(),
497
+ guardianRelationship: z6.string().optional(),
498
+ guardianPhone: z6.string().optional(),
499
+ guardianEmail: z6.string().optional()
500
+ });
501
+ var BulkUploadStudentsInputSchema = z6.object({
502
+ classId: UuidSchema.meta({
503
+ description: "Class to enrol all uploaded students into"
504
+ }),
505
+ termId: UuidSchema,
506
+ rows: z6.array(BulkUploadStudentRowSchema).min(1).max(500)
507
+ });
508
+ var BulkUploadStudentsOutputSchema = z6.object({
509
+ created: z6.int().nonnegative(),
510
+ skipped: z6.int().nonnegative(),
511
+ errors: z6.array(z6.object({
512
+ row: z6.int().positive(),
513
+ admissionNo: z6.string().optional(),
514
+ reason: z6.string()
515
+ }))
516
+ });
517
+ var CreateStudentOutputSchema = z6.object({
518
+ studentId: UuidSchema,
519
+ admissionNo: z6.string()
520
+ });
521
+ var LinkGuardianInputSchema = z6.object({
522
+ studentId: UuidSchema,
523
+ firstName: z6.string().min(1).max(100),
524
+ middleName: z6.string().max(100).optional(),
525
+ lastName: z6.string().min(1).max(100),
526
+ relationship: z6.string().min(1).max(50),
527
+ phone: z6.string().min(9).max(30),
528
+ email: z6.email().optional(),
529
+ nationalId: z6.string().max(20).optional(),
530
+ occupation: z6.string().max(100).optional(),
531
+ isPrimary: z6.boolean().default(false)
532
+ });
533
+ var ClassSummarySchema = z6.object({
534
+ id: UuidSchema,
535
+ name: z6.string(),
536
+ gradeLevel: GradeLevelSchema,
537
+ gradeName: z6.string(),
538
+ capacity: z6.number().nullable(),
539
+ enrolledCount: z6.number(),
540
+ classTeacherId: UuidSchema.nullable()
541
+ });
542
+
543
+ // src/contracts/students.ts
544
+ var EmptyOutput2 = z7.object({});
545
+ var createStudentContract = import_contract3.oc.route({ method: "POST", path: "/students" }).input(CreateStudentInputSchema).output(CreateStudentOutputSchema);
546
+ var bulkUploadStudentsContract = import_contract3.oc.route({ method: "POST", path: "/students/bulk" }).input(BulkUploadStudentsInputSchema).output(BulkUploadStudentsOutputSchema);
547
+ var listStudentsContract = import_contract3.oc.route({ method: "GET", path: "/students" }).input(ListStudentsInputSchema).output(z7.object({
548
+ items: z7.array(StudentListItemSchema),
549
+ total: z7.number(),
550
+ nextCursor: UuidSchema.nullable()
551
+ }));
552
+ var getStudentByIdContract = import_contract3.oc.route({ method: "GET", path: "/students/{id}" }).input(z7.object({ id: UuidSchema })).output(StudentProfileSchema);
553
+ var linkGuardianContract = import_contract3.oc.route({ method: "POST", path: "/students/guardians" }).input(LinkGuardianInputSchema).output(z7.object({ guardianId: UuidSchema }));
554
+ var listClassesContract = import_contract3.oc.route({ method: "GET", path: "/students/classes" }).input(z7.object({
555
+ termId: UuidSchema.optional(),
556
+ gradeLevel: z7.string().optional()
557
+ })).output(z7.array(ClassSummarySchema));
558
+ var studentsContract = {
559
+ create: createStudentContract,
560
+ bulkUpload: bulkUploadStudentsContract,
561
+ list: listStudentsContract,
562
+ getById: getStudentByIdContract,
563
+ linkGuardian: linkGuardianContract,
564
+ listClasses: listClassesContract
565
+ };
167
566
  // Annotate the CommonJS export names for ESM import in node:
168
567
  0 && (module.exports = {
169
568
  authContract,
569
+ bulkUploadStudentsContract,
170
570
  changePasswordContract,
571
+ createDepartmentContract,
572
+ createStaffContract,
573
+ createStudentContract,
171
574
  getMeContract,
575
+ getStaffByIdContract,
576
+ getStudentByIdContract,
577
+ hrContract,
578
+ linkGuardianContract,
579
+ listClassesContract,
580
+ listDepartmentsContract,
581
+ listStaffContract,
582
+ listStudentsContract,
172
583
  loginContract,
173
584
  logoutContract,
174
585
  refreshTokenContract,
175
586
  requestPasswordResetContract,
176
587
  resetPasswordContract,
177
- switchBranchContract
588
+ studentsContract,
589
+ switchBranchContract,
590
+ updateStaffStatusContract
178
591
  });
179
592
  //# sourceMappingURL=index.cjs.map