@hed-hog/lms 0.0.303 → 0.0.305
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-lead.dto.d.ts +4 -0
- package/dist/enterprise/dto/add-enterprise-lead.dto.d.ts.map +1 -0
- package/dist/enterprise/dto/add-enterprise-lead.dto.js +22 -0
- package/dist/enterprise/dto/add-enterprise-lead.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 +57 -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 +266 -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 +187 -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 +5 -1222
- 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 +28 -10
- 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,574 @@
|
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import { CreateTrainingDto, LearningPathItemDto } from './dto/create-training.dto';
|
|
4
|
+
import { UpdateTrainingDto } from './dto/update-training.dto';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class TrainingService {
|
|
8
|
+
constructor(private readonly prisma: PrismaService) {}
|
|
9
|
+
|
|
10
|
+
async list(params: {
|
|
11
|
+
page?: number;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
search?: string;
|
|
14
|
+
status?: string;
|
|
15
|
+
level?: string;
|
|
16
|
+
area?: string;
|
|
17
|
+
}) {
|
|
18
|
+
const page = Math.max(Number(params.page) || 1, 1);
|
|
19
|
+
const pageSize = Math.max(Number(params.pageSize) || 12, 1);
|
|
20
|
+
const skip = (page - 1) * pageSize;
|
|
21
|
+
|
|
22
|
+
const where: any = {};
|
|
23
|
+
|
|
24
|
+
const normalizedStatus = this.normalizeStatus(params.status);
|
|
25
|
+
if (normalizedStatus) {
|
|
26
|
+
where.status = normalizedStatus;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const normalizedLevel = this.normalizeLevel(params.level);
|
|
30
|
+
if (normalizedLevel) {
|
|
31
|
+
where.level = normalizedLevel;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (params.search?.trim()) {
|
|
35
|
+
const search = params.search.trim();
|
|
36
|
+
where.OR = [
|
|
37
|
+
{ title: { contains: search, mode: 'insensitive' } },
|
|
38
|
+
{ slug: { contains: search, mode: 'insensitive' } },
|
|
39
|
+
{ description: { contains: search, mode: 'insensitive' } },
|
|
40
|
+
{ short_description: { contains: search, mode: 'insensitive' } },
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const areaSlugs = this.areaToCategorySlugs(params.area);
|
|
45
|
+
if (areaSlugs.length > 0) {
|
|
46
|
+
where.learning_path_step = {
|
|
47
|
+
some: {
|
|
48
|
+
step_type: 'course',
|
|
49
|
+
course: {
|
|
50
|
+
course_category: {
|
|
51
|
+
some: {
|
|
52
|
+
category: {
|
|
53
|
+
slug: {
|
|
54
|
+
in: areaSlugs,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const [paths, total] = await Promise.all([
|
|
65
|
+
this.prisma.learning_path.findMany({
|
|
66
|
+
skip,
|
|
67
|
+
take: pageSize,
|
|
68
|
+
where,
|
|
69
|
+
orderBy: { created_at: 'desc' },
|
|
70
|
+
include: {
|
|
71
|
+
learning_path_step: {
|
|
72
|
+
orderBy: { order: 'asc' },
|
|
73
|
+
include: {
|
|
74
|
+
course: {
|
|
75
|
+
select: {
|
|
76
|
+
id: true,
|
|
77
|
+
title: true,
|
|
78
|
+
duration_hours: true,
|
|
79
|
+
course_category: {
|
|
80
|
+
include: {
|
|
81
|
+
category: {
|
|
82
|
+
select: { slug: true },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
exam: {
|
|
89
|
+
select: {
|
|
90
|
+
id: true,
|
|
91
|
+
title: true,
|
|
92
|
+
time_limit_minutes: true,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
_count: {
|
|
98
|
+
select: {
|
|
99
|
+
learning_path_enrollment: true,
|
|
100
|
+
learning_path_step: true,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
this.prisma.learning_path.count({ where }),
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
total,
|
|
110
|
+
page,
|
|
111
|
+
pageSize,
|
|
112
|
+
lastPage: Math.max(1, Math.ceil(total / pageSize)),
|
|
113
|
+
data: paths.map((path) => this.mapTraining(path)),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async stats() {
|
|
118
|
+
const [totalTraining, activeTraining, enrolledStudents, coveredCourses] =
|
|
119
|
+
await Promise.all([
|
|
120
|
+
this.prisma.learning_path.count(),
|
|
121
|
+
this.prisma.learning_path.count({ where: { status: 'active' } }),
|
|
122
|
+
this.prisma.learning_path_enrollment.count(),
|
|
123
|
+
this.prisma.learning_path_step.groupBy({
|
|
124
|
+
by: ['course_id'],
|
|
125
|
+
where: { course_id: { not: null } },
|
|
126
|
+
}),
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
totalTraining,
|
|
131
|
+
activeTraining,
|
|
132
|
+
enrolledStudents,
|
|
133
|
+
coveredCourses: coveredCourses.length,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async getById(id: number) {
|
|
138
|
+
const path = await this.prisma.learning_path.findUnique({
|
|
139
|
+
where: { id },
|
|
140
|
+
include: {
|
|
141
|
+
learning_path_step: {
|
|
142
|
+
orderBy: { order: 'asc' },
|
|
143
|
+
include: {
|
|
144
|
+
course: {
|
|
145
|
+
select: {
|
|
146
|
+
id: true,
|
|
147
|
+
title: true,
|
|
148
|
+
duration_hours: true,
|
|
149
|
+
course_category: {
|
|
150
|
+
include: {
|
|
151
|
+
category: {
|
|
152
|
+
select: { slug: true },
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
exam: {
|
|
159
|
+
select: {
|
|
160
|
+
id: true,
|
|
161
|
+
title: true,
|
|
162
|
+
time_limit_minutes: true,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
_count: {
|
|
168
|
+
select: {
|
|
169
|
+
learning_path_enrollment: true,
|
|
170
|
+
learning_path_step: true,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (!path) return null;
|
|
177
|
+
return this.mapTraining(path);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async create(dto: CreateTrainingDto) {
|
|
181
|
+
const slug = dto.slug?.trim() || this.slugify(dto.title);
|
|
182
|
+
const stepItems = this.resolveIncomingSteps(dto);
|
|
183
|
+
const normalizedLevel = this.normalizeLevel(dto.level) ?? 'beginner';
|
|
184
|
+
const normalizedStatus = this.normalizeStatus(dto.status) ?? 'draft';
|
|
185
|
+
|
|
186
|
+
const created = await this.prisma.learning_path.create({
|
|
187
|
+
data: {
|
|
188
|
+
title: dto.title,
|
|
189
|
+
slug,
|
|
190
|
+
description: dto.description,
|
|
191
|
+
short_description: dto.shortDescription,
|
|
192
|
+
level: normalizedLevel,
|
|
193
|
+
status: normalizedStatus,
|
|
194
|
+
...(dto.primaryColor !== undefined && { primary_color: dto.primaryColor }),
|
|
195
|
+
...(dto.secondaryColor !== undefined && { secondary_color: dto.secondaryColor }),
|
|
196
|
+
...(stepItems.length > 0 && {
|
|
197
|
+
learning_path_step: {
|
|
198
|
+
create: stepItems.map((item, index) =>
|
|
199
|
+
this.toLearningPathCreateStep(item, index),
|
|
200
|
+
),
|
|
201
|
+
},
|
|
202
|
+
}),
|
|
203
|
+
},
|
|
204
|
+
include: {
|
|
205
|
+
learning_path_step: {
|
|
206
|
+
orderBy: { order: 'asc' },
|
|
207
|
+
include: {
|
|
208
|
+
course: {
|
|
209
|
+
select: {
|
|
210
|
+
id: true,
|
|
211
|
+
title: true,
|
|
212
|
+
duration_hours: true,
|
|
213
|
+
course_category: {
|
|
214
|
+
include: {
|
|
215
|
+
category: {
|
|
216
|
+
select: { slug: true },
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
exam: {
|
|
223
|
+
select: {
|
|
224
|
+
id: true,
|
|
225
|
+
title: true,
|
|
226
|
+
time_limit_minutes: true,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
_count: {
|
|
232
|
+
select: {
|
|
233
|
+
learning_path_enrollment: true,
|
|
234
|
+
learning_path_step: true,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
return this.mapTraining(created);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async update(id: number, dto: UpdateTrainingDto) {
|
|
244
|
+
const stepItems = this.resolveIncomingSteps(dto);
|
|
245
|
+
const stepsWereProvided = dto.items !== undefined || dto.courseIds !== undefined;
|
|
246
|
+
const normalizedLevel =
|
|
247
|
+
dto.level !== undefined ? this.normalizeLevel(dto.level) : undefined;
|
|
248
|
+
const normalizedStatus =
|
|
249
|
+
dto.status !== undefined ? this.normalizeStatus(dto.status) : undefined;
|
|
250
|
+
|
|
251
|
+
if (stepsWereProvided) {
|
|
252
|
+
await this.prisma.learning_path_step.deleteMany({
|
|
253
|
+
where: {
|
|
254
|
+
learning_path_id: id,
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const updated = await this.prisma.learning_path.update({
|
|
260
|
+
where: { id },
|
|
261
|
+
data: {
|
|
262
|
+
...(dto.title !== undefined && { title: dto.title }),
|
|
263
|
+
...(dto.slug !== undefined && { slug: dto.slug || this.slugify(dto.title ?? '') }),
|
|
264
|
+
...(dto.description !== undefined && { description: dto.description }),
|
|
265
|
+
...(dto.shortDescription !== undefined && {
|
|
266
|
+
short_description: dto.shortDescription,
|
|
267
|
+
}),
|
|
268
|
+
...(normalizedLevel !== undefined && { level: normalizedLevel }),
|
|
269
|
+
...(normalizedStatus !== undefined && { status: normalizedStatus }),
|
|
270
|
+
...(dto.primaryColor !== undefined && { primary_color: dto.primaryColor }),
|
|
271
|
+
...(dto.secondaryColor !== undefined && { secondary_color: dto.secondaryColor }),
|
|
272
|
+
...(stepsWereProvided &&
|
|
273
|
+
stepItems.length > 0 && {
|
|
274
|
+
learning_path_step: {
|
|
275
|
+
create: stepItems.map((item, index) =>
|
|
276
|
+
this.toLearningPathCreateStep(item, index),
|
|
277
|
+
),
|
|
278
|
+
},
|
|
279
|
+
}),
|
|
280
|
+
},
|
|
281
|
+
include: {
|
|
282
|
+
learning_path_step: {
|
|
283
|
+
orderBy: { order: 'asc' },
|
|
284
|
+
include: {
|
|
285
|
+
course: {
|
|
286
|
+
select: {
|
|
287
|
+
id: true,
|
|
288
|
+
title: true,
|
|
289
|
+
duration_hours: true,
|
|
290
|
+
course_category: {
|
|
291
|
+
include: {
|
|
292
|
+
category: {
|
|
293
|
+
select: { slug: true },
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
exam: {
|
|
300
|
+
select: {
|
|
301
|
+
id: true,
|
|
302
|
+
title: true,
|
|
303
|
+
time_limit_minutes: true,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
_count: {
|
|
309
|
+
select: {
|
|
310
|
+
learning_path_enrollment: true,
|
|
311
|
+
learning_path_step: true,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
return this.mapTraining(updated);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
async remove(id: number) {
|
|
321
|
+
await this.prisma.learning_path.delete({ where: { id } });
|
|
322
|
+
return { success: true };
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
private mapTraining(path: any) {
|
|
326
|
+
const steps = [...(path.learning_path_step ?? [])].sort(
|
|
327
|
+
(a: any, b: any) => (a?.order ?? 0) - (b?.order ?? 0),
|
|
328
|
+
);
|
|
329
|
+
const courseSteps = steps.filter((step: any) => step?.course);
|
|
330
|
+
const examSteps = steps.filter((step: any) => step?.exam);
|
|
331
|
+
|
|
332
|
+
const courses = courseSteps.map((step: any) => step.course.title);
|
|
333
|
+
const exams = examSteps.map((step: any) => step.exam.title);
|
|
334
|
+
const courseIds = courseSteps.map((step: any) => step.course.id);
|
|
335
|
+
const examIds = examSteps.map((step: any) => step.exam.id);
|
|
336
|
+
const cargaTotal = courseSteps.reduce(
|
|
337
|
+
(sum: number, step: any) => sum + (step.course?.duration_hours ?? 0),
|
|
338
|
+
0,
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const firstCategorySlug = steps
|
|
342
|
+
.flatMap((step: any) => step.course?.course_category ?? [])
|
|
343
|
+
.map((item: any) => item.category?.slug)
|
|
344
|
+
.find(Boolean);
|
|
345
|
+
|
|
346
|
+
const items = steps
|
|
347
|
+
.map((step: any, index: number) => {
|
|
348
|
+
if (step?.course) {
|
|
349
|
+
return {
|
|
350
|
+
id: step.id,
|
|
351
|
+
type: 'course' as const,
|
|
352
|
+
itemId: step.course.id,
|
|
353
|
+
title: step.course.title,
|
|
354
|
+
durationHours: step.course.duration_hours ?? 0,
|
|
355
|
+
order: step.order ?? index,
|
|
356
|
+
isRequired: step.is_required !== false,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (step?.exam) {
|
|
361
|
+
return {
|
|
362
|
+
id: step.id,
|
|
363
|
+
type: 'exam' as const,
|
|
364
|
+
itemId: step.exam.id,
|
|
365
|
+
title: step.exam.title,
|
|
366
|
+
durationMinutes: step.exam.time_limit_minutes ?? 0,
|
|
367
|
+
order: step.order ?? index,
|
|
368
|
+
isRequired: step.is_required !== false,
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return null;
|
|
373
|
+
})
|
|
374
|
+
.filter(Boolean);
|
|
375
|
+
|
|
376
|
+
return {
|
|
377
|
+
id: path.id,
|
|
378
|
+
nome: path.title,
|
|
379
|
+
descricao: path.description ?? path.short_description ?? '',
|
|
380
|
+
area: this.slugToArea(firstCategorySlug),
|
|
381
|
+
nivel: this.levelToPt(path.level),
|
|
382
|
+
prerequisitos: path.short_description ?? '',
|
|
383
|
+
cursos: courses,
|
|
384
|
+
exams,
|
|
385
|
+
courseIds,
|
|
386
|
+
examIds,
|
|
387
|
+
items,
|
|
388
|
+
cargaTotal,
|
|
389
|
+
alunos: path._count?.learning_path_enrollment ?? 0,
|
|
390
|
+
status: this.statusToPt(path.status),
|
|
391
|
+
criadoEm: path.created_at,
|
|
392
|
+
primaryColor: path.primary_color ?? undefined,
|
|
393
|
+
secondaryColor: path.secondary_color ?? undefined,
|
|
394
|
+
code: this.idToCode(path.id),
|
|
395
|
+
slug: path.slug,
|
|
396
|
+
level: path.level,
|
|
397
|
+
statusRaw: path.status,
|
|
398
|
+
students: path._count?.learning_path_enrollment ?? 0,
|
|
399
|
+
createdAt: path.created_at,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
private resolveIncomingSteps(dto: {
|
|
404
|
+
items?: LearningPathItemDto[];
|
|
405
|
+
courseIds?: number[];
|
|
406
|
+
}) {
|
|
407
|
+
if (dto.items !== undefined) {
|
|
408
|
+
const normalized = dto.items
|
|
409
|
+
.map((item, index) => ({
|
|
410
|
+
type: item.type,
|
|
411
|
+
itemId: Number(item.itemId),
|
|
412
|
+
order: Number.isFinite(item.order) ? Number(item.order) : index,
|
|
413
|
+
isRequired: item.isRequired !== false,
|
|
414
|
+
}))
|
|
415
|
+
.filter(
|
|
416
|
+
(item) =>
|
|
417
|
+
(item.type === 'course' || item.type === 'exam') &&
|
|
418
|
+
Number.isFinite(item.itemId) &&
|
|
419
|
+
item.itemId > 0,
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
const uniqueByPair = new Map<string, (typeof normalized)[number]>();
|
|
423
|
+
normalized.forEach((item) => {
|
|
424
|
+
uniqueByPair.set(`${item.type}:${item.itemId}`, item);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
return Array.from(uniqueByPair.values()).sort(
|
|
428
|
+
(a, b) => a.order - b.order,
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
const courseIds = [...new Set(dto.courseIds ?? [])].filter(
|
|
433
|
+
(courseId) => Number.isFinite(courseId) && courseId > 0,
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
return courseIds.map((courseId, index) => ({
|
|
437
|
+
type: 'course' as const,
|
|
438
|
+
itemId: courseId,
|
|
439
|
+
order: index,
|
|
440
|
+
isRequired: true,
|
|
441
|
+
}));
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
private toLearningPathCreateStep(
|
|
445
|
+
item: {
|
|
446
|
+
type: 'course' | 'exam';
|
|
447
|
+
itemId: number;
|
|
448
|
+
order: number;
|
|
449
|
+
isRequired: boolean;
|
|
450
|
+
},
|
|
451
|
+
fallbackOrder: number,
|
|
452
|
+
) {
|
|
453
|
+
return {
|
|
454
|
+
step_type: item.type,
|
|
455
|
+
course_id: item.type === 'course' ? item.itemId : null,
|
|
456
|
+
exam_id: item.type === 'exam' ? item.itemId : null,
|
|
457
|
+
order: Number.isFinite(item.order) ? item.order : fallbackOrder,
|
|
458
|
+
is_required: item.isRequired,
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
private normalizeStatus(value?: string) {
|
|
463
|
+
if (!value) return undefined;
|
|
464
|
+
const normalized = value.trim().toLowerCase();
|
|
465
|
+
|
|
466
|
+
if (normalized === 'ativa' || normalized === 'active') return 'active';
|
|
467
|
+
if (normalized === 'rascunho' || normalized === 'draft') return 'draft';
|
|
468
|
+
if (normalized === 'encerrada' || normalized === 'archived') {
|
|
469
|
+
return 'archived';
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return undefined;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
private normalizeLevel(value?: string) {
|
|
476
|
+
if (!value) return undefined;
|
|
477
|
+
const normalized = value
|
|
478
|
+
.trim()
|
|
479
|
+
.toLowerCase()
|
|
480
|
+
.normalize('NFD')
|
|
481
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
482
|
+
|
|
483
|
+
if (normalized === 'iniciante' || normalized === 'beginner') {
|
|
484
|
+
return 'beginner';
|
|
485
|
+
}
|
|
486
|
+
if (normalized === 'intermediario' || normalized === 'intermediate') {
|
|
487
|
+
return 'intermediate';
|
|
488
|
+
}
|
|
489
|
+
if (normalized === 'avancado' || normalized === 'advanced') {
|
|
490
|
+
return 'advanced';
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
return undefined;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
private areaToCategorySlugs(value?: string) {
|
|
497
|
+
if (!value || value === 'todos') return [];
|
|
498
|
+
|
|
499
|
+
const normalized = value
|
|
500
|
+
.trim()
|
|
501
|
+
.toLowerCase()
|
|
502
|
+
.normalize('NFD')
|
|
503
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
504
|
+
|
|
505
|
+
const map: Record<string, string[]> = {
|
|
506
|
+
tecnologia: ['tecnologia', 'technology'],
|
|
507
|
+
design: ['design'],
|
|
508
|
+
gestao: ['gestao', 'management'],
|
|
509
|
+
marketing: ['marketing'],
|
|
510
|
+
financas: ['financas', 'finance'],
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
return map[normalized] ?? [normalized];
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
private slugToArea(slug?: string) {
|
|
517
|
+
if (!slug) return 'Tecnologia';
|
|
518
|
+
|
|
519
|
+
const normalized = slug
|
|
520
|
+
.trim()
|
|
521
|
+
.toLowerCase()
|
|
522
|
+
.normalize('NFD')
|
|
523
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
524
|
+
|
|
525
|
+
const map: Record<string, string> = {
|
|
526
|
+
tecnologia: 'Tecnologia',
|
|
527
|
+
technology: 'Tecnologia',
|
|
528
|
+
design: 'Design',
|
|
529
|
+
gestao: 'Gestao',
|
|
530
|
+
management: 'Gestao',
|
|
531
|
+
marketing: 'Marketing',
|
|
532
|
+
financas: 'Financas',
|
|
533
|
+
finance: 'Financas',
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
return map[normalized] ?? 'Tecnologia';
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
private levelToPt(level: string) {
|
|
540
|
+
const map: Record<string, string> = {
|
|
541
|
+
beginner: 'Iniciante',
|
|
542
|
+
intermediate: 'Intermediario',
|
|
543
|
+
advanced: 'Avancado',
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
return map[level] ?? level;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
private statusToPt(status: string) {
|
|
550
|
+
const map: Record<string, string> = {
|
|
551
|
+
draft: 'rascunho',
|
|
552
|
+
active: 'ativa',
|
|
553
|
+
archived: 'encerrada',
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
return map[status] ?? status;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
private slugify(value: string) {
|
|
560
|
+
return value
|
|
561
|
+
.toLowerCase()
|
|
562
|
+
.normalize('NFD')
|
|
563
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
564
|
+
.replace(/[^a-z0-9\s-]/g, '')
|
|
565
|
+
.trim()
|
|
566
|
+
.replace(/\s+/g, '-')
|
|
567
|
+
.replace(/-+/g, '-')
|
|
568
|
+
.slice(0, 255);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
private idToCode(id: number) {
|
|
572
|
+
return `TR-${String(id).padStart(3, '0')}`;
|
|
573
|
+
}
|
|
574
|
+
}
|