@hed-hog/lms 0.0.304 → 0.0.306
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/README.md +413 -401
- package/dist/certificate/certificate.controller.d.ts +90 -0
- package/dist/certificate/certificate.controller.d.ts.map +1 -0
- package/dist/certificate/certificate.controller.js +121 -0
- package/dist/certificate/certificate.controller.js.map +1 -0
- package/dist/certificate/certificate.module.d.ts +3 -0
- package/dist/certificate/certificate.module.d.ts.map +1 -0
- package/dist/certificate/certificate.module.js +26 -0
- package/dist/certificate/certificate.module.js.map +1 -0
- package/dist/certificate/certificate.service.d.ts +115 -0
- package/dist/certificate/certificate.service.d.ts.map +1 -0
- package/dist/certificate/certificate.service.js +343 -0
- package/dist/certificate/certificate.service.js.map +1 -0
- package/dist/certificate/dto/create-certificate-template.dto.d.ts +8 -0
- package/dist/certificate/dto/create-certificate-template.dto.d.ts.map +1 -0
- package/dist/certificate/dto/create-certificate-template.dto.js +44 -0
- package/dist/certificate/dto/create-certificate-template.dto.js.map +1 -0
- package/dist/certificate/dto/update-certificate-template.dto.d.ts +6 -0
- package/dist/certificate/dto/update-certificate-template.dto.d.ts.map +1 -0
- package/dist/certificate/dto/update-certificate-template.dto.js +9 -0
- package/dist/certificate/dto/update-certificate-template.dto.js.map +1 -0
- package/dist/class-group/class-group.controller.d.ts +305 -0
- package/dist/class-group/class-group.controller.d.ts.map +1 -0
- package/dist/class-group/class-group.controller.js +257 -0
- package/dist/class-group/class-group.controller.js.map +1 -0
- package/dist/class-group/class-group.module.d.ts +3 -0
- package/dist/class-group/class-group.module.d.ts.map +1 -0
- package/dist/class-group/class-group.module.js +25 -0
- package/dist/class-group/class-group.module.js.map +1 -0
- package/dist/class-group/class-group.service.d.ts +354 -0
- package/dist/class-group/class-group.service.d.ts.map +1 -0
- package/dist/class-group/class-group.service.js +1356 -0
- package/dist/class-group/class-group.service.js.map +1 -0
- package/dist/class-group/dto/create-class-group.dto.d.ts +33 -0
- package/dist/class-group/dto/create-class-group.dto.d.ts.map +1 -0
- package/dist/class-group/dto/create-class-group.dto.js +165 -0
- package/dist/class-group/dto/create-class-group.dto.js.map +1 -0
- package/dist/class-group/dto/create-session.dto.d.ts +22 -0
- package/dist/class-group/dto/create-session.dto.d.ts.map +1 -0
- package/dist/class-group/dto/create-session.dto.js +117 -0
- package/dist/class-group/dto/create-session.dto.js.map +1 -0
- package/dist/class-group/dto/enrollment.dto.d.ts +22 -0
- package/dist/class-group/dto/enrollment.dto.d.ts.map +1 -0
- package/dist/class-group/dto/enrollment.dto.js +89 -0
- package/dist/class-group/dto/enrollment.dto.js.map +1 -0
- package/dist/class-group/dto/update-class-group.dto.d.ts +6 -0
- package/dist/class-group/dto/update-class-group.dto.d.ts.map +1 -0
- package/dist/class-group/dto/update-class-group.dto.js +9 -0
- package/dist/class-group/dto/update-class-group.dto.js.map +1 -0
- package/dist/class-group/dto/update-session.dto.d.ts +7 -0
- package/dist/class-group/dto/update-session.dto.d.ts.map +1 -0
- package/dist/class-group/dto/update-session.dto.js +24 -0
- package/dist/class-group/dto/update-session.dto.js.map +1 -0
- package/dist/course/course-structure.controller.d.ts +127 -0
- package/dist/course/course-structure.controller.d.ts.map +1 -0
- package/dist/course/course-structure.controller.js +115 -0
- package/dist/course/course-structure.controller.js.map +1 -0
- package/dist/course/course-structure.service.d.ts +142 -0
- package/dist/course/course-structure.service.d.ts.map +1 -0
- package/dist/course/course-structure.service.js +445 -0
- package/dist/course/course-structure.service.js.map +1 -0
- package/dist/course/course.controller.d.ts +195 -0
- package/dist/course/course.controller.d.ts.map +1 -0
- package/dist/course/course.controller.js +104 -0
- package/dist/course/course.controller.js.map +1 -0
- package/dist/course/course.module.d.ts +3 -0
- package/dist/course/course.module.d.ts.map +1 -0
- package/dist/course/course.module.js +28 -0
- package/dist/course/course.module.js.map +1 -0
- package/dist/course/course.service.d.ts +215 -0
- package/dist/course/course.service.d.ts.map +1 -0
- package/dist/course/course.service.js +743 -0
- package/dist/course/course.service.js.map +1 -0
- package/dist/course/dto/create-course-structure-lesson.dto.d.ts +24 -0
- package/dist/course/dto/create-course-structure-lesson.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course-structure-lesson.dto.js +118 -0
- package/dist/course/dto/create-course-structure-lesson.dto.js.map +1 -0
- package/dist/course/dto/create-course-structure-session.dto.d.ts +7 -0
- package/dist/course/dto/create-course-structure-session.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course-structure-session.dto.js +40 -0
- package/dist/course/dto/create-course-structure-session.dto.js.map +1 -0
- package/dist/course/dto/create-course.dto.d.ts +26 -0
- package/dist/course/dto/create-course.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course.dto.js +138 -0
- package/dist/course/dto/create-course.dto.js.map +1 -0
- package/dist/course/dto/update-course-structure-lesson.dto.d.ts +6 -0
- package/dist/course/dto/update-course-structure-lesson.dto.d.ts.map +1 -0
- package/dist/course/dto/update-course-structure-lesson.dto.js +9 -0
- package/dist/course/dto/update-course-structure-lesson.dto.js.map +1 -0
- package/dist/course/dto/update-course-structure-session.dto.d.ts +6 -0
- package/dist/course/dto/update-course-structure-session.dto.d.ts.map +1 -0
- package/dist/course/dto/update-course-structure-session.dto.js +9 -0
- package/dist/course/dto/update-course-structure-session.dto.js.map +1 -0
- package/dist/course/dto/update-course.dto.d.ts +6 -0
- package/dist/course/dto/update-course.dto.d.ts.map +1 -0
- package/dist/course/dto/update-course.dto.js +9 -0
- package/dist/course/dto/update-course.dto.js.map +1 -0
- package/dist/dashboard/dashboard.controller.d.ts +101 -0
- package/dist/dashboard/dashboard.controller.d.ts.map +1 -0
- package/dist/dashboard/dashboard.controller.js +40 -0
- package/dist/dashboard/dashboard.controller.js.map +1 -0
- package/dist/dashboard/dashboard.module.d.ts +3 -0
- package/dist/dashboard/dashboard.module.d.ts.map +1 -0
- package/dist/dashboard/dashboard.module.js +25 -0
- package/dist/dashboard/dashboard.module.js.map +1 -0
- package/dist/dashboard/dashboard.service.d.ts +130 -0
- package/dist/dashboard/dashboard.service.d.ts.map +1 -0
- package/dist/dashboard/dashboard.service.js +626 -0
- package/dist/dashboard/dashboard.service.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.d.ts +4 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.js +22 -0
- package/dist/enterprise/dto/add-enterprise-class-group.dto.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.d.ts +5 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.js +27 -0
- package/dist/enterprise/dto/add-enterprise-course.dto.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.d.ts +5 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.js +27 -0
- package/dist/enterprise/dto/add-enterprise-student.dto.js.map +1 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.d.ts +7 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.js +36 -0
- package/dist/enterprise/dto/add-enterprise-user.dto.js.map +1 -0
- package/dist/enterprise/dto/create-enterprise.dto.d.ts +10 -0
- package/dist/enterprise/dto/create-enterprise.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/create-enterprise.dto.js +54 -0
- package/dist/enterprise/dto/create-enterprise.dto.js.map +1 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.d.ts +4 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.js +22 -0
- package/dist/enterprise/dto/update-enterprise-student.dto.js.map +1 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.d.ts +5 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.js +27 -0
- package/dist/enterprise/dto/update-enterprise-user.dto.js.map +1 -0
- package/dist/enterprise/dto/update-enterprise.dto.d.ts +6 -0
- package/dist/enterprise/dto/update-enterprise.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/update-enterprise.dto.js +9 -0
- package/dist/enterprise/dto/update-enterprise.dto.js.map +1 -0
- package/dist/enterprise/enterprise.controller.d.ts +269 -0
- package/dist/enterprise/enterprise.controller.d.ts.map +1 -0
- package/dist/enterprise/enterprise.controller.js +311 -0
- package/dist/enterprise/enterprise.controller.js.map +1 -0
- package/dist/enterprise/enterprise.module.d.ts +3 -0
- package/dist/enterprise/enterprise.module.d.ts.map +1 -0
- package/dist/enterprise/enterprise.module.js +25 -0
- package/dist/enterprise/enterprise.module.js.map +1 -0
- package/dist/enterprise/enterprise.service.d.ts +282 -0
- package/dist/enterprise/enterprise.service.d.ts.map +1 -0
- package/dist/enterprise/enterprise.service.js +627 -0
- package/dist/enterprise/enterprise.service.js.map +1 -0
- package/dist/evaluation/evaluation.controller.d.ts +56 -0
- package/dist/evaluation/evaluation.controller.d.ts.map +1 -0
- package/dist/evaluation/evaluation.controller.js +76 -0
- package/dist/evaluation/evaluation.controller.js.map +1 -0
- package/dist/evaluation/evaluation.module.d.ts +3 -0
- package/dist/evaluation/evaluation.module.d.ts.map +1 -0
- package/dist/evaluation/evaluation.module.js +25 -0
- package/dist/evaluation/evaluation.module.js.map +1 -0
- package/dist/evaluation/evaluation.service.d.ts +67 -0
- package/dist/evaluation/evaluation.service.d.ts.map +1 -0
- package/dist/evaluation/evaluation.service.js +378 -0
- package/dist/evaluation/evaluation.service.js.map +1 -0
- package/dist/exam/dto/create-exam-question.dto.d.ts +25 -0
- package/dist/exam/dto/create-exam-question.dto.d.ts.map +1 -0
- package/dist/exam/dto/create-exam-question.dto.js +117 -0
- package/dist/exam/dto/create-exam-question.dto.js.map +1 -0
- package/dist/exam/dto/create-exam.dto.d.ts +11 -0
- package/dist/exam/dto/create-exam.dto.d.ts.map +1 -0
- package/dist/exam/dto/create-exam.dto.js +63 -0
- package/dist/exam/dto/create-exam.dto.js.map +1 -0
- package/dist/exam/dto/reorder-exam-questions.dto.d.ts +4 -0
- package/dist/exam/dto/reorder-exam-questions.dto.d.ts.map +1 -0
- package/dist/exam/dto/reorder-exam-questions.dto.js +23 -0
- package/dist/exam/dto/reorder-exam-questions.dto.js.map +1 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.d.ts +14 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.d.ts.map +1 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.js +68 -0
- package/dist/exam/dto/save-exam-attempt-answers.dto.js.map +1 -0
- package/dist/exam/dto/start-exam-attempt.dto.d.ts +4 -0
- package/dist/exam/dto/start-exam-attempt.dto.d.ts.map +1 -0
- package/dist/exam/dto/start-exam-attempt.dto.js +23 -0
- package/dist/exam/dto/start-exam-attempt.dto.js.map +1 -0
- package/dist/exam/dto/submit-exam-attempt.dto.d.ts +5 -0
- package/dist/exam/dto/submit-exam-attempt.dto.d.ts.map +1 -0
- package/dist/exam/dto/submit-exam-attempt.dto.js +23 -0
- package/dist/exam/dto/submit-exam-attempt.dto.js.map +1 -0
- package/dist/exam/dto/update-exam-question.dto.d.ts +6 -0
- package/dist/exam/dto/update-exam-question.dto.d.ts.map +1 -0
- package/dist/exam/dto/update-exam-question.dto.js +9 -0
- package/dist/exam/dto/update-exam-question.dto.js.map +1 -0
- package/dist/exam/dto/update-exam.dto.d.ts +6 -0
- package/dist/exam/dto/update-exam.dto.d.ts.map +1 -0
- package/dist/exam/dto/update-exam.dto.js +9 -0
- package/dist/exam/dto/update-exam.dto.js.map +1 -0
- package/dist/exam/exam-attempt.controller.d.ts +273 -0
- package/dist/exam/exam-attempt.controller.d.ts.map +1 -0
- package/dist/exam/exam-attempt.controller.js +84 -0
- package/dist/exam/exam-attempt.controller.js.map +1 -0
- package/dist/exam/exam-attempt.service.d.ts +302 -0
- package/dist/exam/exam-attempt.service.d.ts.map +1 -0
- package/dist/exam/exam-attempt.service.js +776 -0
- package/dist/exam/exam-attempt.service.js.map +1 -0
- package/dist/exam/exam.controller.d.ts +162 -0
- package/dist/exam/exam.controller.d.ts.map +1 -0
- package/dist/exam/exam.controller.js +158 -0
- package/dist/exam/exam.controller.js.map +1 -0
- package/dist/exam/exam.module.d.ts +3 -0
- package/dist/exam/exam.module.d.ts.map +1 -0
- package/dist/exam/exam.module.js +27 -0
- package/dist/exam/exam.module.js.map +1 -0
- package/dist/exam/exam.service.d.ts +179 -0
- package/dist/exam/exam.service.d.ts.map +1 -0
- package/dist/exam/exam.service.js +597 -0
- package/dist/exam/exam.service.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/instructor/dto/create-instructor.dto.d.ts +10 -0
- package/dist/instructor/dto/create-instructor.dto.d.ts.map +1 -0
- package/dist/instructor/dto/create-instructor.dto.js +55 -0
- package/dist/instructor/dto/create-instructor.dto.js.map +1 -0
- package/dist/instructor/dto/update-instructor.dto.d.ts +9 -0
- package/dist/instructor/dto/update-instructor.dto.d.ts.map +1 -0
- package/dist/instructor/dto/update-instructor.dto.js +51 -0
- package/dist/instructor/dto/update-instructor.dto.js.map +1 -0
- package/dist/instructor/instructor.controller.d.ts +52 -0
- package/dist/instructor/instructor.controller.d.ts.map +1 -0
- package/dist/instructor/instructor.controller.js +98 -0
- package/dist/instructor/instructor.controller.js.map +1 -0
- package/dist/instructor/instructor.module.d.ts +3 -0
- package/dist/instructor/instructor.module.d.ts.map +1 -0
- package/dist/instructor/instructor.module.js +25 -0
- package/dist/instructor/instructor.module.js.map +1 -0
- package/dist/instructor/instructor.service.d.ts +79 -0
- package/dist/instructor/instructor.service.d.ts.map +1 -0
- package/dist/instructor/instructor.service.js +528 -0
- package/dist/instructor/instructor.service.js.map +1 -0
- package/dist/lms.module.d.ts.map +1 -1
- package/dist/lms.module.js +36 -4
- package/dist/lms.module.js.map +1 -1
- package/dist/reports/reports.controller.d.ts +69 -0
- package/dist/reports/reports.controller.d.ts.map +1 -0
- package/dist/reports/reports.controller.js +40 -0
- package/dist/reports/reports.controller.js.map +1 -0
- package/dist/reports/reports.module.d.ts +3 -0
- package/dist/reports/reports.module.d.ts.map +1 -0
- package/dist/reports/reports.module.js +25 -0
- package/dist/reports/reports.module.js.map +1 -0
- package/dist/reports/reports.service.d.ts +80 -0
- package/dist/reports/reports.service.d.ts.map +1 -0
- package/dist/reports/reports.service.js +366 -0
- package/dist/reports/reports.service.js.map +1 -0
- package/dist/training/dto/create-training.dto.d.ts +19 -0
- package/dist/training/dto/create-training.dto.d.ts.map +1 -0
- package/dist/training/dto/create-training.dto.js +98 -0
- package/dist/training/dto/create-training.dto.js.map +1 -0
- package/dist/training/dto/update-training.dto.d.ts +6 -0
- package/dist/training/dto/update-training.dto.d.ts.map +1 -0
- package/dist/training/dto/update-training.dto.js +9 -0
- package/dist/training/dto/update-training.dto.js.map +1 -0
- package/dist/training/training.controller.d.ts +195 -0
- package/dist/training/training.controller.d.ts.map +1 -0
- package/dist/training/training.controller.js +104 -0
- package/dist/training/training.controller.js.map +1 -0
- package/dist/training/training.module.d.ts +3 -0
- package/dist/training/training.module.d.ts.map +1 -0
- package/dist/training/training.module.js +25 -0
- package/dist/training/training.module.js.map +1 -0
- package/dist/training/training.service.d.ts +213 -0
- package/dist/training/training.service.d.ts.map +1 -0
- package/dist/training/training.service.js +497 -0
- package/dist/training/training.service.js.map +1 -0
- package/hedhog/data/dashboard.yaml +6 -0
- package/hedhog/data/dashboard_component.yaml +153 -0
- package/hedhog/data/dashboard_component_role.yaml +97 -0
- package/hedhog/data/dashboard_item.yaml +167 -0
- package/hedhog/data/dashboard_role.yaml +6 -0
- package/hedhog/data/instructor_qualification.yaml +16 -0
- package/hedhog/data/menu.yaml +129 -19
- package/hedhog/data/role.yaml +25 -1
- package/hedhog/data/route.yaml +867 -0
- package/hedhog/frontend/app/_components/class-form-sheet.tsx.ejs +1992 -0
- package/hedhog/frontend/app/_components/course-form-sheet.tsx.ejs +480 -0
- package/hedhog/frontend/app/_components/create-lms-instructor-sheet.tsx.ejs +591 -0
- package/hedhog/frontend/app/_components/create-lms-person-sheet.tsx.ejs +164 -0
- package/hedhog/frontend/app/_components/create-lms-student-person-sheet.tsx.ejs +120 -0
- package/hedhog/frontend/app/_components/lms-class-calendar.tsx.ejs +272 -0
- package/hedhog/frontend/app/_components/mobile-calendar.tsx.ejs +277 -0
- package/hedhog/frontend/app/_lib/editor/canvasInstance.ts.ejs +48 -0
- package/hedhog/frontend/app/_lib/editor/pctHelpers.ts.ejs +50 -0
- package/hedhog/frontend/app/_lib/editor/templateSerializer.ts.ejs +268 -0
- package/hedhog/frontend/app/_lib/editor/types.ts.ejs +94 -0
- package/hedhog/frontend/app/_lib/store/useTemplateStore.ts.ejs +284 -0
- package/hedhog/frontend/app/certificates/issued/page.tsx.ejs +638 -0
- package/hedhog/frontend/app/certificates/models/CanvasStage.tsx.ejs +916 -0
- package/hedhog/frontend/app/certificates/models/LeftPanel.tsx.ejs +200 -0
- package/hedhog/frontend/app/certificates/models/RightPanel.tsx.ejs +769 -0
- package/hedhog/frontend/app/certificates/models/TemplateEditorPage.tsx.ejs +104 -0
- package/hedhog/frontend/app/certificates/models/TopBar.tsx.ejs +354 -0
- package/hedhog/frontend/app/certificates/models/editor/page.tsx.ejs +5 -0
- package/hedhog/frontend/app/certificates/models/page.tsx.ejs +883 -0
- package/hedhog/frontend/app/classes/[id]/_components/event-summary-popover.tsx.ejs +279 -0
- package/hedhog/frontend/app/classes/[id]/_components/quick-create-session-popover.tsx.ejs +1027 -0
- package/hedhog/frontend/app/classes/[id]/page.tsx.ejs +3130 -993
- package/hedhog/frontend/app/classes/page.tsx.ejs +2731 -759
- package/hedhog/frontend/app/courses/[id]/_components/CourseCertificateCard.tsx.ejs +80 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseClassificationCard.tsx.ejs +226 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseContentCard.tsx.ejs +71 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseDangerZoneCard.tsx.ejs +42 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseFlagsCard.tsx.ejs +111 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseMainInfoCard.tsx.ejs +113 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseMediaCard.tsx.ejs +215 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseMultiEntityPicker.tsx.ejs +236 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseRelationsCard.tsx.ejs +141 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseSectionCard.tsx.ejs +57 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseSummaryCard.tsx.ejs +60 -0
- package/hedhog/frontend/app/courses/[id]/_components/course-edit-types.ts.ejs +33 -0
- package/hedhog/frontend/app/courses/[id]/page.tsx.ejs +933 -1103
- package/hedhog/frontend/app/courses/[id]/structure/page.tsx.ejs +699 -117
- package/hedhog/frontend/app/courses/page.tsx.ejs +1018 -1042
- package/hedhog/frontend/app/enterprise/[id]/page.tsx.ejs +317 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-activity-panel.tsx.ejs +88 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-admin-create-sheet.tsx.ejs +318 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-administrators-tab.tsx.ejs +332 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-class-create-sheet.tsx.ejs +58 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-classes-tab.tsx.ejs +390 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-company-identity-card.tsx.ejs +112 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-course-create-sheet.tsx.ejs +183 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-courses-tab.tsx.ejs +363 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-detail-constants.ts.ejs +88 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-detail-sheet.tsx.ejs +548 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-detail-utils.ts.ejs +33 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-mocks.ts.ejs +277 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-person-picker.ts.ejs +31 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-progress-bar.tsx.ejs +21 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-related-tab.tsx.ejs +224 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-sheet.tsx.ejs +397 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-student-create-sheet.tsx.ejs +167 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-students-tab.tsx.ejs +267 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-system-user-picker.ts.ejs +42 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-types.ts.ejs +96 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-user-create-sheet.tsx.ejs +207 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-user-distribution-chart.tsx.ejs +149 -0
- package/hedhog/frontend/app/enterprise/page.tsx.ejs +596 -0
- package/hedhog/frontend/app/evaluations/page.tsx.ejs +1250 -0
- package/hedhog/frontend/app/exams/[id]/attempt/page.tsx.ejs +642 -196
- package/hedhog/frontend/app/exams/[id]/page.tsx.ejs +11 -0
- package/hedhog/frontend/app/exams/[id]/questions/page.tsx.ejs +1316 -436
- package/hedhog/frontend/app/exams/page.tsx.ejs +799 -546
- package/hedhog/frontend/app/layout.tsx.ejs +5 -0
- package/hedhog/frontend/app/page.tsx.ejs +3 -1220
- package/hedhog/frontend/app/reports/courses/page.tsx.ejs +843 -0
- package/hedhog/frontend/app/reports/dashboard/page.tsx.ejs +890 -0
- package/hedhog/frontend/app/reports/page.tsx.ejs +802 -808
- package/hedhog/frontend/app/reports/students/page.tsx.ejs +772 -0
- package/hedhog/frontend/app/training/page.tsx.ejs +1873 -628
- package/hedhog/frontend/messages/en.json +1606 -111
- package/hedhog/frontend/messages/pt.json +1636 -134
- package/hedhog/frontend/widgets/active-classes-kpi.tsx.ejs +74 -0
- package/hedhog/frontend/widgets/active-courses-kpi.tsx.ejs +74 -0
- package/hedhog/frontend/widgets/approval-rate-kpi.tsx.ejs +81 -0
- package/hedhog/frontend/widgets/category-distribution-chart.tsx.ejs +119 -0
- package/hedhog/frontend/widgets/class-calendar.tsx.ejs +440 -0
- package/hedhog/frontend/widgets/completion-rate-kpi.tsx.ejs +81 -0
- package/hedhog/frontend/widgets/engagement-chart.tsx.ejs +120 -0
- package/hedhog/frontend/widgets/footer-summary.tsx.ejs +80 -0
- package/hedhog/frontend/widgets/issued-certificates-kpi.tsx.ejs +74 -0
- package/hedhog/frontend/widgets/latest-enrollments.tsx.ejs +166 -0
- package/hedhog/frontend/widgets/student-growth-chart.tsx.ejs +89 -0
- package/hedhog/frontend/widgets/top-courses-chart.tsx.ejs +104 -0
- package/hedhog/frontend/widgets/total-students-kpi.tsx.ejs +78 -0
- package/hedhog/frontend/widgets/upcoming-classes.tsx.ejs +152 -0
- package/hedhog/table/course.yaml +19 -1
- package/hedhog/table/course_class_group.yaml +8 -0
- package/hedhog/table/course_class_session.yaml +33 -0
- package/hedhog/table/course_instructor.yaml +27 -0
- package/hedhog/table/enterprise.yaml +29 -0
- package/hedhog/table/enterprise_class_group.yaml +20 -0
- package/hedhog/table/enterprise_course.yaml +23 -0
- package/hedhog/table/enterprise_student.yaml +24 -0
- package/hedhog/table/enterprise_user.yaml +35 -0
- package/hedhog/table/instructor_qualification.yaml +26 -0
- package/hedhog/table/instructor_qualification_assignment.yaml +22 -0
- package/hedhog/table/question.yaml +6 -0
- package/package.json +6 -6
- package/src/certificate/certificate.controller.ts +83 -0
- package/src/certificate/certificate.module.ts +13 -0
- package/src/certificate/certificate.service.ts +413 -0
- package/src/certificate/dto/create-certificate-template.dto.ts +25 -0
- package/src/certificate/dto/update-certificate-template.dto.ts +6 -0
- package/src/class-group/class-group.controller.ts +189 -0
- package/src/class-group/class-group.module.ts +12 -0
- package/src/class-group/class-group.service.ts +1802 -0
- package/src/class-group/dto/create-class-group.dto.ts +139 -0
- package/src/class-group/dto/create-session.dto.ts +102 -0
- package/src/class-group/dto/enrollment.dto.ts +70 -0
- package/src/class-group/dto/update-class-group.dto.ts +4 -0
- package/src/class-group/dto/update-session.dto.ts +9 -0
- package/src/course/course-structure.controller.ts +85 -0
- package/src/course/course-structure.service.ts +525 -0
- package/src/course/course.controller.ts +69 -0
- package/src/course/course.module.ts +15 -0
- package/src/course/course.service.ts +920 -0
- package/src/course/dto/create-course-structure-lesson.dto.ts +97 -0
- package/src/course/dto/create-course-structure-session.dto.ts +22 -0
- package/src/course/dto/create-course.dto.ts +111 -0
- package/src/course/dto/update-course-structure-lesson.dto.ts +6 -0
- package/src/course/dto/update-course-structure-session.dto.ts +6 -0
- package/src/course/dto/update-course.dto.ts +4 -0
- package/src/dashboard/dashboard.controller.ts +14 -0
- package/src/dashboard/dashboard.module.ts +12 -0
- package/src/dashboard/dashboard.service.ts +726 -0
- package/src/enterprise/dto/add-enterprise-class-group.dto.ts +7 -0
- package/src/enterprise/dto/add-enterprise-course.dto.ts +11 -0
- package/src/enterprise/dto/add-enterprise-student.dto.ts +16 -0
- package/src/enterprise/dto/add-enterprise-user.dto.ts +23 -0
- package/src/enterprise/dto/create-enterprise.dto.ts +41 -0
- package/src/enterprise/dto/update-enterprise-student.dto.ts +7 -0
- package/src/enterprise/dto/update-enterprise-user.dto.ts +11 -0
- package/src/enterprise/dto/update-enterprise.dto.ts +4 -0
- package/src/enterprise/enterprise.controller.ts +233 -0
- package/src/enterprise/enterprise.module.ts +12 -0
- package/src/enterprise/enterprise.service.ts +712 -0
- package/src/evaluation/evaluation.controller.ts +44 -0
- package/src/evaluation/evaluation.module.ts +12 -0
- package/src/evaluation/evaluation.service.ts +394 -0
- package/src/exam/dto/create-exam-question.dto.ts +103 -0
- package/src/exam/dto/create-exam.dto.ts +41 -0
- package/src/exam/dto/reorder-exam-questions.dto.ts +8 -0
- package/src/exam/dto/save-exam-attempt-answers.dto.ts +55 -0
- package/src/exam/dto/start-exam-attempt.dto.ts +8 -0
- package/src/exam/dto/submit-exam-attempt.dto.ts +8 -0
- package/src/exam/dto/update-exam-question.dto.ts +4 -0
- package/src/exam/dto/update-exam.dto.ts +4 -0
- package/src/exam/exam-attempt.controller.ts +65 -0
- package/src/exam/exam-attempt.service.ts +1008 -0
- package/src/exam/exam.controller.ts +102 -0
- package/src/exam/exam.module.ts +14 -0
- package/src/exam/exam.service.ts +784 -0
- package/src/index.ts +29 -0
- package/src/instructor/dto/create-instructor.dto.ts +43 -0
- package/src/instructor/dto/update-instructor.dto.ts +38 -0
- package/src/instructor/instructor.controller.ts +73 -0
- package/src/instructor/instructor.module.ts +12 -0
- package/src/instructor/instructor.service.ts +646 -0
- package/src/lms.module.ts +36 -4
- package/src/reports/reports.controller.ts +14 -0
- package/src/reports/reports.module.ts +12 -0
- package/src/reports/reports.service.ts +485 -0
- package/src/training/dto/create-training.dto.ts +81 -0
- package/src/training/dto/update-training.dto.ts +4 -0
- package/src/training/training.controller.ts +68 -0
- package/src/training/training.module.ts +12 -0
- package/src/training/training.service.ts +574 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
|
|
4
|
+
const MONTH_KEYS = [
|
|
5
|
+
'jan', 'feb', 'mar', 'apr', 'may', 'jun',
|
|
6
|
+
'jul', 'aug', 'sep', 'oct', 'nov', 'dec',
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
const WEEKDAY_KEYS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
|
10
|
+
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class LmsReportsService {
|
|
13
|
+
constructor(private readonly prisma: PrismaService) {}
|
|
14
|
+
|
|
15
|
+
async getReports(period: string) {
|
|
16
|
+
const now = new Date();
|
|
17
|
+
const start = this.periodToStart(period, now);
|
|
18
|
+
const periodMs = now.getTime() - start.getTime();
|
|
19
|
+
const prevStart = new Date(start.getTime() - periodMs);
|
|
20
|
+
|
|
21
|
+
const [
|
|
22
|
+
enrollmentsNow,
|
|
23
|
+
enrollmentsPrev,
|
|
24
|
+
totalStudentsAllTime,
|
|
25
|
+
totalStudentsCurrentPeriod,
|
|
26
|
+
totalStudentsPrevPeriod,
|
|
27
|
+
overallCompletion,
|
|
28
|
+
prevCompletion,
|
|
29
|
+
activeCount,
|
|
30
|
+
completedCount,
|
|
31
|
+
cancelledCount,
|
|
32
|
+
pendingCount,
|
|
33
|
+
allCourses,
|
|
34
|
+
allLearningPaths,
|
|
35
|
+
enrollmentsInPeriod,
|
|
36
|
+
allExamAttempts,
|
|
37
|
+
classSessions,
|
|
38
|
+
weeklyExamAttempts,
|
|
39
|
+
] = await Promise.all([
|
|
40
|
+
// Enrollments in current period
|
|
41
|
+
this.prisma.course_enrollment.count({
|
|
42
|
+
where: { enrolled_at: { gte: start } },
|
|
43
|
+
}),
|
|
44
|
+
// Enrollments in previous period
|
|
45
|
+
this.prisma.course_enrollment.count({
|
|
46
|
+
where: { enrolled_at: { gte: prevStart, lt: start } },
|
|
47
|
+
}),
|
|
48
|
+
// All-time total students
|
|
49
|
+
this.prisma.course_enrollment.groupBy({
|
|
50
|
+
by: ['person_id'],
|
|
51
|
+
}),
|
|
52
|
+
// Unique students in current period
|
|
53
|
+
this.prisma.course_enrollment.groupBy({
|
|
54
|
+
by: ['person_id'],
|
|
55
|
+
where: { enrolled_at: { gte: start } },
|
|
56
|
+
}),
|
|
57
|
+
// Unique students in previous period
|
|
58
|
+
this.prisma.course_enrollment.groupBy({
|
|
59
|
+
by: ['person_id'],
|
|
60
|
+
where: { enrolled_at: { gte: prevStart, lt: start } },
|
|
61
|
+
}),
|
|
62
|
+
// Overall completion rate (all time)
|
|
63
|
+
this.prisma.course_enrollment.aggregate({
|
|
64
|
+
_avg: { progress_percent: true },
|
|
65
|
+
where: { status: { in: ['active', 'completed'] } },
|
|
66
|
+
}),
|
|
67
|
+
// Completion rate in previous period
|
|
68
|
+
this.prisma.course_enrollment.aggregate({
|
|
69
|
+
_avg: { progress_percent: true },
|
|
70
|
+
where: {
|
|
71
|
+
status: { in: ['active', 'completed'] },
|
|
72
|
+
enrolled_at: { gte: prevStart, lt: start },
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
// Status distribution
|
|
76
|
+
this.prisma.course_enrollment.count({ where: { status: 'active' } }),
|
|
77
|
+
this.prisma.course_enrollment.count({ where: { status: 'completed' } }),
|
|
78
|
+
this.prisma.course_enrollment.count({
|
|
79
|
+
where: { status: { in: ['cancelled', 'paused'] } },
|
|
80
|
+
}),
|
|
81
|
+
this.prisma.course_enrollment.count({ where: { status: 'pending' } }),
|
|
82
|
+
// All courses with enrollment data for ranking
|
|
83
|
+
this.prisma.course.findMany({
|
|
84
|
+
include: {
|
|
85
|
+
_count: { select: { course_enrollment: true } },
|
|
86
|
+
course_enrollment: {
|
|
87
|
+
select: { progress_percent: true, final_score: true },
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
orderBy: [{ course_enrollment: { _count: 'desc' } }],
|
|
91
|
+
}),
|
|
92
|
+
// Learning paths with enrollment data for performance cards
|
|
93
|
+
this.prisma.learning_path.findMany({
|
|
94
|
+
where: {
|
|
95
|
+
learning_path_enrollment: { some: {} },
|
|
96
|
+
},
|
|
97
|
+
include: {
|
|
98
|
+
_count: { select: { learning_path_enrollment: true } },
|
|
99
|
+
learning_path_enrollment: { select: { progress_percent: true } },
|
|
100
|
+
},
|
|
101
|
+
orderBy: [{ learning_path_enrollment: { _count: 'desc' } }],
|
|
102
|
+
}),
|
|
103
|
+
// All enrollments in period for monthly chart + performance evolution
|
|
104
|
+
this.prisma.course_enrollment.findMany({
|
|
105
|
+
where: { enrolled_at: { gte: start } },
|
|
106
|
+
select: {
|
|
107
|
+
enrolled_at: true,
|
|
108
|
+
status: true,
|
|
109
|
+
progress_percent: true,
|
|
110
|
+
final_score: true,
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
// Exam attempts for quality indicators
|
|
114
|
+
this.prisma.exam_attempt.findMany({
|
|
115
|
+
where: { status: 'completed', score: { not: null } },
|
|
116
|
+
select: {
|
|
117
|
+
score: true,
|
|
118
|
+
exam: { select: { min_score: true } },
|
|
119
|
+
},
|
|
120
|
+
}),
|
|
121
|
+
// Class sessions for weekly activity
|
|
122
|
+
this.prisma.course_class_session.findMany({
|
|
123
|
+
where: { session_date: { gte: start } },
|
|
124
|
+
select: { session_date: true },
|
|
125
|
+
}),
|
|
126
|
+
// Exam attempts in period for weekly exercises
|
|
127
|
+
this.prisma.exam_attempt.findMany({
|
|
128
|
+
where: {
|
|
129
|
+
status: 'completed',
|
|
130
|
+
finished_at: { gte: start },
|
|
131
|
+
score: { not: null },
|
|
132
|
+
},
|
|
133
|
+
select: { finished_at: true },
|
|
134
|
+
}),
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
// ── KPIs ──────────────────────────────────────────────────────────────────
|
|
138
|
+
|
|
139
|
+
const completionRateNow = Math.round(
|
|
140
|
+
overallCompletion._avg.progress_percent ?? 0,
|
|
141
|
+
);
|
|
142
|
+
const completionRatePrev = Math.round(
|
|
143
|
+
prevCompletion._avg.progress_percent ?? 0,
|
|
144
|
+
);
|
|
145
|
+
const enrollmentChange =
|
|
146
|
+
enrollmentsPrev > 0
|
|
147
|
+
? this.round(
|
|
148
|
+
((enrollmentsNow - enrollmentsPrev) / enrollmentsPrev) * 100,
|
|
149
|
+
1,
|
|
150
|
+
)
|
|
151
|
+
: 0;
|
|
152
|
+
const studentChange =
|
|
153
|
+
totalStudentsPrevPeriod.length > 0
|
|
154
|
+
? this.round(
|
|
155
|
+
((totalStudentsCurrentPeriod.length - totalStudentsPrevPeriod.length) /
|
|
156
|
+
totalStudentsPrevPeriod.length) *
|
|
157
|
+
100,
|
|
158
|
+
1,
|
|
159
|
+
)
|
|
160
|
+
: 0;
|
|
161
|
+
|
|
162
|
+
const kpis = {
|
|
163
|
+
totalStudents: {
|
|
164
|
+
value: totalStudentsAllTime.length,
|
|
165
|
+
change: studentChange,
|
|
166
|
+
positive: studentChange >= 0,
|
|
167
|
+
},
|
|
168
|
+
enrollments: {
|
|
169
|
+
value: enrollmentsNow,
|
|
170
|
+
change: enrollmentChange,
|
|
171
|
+
positive: enrollmentChange >= 0,
|
|
172
|
+
},
|
|
173
|
+
completionRate: {
|
|
174
|
+
value: completionRateNow,
|
|
175
|
+
change: this.round(completionRateNow - completionRatePrev, 1),
|
|
176
|
+
positive: completionRateNow >= completionRatePrev,
|
|
177
|
+
},
|
|
178
|
+
churnRate: {
|
|
179
|
+
value: cancelledCount,
|
|
180
|
+
change: 0,
|
|
181
|
+
positive: false,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// ── Monthly chart data ────────────────────────────────────────────────────
|
|
186
|
+
|
|
187
|
+
const monthlyData = this.buildMonthlyData(enrollmentsInPeriod, period, now);
|
|
188
|
+
|
|
189
|
+
// ── Course ranking ────────────────────────────────────────────────────────
|
|
190
|
+
|
|
191
|
+
const courseRanking = allCourses.map((c) => {
|
|
192
|
+
const progs = c.course_enrollment.map((e) => e.progress_percent ?? 0);
|
|
193
|
+
const finalScores = c.course_enrollment
|
|
194
|
+
.map((e) => e.final_score)
|
|
195
|
+
.filter((score): score is number => score !== null);
|
|
196
|
+
const avgProg =
|
|
197
|
+
progs.length > 0
|
|
198
|
+
? progs.reduce((a, b) => a + b, 0) / progs.length
|
|
199
|
+
: 0;
|
|
200
|
+
const avgFinalScore =
|
|
201
|
+
finalScores.length > 0
|
|
202
|
+
? finalScores.reduce((sum, score) => sum + score, 0) / finalScores.length
|
|
203
|
+
: null;
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
id: c.id,
|
|
207
|
+
nome: c.title,
|
|
208
|
+
alunos: c._count.course_enrollment,
|
|
209
|
+
conclusao: Math.round(avgProg),
|
|
210
|
+
nota: this.resolveScore(avgFinalScore, avgProg),
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// ── Learning path performance ─────────────────────────────────────────────
|
|
215
|
+
|
|
216
|
+
const categoryPerformance = allLearningPaths.map((path) => {
|
|
217
|
+
const progressValues = path.learning_path_enrollment.map(
|
|
218
|
+
(enrollment) => enrollment.progress_percent ?? 0,
|
|
219
|
+
);
|
|
220
|
+
const avgProgress =
|
|
221
|
+
progressValues.length > 0
|
|
222
|
+
? progressValues.reduce((sum, value) => sum + value, 0) /
|
|
223
|
+
progressValues.length
|
|
224
|
+
: 0;
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
area: path.title,
|
|
228
|
+
alunos: path._count.learning_path_enrollment,
|
|
229
|
+
conclusao: Math.round(avgProgress),
|
|
230
|
+
media: this.round(avgProgress / 10, 1),
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// ── Student status distribution (pie) ─────────────────────────────────────
|
|
235
|
+
|
|
236
|
+
const studentStatus = [
|
|
237
|
+
{ nome: 'active', valor: activeCount, cor: '#22c55e' },
|
|
238
|
+
{ nome: 'completed', valor: completedCount, cor: '#3b82f6' },
|
|
239
|
+
{ nome: 'inactive', valor: cancelledCount, cor: '#f97316' },
|
|
240
|
+
...(pendingCount > 0
|
|
241
|
+
? [{ nome: 'pending', valor: pendingCount, cor: '#a855f7' }]
|
|
242
|
+
: []),
|
|
243
|
+
].filter((s) => s.valor > 0);
|
|
244
|
+
|
|
245
|
+
// ── Quality radar ─────────────────────────────────────────────────────────
|
|
246
|
+
|
|
247
|
+
const totalEnrollments =
|
|
248
|
+
activeCount + completedCount + cancelledCount + pendingCount;
|
|
249
|
+
const avgExamScore =
|
|
250
|
+
allExamAttempts.length > 0
|
|
251
|
+
? allExamAttempts.reduce((s, a) => s + Number(a.score ?? 0), 0) /
|
|
252
|
+
allExamAttempts.length
|
|
253
|
+
: 0;
|
|
254
|
+
|
|
255
|
+
const engagementScore = Math.min(completionRateNow, 100);
|
|
256
|
+
const completionScore =
|
|
257
|
+
totalEnrollments > 0
|
|
258
|
+
? Math.round((completedCount / totalEnrollments) * 100)
|
|
259
|
+
: 0;
|
|
260
|
+
const retentionScore =
|
|
261
|
+
totalEnrollments > 0
|
|
262
|
+
? Math.round(
|
|
263
|
+
((totalEnrollments - cancelledCount) / totalEnrollments) * 100,
|
|
264
|
+
)
|
|
265
|
+
: 100;
|
|
266
|
+
const performanceScore = Math.min(Math.round(avgExamScore), 100);
|
|
267
|
+
const satisfactionScore = Math.min(
|
|
268
|
+
Math.max(performanceScore, retentionScore - 5),
|
|
269
|
+
100,
|
|
270
|
+
);
|
|
271
|
+
const recommendationScore = Math.min(
|
|
272
|
+
Math.round((retentionScore + completionScore) / 2),
|
|
273
|
+
100,
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
const radarData = [
|
|
277
|
+
{ subject: 'engagement', A: engagementScore, fullMark: 100 },
|
|
278
|
+
{ subject: 'completion', A: completionScore, fullMark: 100 },
|
|
279
|
+
{ subject: 'satisfaction', A: satisfactionScore, fullMark: 100 },
|
|
280
|
+
{ subject: 'recommendation', A: recommendationScore, fullMark: 100 },
|
|
281
|
+
{ subject: 'retention', A: retentionScore, fullMark: 100 },
|
|
282
|
+
{ subject: 'performance', A: performanceScore, fullMark: 100 },
|
|
283
|
+
];
|
|
284
|
+
|
|
285
|
+
// ── Weekly activity ───────────────────────────────────────────────────────
|
|
286
|
+
|
|
287
|
+
const weeklyActivity = this.buildWeeklyActivity(
|
|
288
|
+
enrollmentsInPeriod,
|
|
289
|
+
classSessions,
|
|
290
|
+
weeklyExamAttempts,
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
// ── Performance evolution (monthly) ──────────────────────────────────────
|
|
294
|
+
|
|
295
|
+
const performanceEvolution = this.buildPerformanceEvolution(
|
|
296
|
+
enrollmentsInPeriod,
|
|
297
|
+
period,
|
|
298
|
+
now,
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
return {
|
|
302
|
+
kpis,
|
|
303
|
+
monthlyData,
|
|
304
|
+
courseRanking,
|
|
305
|
+
categoryPerformance,
|
|
306
|
+
studentStatus,
|
|
307
|
+
radarData,
|
|
308
|
+
weeklyActivity,
|
|
309
|
+
performanceEvolution,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ── Private helpers ─────────────────────────────────────────────────────────
|
|
314
|
+
|
|
315
|
+
private buildMonthlyData(
|
|
316
|
+
enrollments: Array<{
|
|
317
|
+
enrolled_at: Date;
|
|
318
|
+
status: string | null;
|
|
319
|
+
progress_percent: number | null;
|
|
320
|
+
final_score: number | null;
|
|
321
|
+
}>,
|
|
322
|
+
period: string,
|
|
323
|
+
now: Date,
|
|
324
|
+
) {
|
|
325
|
+
const monthCount = this.periodToMonthCount(period);
|
|
326
|
+
const result: Array<{
|
|
327
|
+
mes: string;
|
|
328
|
+
matriculas: number;
|
|
329
|
+
cancelamentos: number;
|
|
330
|
+
receita: number;
|
|
331
|
+
}> = [];
|
|
332
|
+
|
|
333
|
+
for (let i = monthCount - 1; i >= 0; i--) {
|
|
334
|
+
const monthDate = this.addMonths(now, -i);
|
|
335
|
+
const monthStart = this.startOfMonth(monthDate);
|
|
336
|
+
const monthEnd = this.endOfMonth(monthDate);
|
|
337
|
+
const monthKey = MONTH_KEYS[monthDate.getMonth()];
|
|
338
|
+
|
|
339
|
+
const inMonth = enrollments.filter((e) => {
|
|
340
|
+
const d = new Date(e.enrolled_at);
|
|
341
|
+
return d >= monthStart && d <= monthEnd;
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
result.push({
|
|
345
|
+
mes: monthKey,
|
|
346
|
+
matriculas: inMonth.length,
|
|
347
|
+
cancelamentos: 0,
|
|
348
|
+
receita: 0,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
private buildWeeklyActivity(
|
|
356
|
+
enrollments: Array<{ enrolled_at: Date }>,
|
|
357
|
+
classSessions: Array<{ session_date: Date }>,
|
|
358
|
+
examAttempts: Array<{ finished_at: Date | null }>,
|
|
359
|
+
) {
|
|
360
|
+
const counts = Array.from({ length: 7 }, (_, i) => ({
|
|
361
|
+
dia: WEEKDAY_KEYS[i],
|
|
362
|
+
acessos: 0,
|
|
363
|
+
aulas: 0,
|
|
364
|
+
exercicios: 0,
|
|
365
|
+
}));
|
|
366
|
+
|
|
367
|
+
for (const e of enrollments) {
|
|
368
|
+
counts[new Date(e.enrolled_at).getDay()].acessos++;
|
|
369
|
+
}
|
|
370
|
+
for (const s of classSessions) {
|
|
371
|
+
counts[new Date(s.session_date).getDay()].aulas++;
|
|
372
|
+
}
|
|
373
|
+
for (const a of examAttempts) {
|
|
374
|
+
if (a.finished_at) {
|
|
375
|
+
counts[new Date(a.finished_at).getDay()].exercicios++;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Mon → Sun order
|
|
380
|
+
return [1, 2, 3, 4, 5, 6, 0].map((d) => counts[d]);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private buildPerformanceEvolution(
|
|
384
|
+
enrollments: Array<{
|
|
385
|
+
enrolled_at: Date;
|
|
386
|
+
progress_percent: number | null;
|
|
387
|
+
final_score: number | null;
|
|
388
|
+
}>,
|
|
389
|
+
period: string,
|
|
390
|
+
now: Date,
|
|
391
|
+
) {
|
|
392
|
+
const monthCount = this.periodToMonthCount(period);
|
|
393
|
+
const result: Array<{ mes: string; nota: number }> = [];
|
|
394
|
+
|
|
395
|
+
for (let i = monthCount - 1; i >= 0; i--) {
|
|
396
|
+
const monthDate = this.addMonths(now, -i);
|
|
397
|
+
const monthStart = this.startOfMonth(monthDate);
|
|
398
|
+
const monthEnd = this.endOfMonth(monthDate);
|
|
399
|
+
const monthKey = MONTH_KEYS[monthDate.getMonth()];
|
|
400
|
+
|
|
401
|
+
const inMonth = enrollments.filter((e) => {
|
|
402
|
+
const d = new Date(e.enrolled_at);
|
|
403
|
+
return d >= monthStart && d <= monthEnd;
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
const progressAvg =
|
|
407
|
+
inMonth.length > 0
|
|
408
|
+
? inMonth.reduce((sum, enrollment) => {
|
|
409
|
+
return sum + (enrollment.progress_percent ?? 0);
|
|
410
|
+
}, 0) / inMonth.length
|
|
411
|
+
: 0;
|
|
412
|
+
const finalScores = inMonth
|
|
413
|
+
.map((enrollment) => enrollment.final_score)
|
|
414
|
+
.filter((score): score is number => score !== null);
|
|
415
|
+
const finalScoreAvg =
|
|
416
|
+
finalScores.length > 0
|
|
417
|
+
? finalScores.reduce((sum, score) => sum + score, 0) / finalScores.length
|
|
418
|
+
: null;
|
|
419
|
+
|
|
420
|
+
result.push({
|
|
421
|
+
mes: monthKey,
|
|
422
|
+
nota: this.resolveScore(finalScoreAvg, progressAvg),
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return result;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
private resolveScore(
|
|
430
|
+
finalScoreAverage: number | null,
|
|
431
|
+
progressAverage: number,
|
|
432
|
+
): number {
|
|
433
|
+
if (finalScoreAverage !== null) {
|
|
434
|
+
return this.round(finalScoreAverage / 10, 1);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return this.round(progressAverage / 10, 1);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
private periodToStart(period: string, now: Date): Date {
|
|
441
|
+
if (period === '7d') return this.addDays(now, -7);
|
|
442
|
+
if (period === '30d') return this.addDays(now, -30);
|
|
443
|
+
if (period === '6m') return this.addMonths(now, -6);
|
|
444
|
+
return this.addMonths(now, -12);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
private periodToMonthCount(period: string): number {
|
|
448
|
+
if (period === '7d' || period === '30d') return 1;
|
|
449
|
+
if (period === '6m') return 6;
|
|
450
|
+
return 12;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
private addDays(date: Date, days: number): Date {
|
|
454
|
+
const d = new Date(date);
|
|
455
|
+
d.setDate(d.getDate() + days);
|
|
456
|
+
return d;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
private addMonths(date: Date, months: number): Date {
|
|
460
|
+
const d = new Date(date);
|
|
461
|
+
d.setMonth(d.getMonth() + months);
|
|
462
|
+
return d;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
private startOfMonth(date: Date): Date {
|
|
466
|
+
return new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0, 0);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
private endOfMonth(date: Date): Date {
|
|
470
|
+
return new Date(
|
|
471
|
+
date.getFullYear(),
|
|
472
|
+
date.getMonth() + 1,
|
|
473
|
+
0,
|
|
474
|
+
23,
|
|
475
|
+
59,
|
|
476
|
+
59,
|
|
477
|
+
999,
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
private round(value: number, decimals: number): number {
|
|
482
|
+
const factor = Math.pow(10, decimals);
|
|
483
|
+
return Math.round(value * factor) / factor;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Type } from 'class-transformer';
|
|
2
|
+
import {
|
|
3
|
+
IsArray,
|
|
4
|
+
IsBoolean,
|
|
5
|
+
IsEnum,
|
|
6
|
+
IsIn,
|
|
7
|
+
IsInt,
|
|
8
|
+
IsNotEmpty,
|
|
9
|
+
IsOptional,
|
|
10
|
+
IsString,
|
|
11
|
+
MaxLength,
|
|
12
|
+
Min,
|
|
13
|
+
ValidateNested,
|
|
14
|
+
} from 'class-validator';
|
|
15
|
+
|
|
16
|
+
export class LearningPathItemDto {
|
|
17
|
+
@IsIn(['course', 'exam'])
|
|
18
|
+
type: 'course' | 'exam';
|
|
19
|
+
|
|
20
|
+
@IsInt()
|
|
21
|
+
@Min(1)
|
|
22
|
+
itemId: number;
|
|
23
|
+
|
|
24
|
+
@IsInt()
|
|
25
|
+
@Min(0)
|
|
26
|
+
@IsOptional()
|
|
27
|
+
order?: number;
|
|
28
|
+
|
|
29
|
+
@IsBoolean()
|
|
30
|
+
@IsOptional()
|
|
31
|
+
isRequired?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class CreateTrainingDto {
|
|
35
|
+
@IsString()
|
|
36
|
+
@IsNotEmpty()
|
|
37
|
+
@MaxLength(255)
|
|
38
|
+
title: string;
|
|
39
|
+
|
|
40
|
+
@IsString()
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@MaxLength(255)
|
|
43
|
+
slug?: string;
|
|
44
|
+
|
|
45
|
+
@IsString()
|
|
46
|
+
@IsOptional()
|
|
47
|
+
description?: string;
|
|
48
|
+
|
|
49
|
+
@IsString()
|
|
50
|
+
@IsOptional()
|
|
51
|
+
shortDescription?: string;
|
|
52
|
+
|
|
53
|
+
@IsEnum(['beginner', 'intermediate', 'advanced'])
|
|
54
|
+
@IsOptional()
|
|
55
|
+
level?: 'beginner' | 'intermediate' | 'advanced';
|
|
56
|
+
|
|
57
|
+
@IsEnum(['draft', 'active', 'archived'])
|
|
58
|
+
@IsOptional()
|
|
59
|
+
status?: 'draft' | 'active' | 'archived';
|
|
60
|
+
|
|
61
|
+
@IsArray()
|
|
62
|
+
@IsInt({ each: true })
|
|
63
|
+
@IsOptional()
|
|
64
|
+
courseIds?: number[];
|
|
65
|
+
|
|
66
|
+
@IsArray()
|
|
67
|
+
@ValidateNested({ each: true })
|
|
68
|
+
@Type(() => LearningPathItemDto)
|
|
69
|
+
@IsOptional()
|
|
70
|
+
items?: LearningPathItemDto[];
|
|
71
|
+
|
|
72
|
+
@IsString()
|
|
73
|
+
@IsOptional()
|
|
74
|
+
@MaxLength(32)
|
|
75
|
+
primaryColor?: string;
|
|
76
|
+
|
|
77
|
+
@IsString()
|
|
78
|
+
@IsOptional()
|
|
79
|
+
@MaxLength(32)
|
|
80
|
+
secondaryColor?: string;
|
|
81
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import {
|
|
3
|
+
Body,
|
|
4
|
+
Controller,
|
|
5
|
+
Delete,
|
|
6
|
+
Get,
|
|
7
|
+
Param,
|
|
8
|
+
ParseIntPipe,
|
|
9
|
+
Patch,
|
|
10
|
+
Post,
|
|
11
|
+
Query,
|
|
12
|
+
} from '@nestjs/common';
|
|
13
|
+
import { CreateTrainingDto } from './dto/create-training.dto';
|
|
14
|
+
import { UpdateTrainingDto } from './dto/update-training.dto';
|
|
15
|
+
import { TrainingService } from './training.service';
|
|
16
|
+
|
|
17
|
+
@Role()
|
|
18
|
+
@Controller('lms/training')
|
|
19
|
+
export class TrainingController {
|
|
20
|
+
constructor(private readonly trainingService: TrainingService) {}
|
|
21
|
+
|
|
22
|
+
@Get()
|
|
23
|
+
list(
|
|
24
|
+
@Query('page') page?: string,
|
|
25
|
+
@Query('pageSize') pageSize?: string,
|
|
26
|
+
@Query('search') search?: string,
|
|
27
|
+
@Query('status') status?: string,
|
|
28
|
+
@Query('level') level?: string,
|
|
29
|
+
@Query('area') area?: string,
|
|
30
|
+
) {
|
|
31
|
+
return this.trainingService.list({
|
|
32
|
+
page: page ? Number(page) : 1,
|
|
33
|
+
pageSize: pageSize ? Number(pageSize) : 12,
|
|
34
|
+
search,
|
|
35
|
+
status,
|
|
36
|
+
level,
|
|
37
|
+
area,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Get('stats')
|
|
42
|
+
stats() {
|
|
43
|
+
return this.trainingService.stats();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Get(':id')
|
|
47
|
+
getById(@Param('id', ParseIntPipe) id: number) {
|
|
48
|
+
return this.trainingService.getById(id);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Post()
|
|
52
|
+
create(@Body() dto: CreateTrainingDto) {
|
|
53
|
+
return this.trainingService.create(dto);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Patch(':id')
|
|
57
|
+
update(
|
|
58
|
+
@Param('id', ParseIntPipe) id: number,
|
|
59
|
+
@Body() dto: UpdateTrainingDto,
|
|
60
|
+
) {
|
|
61
|
+
return this.trainingService.update(id, dto);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Delete(':id')
|
|
65
|
+
remove(@Param('id', ParseIntPipe) id: number) {
|
|
66
|
+
return this.trainingService.remove(id);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PrismaModule } from '@hed-hog/api-prisma';
|
|
2
|
+
import { forwardRef, Module } from '@nestjs/common';
|
|
3
|
+
import { TrainingController } from './training.controller';
|
|
4
|
+
import { TrainingService } from './training.service';
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
imports: [forwardRef(() => PrismaModule)],
|
|
8
|
+
controllers: [TrainingController],
|
|
9
|
+
providers: [TrainingService],
|
|
10
|
+
exports: [forwardRef(() => TrainingService)],
|
|
11
|
+
})
|
|
12
|
+
export class TrainingModule {}
|