5.2 KiB
5.2 KiB
Sprint 4 Review: Training Policy and Course Master
1. Summary of changes
- Implemented the HRD-only Training Policy module at
/dashboard/training-policy. - Added yearly training policy create/update flow with Zod validation.
- Enforced
kHours + sHours + aHours === totalHours. - Added active policy handling so the active record drives dashboard targets.
- Updated dashboard summary cards to use Training Policy values.
- Enhanced Course Master to support:
courseCodecourseNamevia existingnamedescriptiondefaultCategoryvia existingcategorydefaultHoursvia existingstandardHoursprovidervia existingorganizerstatusvia existingisActivemandatoryvia existingisRequiredcertificateRequiredvalidityMonthsvia existingcertificateValidityMonthstrainingCost
- Added loading, empty, success, and error states for Sprint 4 pages.
2. Files changed
Training Policy
src/app/api/training-policies/route.tssrc/app/api/training-policies/[id]/route.tssrc/app/dashboard/training-policy/page.tsxsrc/app/dashboard/training-policy/loading.tsxsrc/app/dashboard/training-policy/error.tsxsrc/features/training-policy/api/types.tssrc/features/training-policy/api/service.tssrc/features/training-policy/api/queries.tssrc/features/training-policy/api/mutations.tssrc/features/training-policy/components/training-policy-page.tsxsrc/features/training-policy/components/training-policy-form.tsxsrc/features/training-policy/constants/training-policy-defaults.tssrc/features/training-policy/schemas/training-policy.tssrc/features/training-policy/server/training-policy-data.ts
Course Master
src/app/api/courses/route.tssrc/app/api/courses/[id]/route.tssrc/app/dashboard/courses/loading.tsxsrc/app/dashboard/courses/error.tsxsrc/app/dashboard/courses/[courseId]/loading.tsxsrc/app/dashboard/courses/[courseId]/error.tsxsrc/features/courses/api/types.tssrc/features/courses/components/course-form.tsxsrc/features/courses/components/course-tables/columns.tsxsrc/features/courses/components/course-tables/index.tsxsrc/features/courses/components/course-tables/options.tsxsrc/features/courses/constants/course-options.tssrc/features/courses/schemas/course.tssrc/features/courses/server/course-data.ts
Dashboard usage
src/features/overview/server/overview-data.ts
3. Database changes
- No new schema changes were required.
- Sprint 4 reused the existing
training_policiestable. - Sprint 4 reused existing
coursescolumns:course_codecategorystandard_hoursorganizeris_requiredcertificate_requiredcertificate_validity_monthstraining_cost
4. Migration commands
- No new migration is required for this sprint.
- If your database has not yet applied the current schema in the repository, run:
npm run migrate
5. New routes
GET /api/training-policiesPOST /api/training-policiesPATCH /api/training-policies/[id]/dashboard/training-policy
6. Validation rules
Training Policy
yearis requiredtotalHoursis required and must be greater than0kHoursis required and must be>= 0sHoursis required and must be>= 0aHoursis required and must be>= 0kHours + sHours + aHoursmust equaltotalHoursyearmust be unique per organization
Course Master
courseNamemaps tonameand must be at least 2 charactersdefaultCategorymaps tocategoryand is requireddefaultHoursmaps tostandardHoursand must be>= 0validityMonthsmaps tocertificateValidityMonthsand must be an integer>= 0trainingCostmust be>= 0when providedcourseCodeis optional and limited to 50 characters
7. Permission rules
- Training Policy page and APIs require HRD access through existing Auth.js session helpers.
- Employee users cannot access
/dashboard/training-policy. - Course Master remains HRD-only through the existing route and API guards.
- Dashboard policy usage respects the user's existing organization/session scope.
8. Manual test checklist
- 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.
9. Known limitations
- Course category input is now aligned to
K/S/A, but legacy category values are still preserved for existing rows. - Training Policy currently supports create and update only; delete/archive flow is not part of Sprint 4.
- Dashboard summary cards use the active policy, or the shared default example if no policy row exists yet.
10. Next recommended sprint
- Add audit logging for Training Policy changes.
- Add a dedicated policy history detail or archive flow.
- Expand dashboard policy reporting to show K/S/A completion progress, not only total-hour target progress.
- Add course import/export support if HRD master-data volume is expected to grow.