2.7 KiB
You are a Senior Full Stack Engineer.
Project: Training Management System (TMS)
Current status:
- Auth.js role mapping is completed.
- Sidebar displays menu by role.
- Employee Training Records module is completed.
- HRD Review Workflow is completed.
Current task: Implement Sprint 4: Training Policy and Course Master Enhancement.
Important constraints:
- Do NOT change existing folder structure.
- Do NOT create a new project.
- Do NOT migrate ORM.
- Use existing Drizzle ORM.
- Use existing Auth.js session.
- Reuse existing UI components.
- Reuse existing /dashboard route structure.
- Make minimal-impact changes only.
Part 1: Training Policy Module
Requirements:
-
Create Training Policy page. Route: /dashboard/training-policy
-
HRD can create and update yearly training policy.
Fields:
- year
- totalHours
- kHours
- sHours
- aHours
- isActive
- Validation:
- year is required.
- totalHours is required.
- kHours is required.
- sHours is required.
- aHours is required.
- kHours + sHours + aHours must equal totalHours.
- Default policy example:
- Total Hours = 30
- K = 12
- S = 12
- A = 6
-
Dashboard must use Training Policy instead of hardcoded values.
-
Only HRD can access and manage Training Policy.
Part 2: Course Master Enhancement
Requirements:
-
Update existing Course Master without changing module structure.
-
Ensure Course Master supports these fields:
- courseCode
- courseName
- description
- defaultCategory (K/S/A)
- defaultHours
- provider
- status
- mandatory
- certificateRequired
- validityMonths
- trainingCost
- If existing fields already exist, reuse them.
- If field names differ, map them carefully.
- Do not remove existing course data.
- Add Zod validation.
- Add create/edit/list UI fields.
- Add loading, empty, success, and error states.
Part 3: Output Review File
After implementing code changes, create a review output file in the project:
Path: docs/sprint-4-training-policy-course-master-review.md
The file must include:
- Summary of changes
- Files changed
- Database changes
- Migration commands
- New routes
- Validation rules
- Permission rules
- Manual test checklist
- Known limitations
- Next recommended sprint
Manual Test Checklist must include:
- HRD can open Training Policy page.
- Employee cannot open Training Policy page.
- HRD can create policy.
- HRD can edit policy.
- System blocks invalid K/S/A sum.
- Dashboard uses policy values.
- HRD can create course.
- HRD can edit course.
- Course Master supports certificateRequired.
- Course Master supports trainingCost.
Return:
- Complete code changes with file paths.
- Content of docs/sprint-4-training-policy-course-master-review.md.
- Any commands required to run migration.