@hed-hog/lms 0.0.361 → 0.0.365
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/dist/bitcode-wallet/bitcode-wallet.service.d.ts +66 -0
- package/dist/bitcode-wallet/bitcode-wallet.service.d.ts.map +1 -1
- package/dist/bitcode-wallet/bitcode-wallet.service.js +91 -0
- package/dist/bitcode-wallet/bitcode-wallet.service.js.map +1 -1
- package/dist/bitcode-wallet/dto/create-current-bitcode-wallet-transaction.dto.d.ts +8 -0
- package/dist/bitcode-wallet/dto/create-current-bitcode-wallet-transaction.dto.d.ts.map +1 -0
- package/dist/bitcode-wallet/dto/create-current-bitcode-wallet-transaction.dto.js +40 -0
- package/dist/bitcode-wallet/dto/create-current-bitcode-wallet-transaction.dto.js.map +1 -0
- package/dist/class-group/class-group.controller.d.ts +16 -16
- package/dist/class-group/class-group.service.d.ts +12 -12
- package/dist/course/course-audio-transcription.service.d.ts +3 -2
- package/dist/course/course-audio-transcription.service.d.ts.map +1 -1
- package/dist/course/course-audio-transcription.service.js +49 -8
- package/dist/course/course-audio-transcription.service.js.map +1 -1
- package/dist/course/course-export-scorm12-worker.service.d.ts +21 -0
- package/dist/course/course-export-scorm12-worker.service.d.ts.map +1 -0
- package/dist/course/course-export-scorm12-worker.service.js +109 -0
- package/dist/course/course-export-scorm12-worker.service.js.map +1 -0
- package/dist/course/course-export-scorm12.service.d.ts +42 -0
- package/dist/course/course-export-scorm12.service.d.ts.map +1 -0
- package/dist/course/course-export-scorm12.service.js +628 -0
- package/dist/course/course-export-scorm12.service.js.map +1 -0
- package/dist/course/course-export.service.d.ts +84 -0
- package/dist/course/course-export.service.d.ts.map +1 -0
- package/dist/course/course-export.service.js +237 -0
- package/dist/course/course-export.service.js.map +1 -0
- package/dist/course/course-lesson.controller.d.ts +4 -0
- package/dist/course/course-lesson.controller.d.ts.map +1 -1
- package/dist/course/course-lesson.controller.js +10 -0
- package/dist/course/course-lesson.controller.js.map +1 -1
- package/dist/course/course-structure.controller.d.ts +24 -9
- package/dist/course/course-structure.controller.d.ts.map +1 -1
- package/dist/course/course-structure.controller.js +30 -3
- package/dist/course/course-structure.controller.js.map +1 -1
- package/dist/course/course-structure.service.d.ts +25 -3
- package/dist/course/course-structure.service.d.ts.map +1 -1
- package/dist/course/course-structure.service.js +234 -24
- package/dist/course/course-structure.service.js.map +1 -1
- package/dist/course/course-video-conversion.service.d.ts +8 -0
- package/dist/course/course-video-conversion.service.d.ts.map +1 -1
- package/dist/course/course-video-conversion.service.js +87 -51
- package/dist/course/course-video-conversion.service.js.map +1 -1
- package/dist/course/course-video-hls.service.d.ts +57 -0
- package/dist/course/course-video-hls.service.d.ts.map +1 -0
- package/dist/course/course-video-hls.service.js +767 -0
- package/dist/course/course-video-hls.service.js.map +1 -0
- package/dist/course/course.controller.d.ts +115 -11
- package/dist/course/course.controller.d.ts.map +1 -1
- package/dist/course/course.controller.js +66 -28
- package/dist/course/course.controller.js.map +1 -1
- package/dist/course/course.mcp-tools.js +1 -1
- package/dist/course/course.mcp-tools.js.map +1 -1
- package/dist/course/course.module.d.ts.map +1 -1
- package/dist/course/course.module.js +13 -0
- package/dist/course/course.module.js.map +1 -1
- package/dist/course/course.service.d.ts +112 -11
- package/dist/course/course.service.d.ts.map +1 -1
- package/dist/course/course.service.js +682 -72
- package/dist/course/course.service.js.map +1 -1
- package/dist/course/dto/cleanup-course-storage.dto.d.ts +6 -0
- package/dist/course/dto/cleanup-course-storage.dto.d.ts.map +1 -0
- package/dist/course/dto/cleanup-course-storage.dto.js +34 -0
- package/dist/course/dto/cleanup-course-storage.dto.js.map +1 -0
- package/dist/course/dto/cleanup-upload-history.dto.d.ts +9 -0
- package/dist/course/dto/cleanup-upload-history.dto.d.ts.map +1 -0
- package/dist/course/dto/cleanup-upload-history.dto.js +36 -0
- package/dist/course/dto/cleanup-upload-history.dto.js.map +1 -0
- package/dist/course/dto/create-course-bulk-job.dto.d.ts +5 -0
- package/dist/course/dto/create-course-bulk-job.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course-bulk-job.dto.js +26 -0
- package/dist/course/dto/create-course-bulk-job.dto.js.map +1 -0
- package/dist/course/dto/create-course-export.dto.d.ts +14 -0
- package/dist/course/dto/create-course-export.dto.d.ts.map +1 -0
- package/dist/course/dto/create-course-export.dto.js +71 -0
- package/dist/course/dto/create-course-export.dto.js.map +1 -0
- package/dist/course/dto/create-course-structure-lesson.dto.d.ts +2 -2
- package/dist/course/dto/create-course-structure-lesson.dto.d.ts.map +1 -1
- package/dist/course/dto/create-course-structure-lesson.dto.js +3 -2
- package/dist/course/dto/create-course-structure-lesson.dto.js.map +1 -1
- package/dist/course/lms-bulk-upload-automation.service.d.ts +54 -0
- package/dist/course/lms-bulk-upload-automation.service.d.ts.map +1 -0
- package/dist/course/lms-bulk-upload-automation.service.js +537 -0
- package/dist/course/lms-bulk-upload-automation.service.js.map +1 -0
- package/dist/course/lms-bulk-upload-infra.service.d.ts +32 -0
- package/dist/course/lms-bulk-upload-infra.service.d.ts.map +1 -0
- package/dist/course/lms-bulk-upload-infra.service.js +301 -0
- package/dist/course/lms-bulk-upload-infra.service.js.map +1 -0
- package/dist/course/lms-bulk-upload.constants.d.ts +4 -0
- package/dist/course/lms-bulk-upload.constants.d.ts.map +1 -0
- package/dist/course/lms-bulk-upload.constants.js +7 -0
- package/dist/course/lms-bulk-upload.constants.js.map +1 -0
- package/dist/course/lms-bulk-upload.controller.d.ts +144 -1
- package/dist/course/lms-bulk-upload.controller.d.ts.map +1 -1
- package/dist/course/lms-bulk-upload.controller.js +114 -4
- package/dist/course/lms-bulk-upload.controller.js.map +1 -1
- package/dist/course/lms-bulk-upload.service.d.ts +153 -3
- package/dist/course/lms-bulk-upload.service.d.ts.map +1 -1
- package/dist/course/lms-bulk-upload.service.js +659 -21
- package/dist/course/lms-bulk-upload.service.js.map +1 -1
- package/dist/course/lms-setting.controller.d.ts +6 -2
- package/dist/course/lms-setting.controller.d.ts.map +1 -1
- package/dist/course/lms-setting.controller.js +25 -8
- package/dist/course/lms-setting.controller.js.map +1 -1
- package/dist/course/scorm12-schemas.d.ts +4 -0
- package/dist/course/scorm12-schemas.d.ts.map +1 -0
- package/dist/course/scorm12-schemas.js +9 -0
- package/dist/course/scorm12-schemas.js.map +1 -0
- package/dist/enterprise/enterprise.controller.d.ts +20 -20
- package/dist/enterprise/enterprise.service.d.ts +20 -20
- package/dist/enterprise/training/training-admin.controller.d.ts +11 -11
- package/dist/enterprise/training/training-admin.service.d.ts +11 -11
- package/dist/enterprise/training/training-instructor.controller.d.ts +2 -2
- package/dist/enterprise/training/training-instructor.service.d.ts +2 -2
- package/dist/enterprise/training/training-student.controller.d.ts +1 -1
- package/dist/enterprise/training/training-student.service.d.ts +52 -1
- package/dist/enterprise/training/training-student.service.d.ts.map +1 -1
- package/dist/enterprise/training/training-student.service.js +217 -4
- package/dist/enterprise/training/training-student.service.js.map +1 -1
- package/dist/enterprise/training/training-viewer.controller.d.ts +2 -2
- package/dist/evaluation/evaluation.controller.d.ts +8 -8
- package/dist/evaluation/evaluation.service.d.ts +26 -8
- package/dist/evaluation/evaluation.service.d.ts.map +1 -1
- package/dist/evaluation/evaluation.service.js +125 -0
- package/dist/evaluation/evaluation.service.js.map +1 -1
- package/dist/exam/dto/create-standalone-question.dto.d.ts +12 -0
- package/dist/exam/dto/create-standalone-question.dto.d.ts.map +1 -0
- package/dist/exam/dto/create-standalone-question.dto.js +70 -0
- package/dist/exam/dto/create-standalone-question.dto.js.map +1 -0
- package/dist/exam/exam.module.d.ts.map +1 -1
- package/dist/exam/exam.module.js +2 -1
- package/dist/exam/exam.module.js.map +1 -1
- package/dist/exam/exam.service.d.ts +21 -0
- package/dist/exam/exam.service.d.ts.map +1 -1
- package/dist/exam/exam.service.js +80 -0
- package/dist/exam/exam.service.js.map +1 -1
- package/dist/exam/question.controller.d.ts +27 -0
- package/dist/exam/question.controller.d.ts.map +1 -0
- package/dist/exam/question.controller.js +53 -0
- package/dist/exam/question.controller.js.map +1 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-map.dto.d.ts +6 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-map.dto.d.ts.map +1 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-map.dto.js +34 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-map.dto.js.map +1 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-segment.dto.d.ts +28 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-segment.dto.d.ts.map +1 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-segment.dto.js +123 -0
- package/dist/lesson-xp-map/dto/create-lesson-xp-segment.dto.js.map +1 -0
- package/dist/lesson-xp-map/dto/review-lesson-xp-map.dto.d.ts +4 -0
- package/dist/lesson-xp-map/dto/review-lesson-xp-map.dto.d.ts.map +1 -0
- package/dist/lesson-xp-map/dto/review-lesson-xp-map.dto.js +22 -0
- package/dist/lesson-xp-map/dto/review-lesson-xp-map.dto.js.map +1 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-map.dto.d.ts +10 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-map.dto.d.ts.map +1 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-map.dto.js +52 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-map.dto.js.map +1 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-segment.dto.d.ts +15 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-segment.dto.d.ts.map +1 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-segment.dto.js +86 -0
- package/dist/lesson-xp-map/dto/update-lesson-xp-segment.dto.js.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.d.ts +30 -0
- package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.d.ts.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.js +440 -0
- package/dist/lesson-xp-map/lesson-xp-ai-calculation.service.js.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-map.controller.d.ts +87 -0
- package/dist/lesson-xp-map/lesson-xp-map.controller.d.ts.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-map.controller.js +185 -0
- package/dist/lesson-xp-map/lesson-xp-map.controller.js.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-map.module.d.ts +3 -0
- package/dist/lesson-xp-map/lesson-xp-map.module.d.ts.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-map.module.js +34 -0
- package/dist/lesson-xp-map/lesson-xp-map.module.js.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-map.service.d.ts +84 -0
- package/dist/lesson-xp-map/lesson-xp-map.service.d.ts.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-map.service.js +353 -0
- package/dist/lesson-xp-map/lesson-xp-map.service.js.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-segment.controller.d.ts +10 -0
- package/dist/lesson-xp-map/lesson-xp-segment.controller.d.ts.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-segment.controller.js +63 -0
- package/dist/lesson-xp-map/lesson-xp-segment.controller.js.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-segment.service.d.ts +27 -0
- package/dist/lesson-xp-map/lesson-xp-segment.service.d.ts.map +1 -0
- package/dist/lesson-xp-map/lesson-xp-segment.service.js +194 -0
- package/dist/lesson-xp-map/lesson-xp-segment.service.js.map +1 -0
- package/dist/libraries/lms/tsconfig.tsbuildinfo +1 -0
- package/dist/lms-commerce-access.subscriber.d.ts +11 -0
- package/dist/lms-commerce-access.subscriber.d.ts.map +1 -0
- package/dist/lms-commerce-access.subscriber.js +74 -0
- package/dist/lms-commerce-access.subscriber.js.map +1 -0
- package/dist/lms.module.d.ts.map +1 -1
- package/dist/lms.module.js +21 -5
- package/dist/lms.module.js.map +1 -1
- package/dist/platforma/dto/update-profile.dto.d.ts +17 -0
- package/dist/platforma/dto/update-profile.dto.d.ts.map +1 -0
- package/dist/platforma/dto/update-profile.dto.js +87 -0
- package/dist/platforma/dto/update-profile.dto.js.map +1 -0
- package/dist/platforma/platforma-video.service.d.ts +39 -0
- package/dist/platforma/platforma-video.service.d.ts.map +1 -0
- package/dist/platforma/platforma-video.service.js +301 -0
- package/dist/platforma/platforma-video.service.js.map +1 -0
- package/dist/platforma/platforma.controller.d.ts +182 -1
- package/dist/platforma/platforma.controller.d.ts.map +1 -1
- package/dist/platforma/platforma.controller.js +243 -2
- package/dist/platforma/platforma.controller.js.map +1 -1
- package/dist/platforma/platforma.service.d.ts +27 -0
- package/dist/platforma/platforma.service.d.ts.map +1 -0
- package/dist/platforma/platforma.service.js +274 -0
- package/dist/platforma/platforma.service.js.map +1 -0
- package/dist/student-xp/dto/grant-skill-card-xp.dto.d.ts +5 -0
- package/dist/student-xp/dto/grant-skill-card-xp.dto.d.ts.map +1 -0
- package/dist/student-xp/dto/grant-skill-card-xp.dto.js +26 -0
- package/dist/student-xp/dto/grant-skill-card-xp.dto.js.map +1 -0
- package/dist/student-xp/student-xp.controller.d.ts +56 -0
- package/dist/student-xp/student-xp.controller.d.ts.map +1 -0
- package/dist/student-xp/student-xp.controller.js +138 -0
- package/dist/student-xp/student-xp.controller.js.map +1 -0
- package/dist/student-xp/student-xp.module.d.ts +3 -0
- package/dist/student-xp/student-xp.module.d.ts.map +1 -0
- package/dist/student-xp/student-xp.module.js +25 -0
- package/dist/student-xp/student-xp.module.js.map +1 -0
- package/dist/student-xp/student-xp.service.d.ts +81 -0
- package/dist/student-xp/student-xp.service.d.ts.map +1 -0
- package/dist/student-xp/student-xp.service.js +247 -0
- package/dist/student-xp/student-xp.service.js.map +1 -0
- package/dist/xp-catalog/dto/create-xp-area.dto.d.ts +12 -0
- package/dist/xp-catalog/dto/create-xp-area.dto.d.ts.map +1 -0
- package/dist/xp-catalog/dto/create-xp-area.dto.js +63 -0
- package/dist/xp-catalog/dto/create-xp-area.dto.js.map +1 -0
- package/dist/xp-catalog/dto/create-xp-learning-type.dto.d.ts +11 -0
- package/dist/xp-catalog/dto/create-xp-learning-type.dto.d.ts.map +1 -0
- package/dist/xp-catalog/dto/create-xp-learning-type.dto.js +57 -0
- package/dist/xp-catalog/dto/create-xp-learning-type.dto.js.map +1 -0
- package/dist/xp-catalog/dto/create-xp-skill.dto.d.ts +11 -0
- package/dist/xp-catalog/dto/create-xp-skill.dto.d.ts.map +1 -0
- package/dist/xp-catalog/dto/create-xp-skill.dto.js +57 -0
- package/dist/xp-catalog/dto/create-xp-skill.dto.js.map +1 -0
- package/dist/xp-catalog/dto/update-xp-area.dto.d.ts +12 -0
- package/dist/xp-catalog/dto/update-xp-area.dto.d.ts.map +1 -0
- package/dist/xp-catalog/dto/update-xp-area.dto.js +66 -0
- package/dist/xp-catalog/dto/update-xp-area.dto.js.map +1 -0
- package/dist/xp-catalog/dto/update-xp-learning-type.dto.d.ts +11 -0
- package/dist/xp-catalog/dto/update-xp-learning-type.dto.d.ts.map +1 -0
- package/dist/xp-catalog/dto/update-xp-learning-type.dto.js +60 -0
- package/dist/xp-catalog/dto/update-xp-learning-type.dto.js.map +1 -0
- package/dist/xp-catalog/dto/update-xp-skill.dto.d.ts +11 -0
- package/dist/xp-catalog/dto/update-xp-skill.dto.d.ts.map +1 -0
- package/dist/xp-catalog/dto/update-xp-skill.dto.js +60 -0
- package/dist/xp-catalog/dto/update-xp-skill.dto.js.map +1 -0
- package/dist/xp-catalog/xp-area.controller.d.ts +25 -0
- package/dist/xp-catalog/xp-area.controller.d.ts.map +1 -0
- package/dist/xp-catalog/xp-area.controller.js +105 -0
- package/dist/xp-catalog/xp-area.controller.js.map +1 -0
- package/dist/xp-catalog/xp-area.service.d.ts +35 -0
- package/dist/xp-catalog/xp-area.service.d.ts.map +1 -0
- package/dist/xp-catalog/xp-area.service.js +168 -0
- package/dist/xp-catalog/xp-area.service.js.map +1 -0
- package/dist/xp-catalog/xp-catalog.module.d.ts +3 -0
- package/dist/xp-catalog/xp-catalog.module.d.ts.map +1 -0
- package/dist/xp-catalog/xp-catalog.module.js +29 -0
- package/dist/xp-catalog/xp-catalog.module.js.map +1 -0
- package/dist/xp-catalog/xp-learning-type.controller.d.ts +20 -0
- package/dist/xp-catalog/xp-learning-type.controller.d.ts.map +1 -0
- package/dist/xp-catalog/xp-learning-type.controller.js +96 -0
- package/dist/xp-catalog/xp-learning-type.controller.js.map +1 -0
- package/dist/xp-catalog/xp-learning-type.service.d.ts +30 -0
- package/dist/xp-catalog/xp-learning-type.service.d.ts.map +1 -0
- package/dist/xp-catalog/xp-learning-type.service.js +146 -0
- package/dist/xp-catalog/xp-learning-type.service.js.map +1 -0
- package/dist/xp-catalog/xp-skill.controller.d.ts +26 -0
- package/dist/xp-catalog/xp-skill.controller.d.ts.map +1 -0
- package/dist/xp-catalog/xp-skill.controller.js +113 -0
- package/dist/xp-catalog/xp-skill.controller.js.map +1 -0
- package/dist/xp-catalog/xp-skill.service.d.ts +37 -0
- package/dist/xp-catalog/xp-skill.service.d.ts.map +1 -0
- package/dist/xp-catalog/xp-skill.service.js +174 -0
- package/dist/xp-catalog/xp-skill.service.js.map +1 -0
- package/hedhog/data/evaluation_topic.yaml +17 -0
- package/hedhog/data/menu.yaml +91 -7
- package/hedhog/data/queue_definition.yaml +48 -0
- package/hedhog/data/route.yaml +511 -29
- package/hedhog/data/setting_group.yaml +20 -20
- package/hedhog/data/xp_area.yaml +164 -0
- package/hedhog/data/xp_learning_type.yaml +131 -0
- package/hedhog/data/xp_skill.yaml +1834 -0
- package/hedhog/frontend/app/achievements/page.tsx.ejs +108 -118
- package/hedhog/frontend/app/bitcodes/page.tsx.ejs +22 -34
- package/hedhog/frontend/app/bulk-upload-sessions/page.tsx.ejs +1749 -0
- package/hedhog/frontend/app/certificates/models/page.tsx.ejs +21 -45
- package/hedhog/frontend/app/classes/[id]/page.tsx.ejs +40 -74
- package/hedhog/frontend/app/classes/page.tsx.ejs +56 -85
- package/hedhog/frontend/app/courses/[id]/_components/CourseDangerZoneCard.tsx.ejs +3 -2
- package/hedhog/frontend/app/courses/[id]/_components/CourseMediaCard.tsx.ejs +48 -5
- package/hedhog/frontend/app/courses/[id]/page.tsx.ejs +73 -8
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-export-sheet.tsx.ejs +420 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-exports-tab.tsx.ejs +308 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-operations-tab.tsx.ejs +19 -2
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-overview-tab.tsx.ejs +1172 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-tree-dnd.tsx.ejs +16 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-tree.tsx.ejs +2 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-xp-overview-tab.tsx.ejs +623 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/detail-lesson-xp-tab.tsx.ejs +1458 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/detail-lesson.tsx.ejs +87 -46
- package/hedhog/frontend/app/courses/[id]/structure/_components/detail-panel.tsx.ejs +8 -3
- package/hedhog/frontend/app/courses/[id]/structure/_components/detail-session.tsx.ejs +31 -8
- package/hedhog/frontend/app/courses/[id]/structure/_components/drag-overlay.tsx.ejs +16 -9
- package/hedhog/frontend/app/courses/[id]/structure/_components/editor-course.tsx.ejs +618 -480
- package/hedhog/frontend/app/courses/[id]/structure/_components/editor-lesson.tsx.ejs +672 -737
- package/hedhog/frontend/app/courses/[id]/structure/_components/mock-data.ts.ejs +1 -2
- package/hedhog/frontend/app/courses/[id]/structure/_components/sortable-tree-row.tsx.ejs +3 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/store.ts.ejs +1 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/tree-display-settings-popover.tsx.ejs +101 -85
- package/hedhog/frontend/app/courses/[id]/structure/_components/tree-row-lesson.tsx.ejs +24 -10
- package/hedhog/frontend/app/courses/[id]/structure/_components/tree-row.tsx.ejs +3 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/types.ts.ejs +1 -1
- package/hedhog/frontend/app/courses/[id]/structure/_components/use-tree-display-settings.ts.ejs +7 -1
- package/hedhog/frontend/app/courses/[id]/structure/_components/xp-premium-pills.tsx.ejs +44 -0
- package/hedhog/frontend/app/courses/[id]/structure/_data/adapters/course-structure.adapter.ts.ejs +6 -10
- package/hedhog/frontend/app/courses/[id]/structure/_data/services/course-structure.service.ts.ejs +49 -0
- package/hedhog/frontend/app/courses/[id]/structure/_data/types/api-course.types.ts.ejs +4 -3
- package/hedhog/frontend/app/courses/[id]/structure/_data/use-course-content-overview.ts.ejs +53 -0
- package/hedhog/frontend/app/courses/[id]/structure/_data/use-course-exports.ts.ejs +106 -0
- package/hedhog/frontend/app/courses/[id]/structure/_data/use-course-structure-mutations.ts.ejs +80 -1
- package/hedhog/frontend/app/courses/[id]/structure/_data/use-course-xp-overview.ts.ejs +76 -0
- package/hedhog/frontend/app/courses/[id]/structure/_data/use-lesson-xp-map.ts.ejs +128 -0
- package/hedhog/frontend/app/courses/[id]/structure/_data/use-lms-settings-query.ts.ejs +0 -2
- package/hedhog/frontend/app/courses/[id]/structure/_data/use-transcription-segments.ts.ejs +30 -0
- package/hedhog/frontend/app/courses/[id]/structure/_utils/xp-color-config.ts.ejs +115 -0
- package/hedhog/frontend/app/courses/_components/CourseDeleteDialog.tsx.ejs +223 -0
- package/hedhog/frontend/app/courses/_components/CourseRowActions.tsx.ejs +89 -0
- package/hedhog/frontend/app/courses/page.tsx.ejs +445 -230
- package/hedhog/frontend/app/enterprise/page.tsx.ejs +39 -63
- package/hedhog/frontend/app/exams/[id]/questions/page.tsx.ejs +53 -77
- package/hedhog/frontend/app/exams/page.tsx.ejs +54 -90
- package/hedhog/frontend/app/instructor-skills/page.tsx.ejs +23 -36
- package/hedhog/frontend/app/instructors/page.tsx.ejs +72 -81
- package/hedhog/frontend/app/paths/page.tsx.ejs +40 -68
- package/hedhog/frontend/app/training/page.tsx.ejs +40 -68
- package/hedhog/frontend/app/xp/areas/page.tsx.ejs +782 -0
- package/hedhog/frontend/app/xp/learning-types/page.tsx.ejs +690 -0
- package/hedhog/frontend/app/xp/skills/page.tsx.ejs +811 -0
- package/hedhog/frontend/messages/en.json +412 -31
- package/hedhog/frontend/messages/pt.json +412 -31
- package/hedhog/table/course_export.yaml +62 -0
- package/hedhog/table/lesson_xp_map.yaml +50 -0
- package/hedhog/table/lesson_xp_segment.yaml +40 -0
- package/hedhog/table/lesson_xp_segment_area.yaml +24 -0
- package/hedhog/table/lesson_xp_segment_learning_type.yaml +24 -0
- package/hedhog/table/lesson_xp_segment_skill.yaml +24 -0
- package/hedhog/table/lms_bulk_upload_item.yaml +44 -0
- package/hedhog/table/lms_bulk_upload_session.yaml +42 -0
- package/hedhog/table/student_area_xp.yaml +30 -0
- package/hedhog/table/student_learning_type_xp.yaml +30 -0
- package/hedhog/table/student_skill_xp.yaml +30 -0
- package/hedhog/table/student_xp_event.yaml +34 -0
- package/hedhog/table/xp_area.yaml +39 -0
- package/hedhog/table/xp_learning_type.yaml +34 -0
- package/hedhog/table/xp_skill.yaml +39 -0
- package/package.json +13 -8
- package/src/bitcode-wallet/bitcode-wallet.service.ts +152 -0
- package/src/bitcode-wallet/dto/create-current-bitcode-wallet-transaction.dto.ts +32 -0
- package/src/course/course-audio-transcription.service.ts +58 -21
- package/src/course/course-export-scorm12-worker.service.ts +124 -0
- package/src/course/course-export-scorm12.service.ts +668 -0
- package/src/course/course-export.service.ts +280 -0
- package/src/course/course-lesson.controller.ts +6 -1
- package/src/course/course-structure.controller.ts +23 -1
- package/src/course/course-structure.service.ts +273 -7
- package/src/course/course-video-conversion.service.ts +113 -75
- package/src/course/course-video-hls.service.ts +946 -0
- package/src/course/course.controller.ts +54 -21
- package/src/course/course.mcp-tools.ts +1 -1
- package/src/course/course.module.ts +13 -0
- package/src/course/course.service.ts +906 -76
- package/src/course/dto/cleanup-course-storage.dto.ts +23 -0
- package/src/course/dto/cleanup-upload-history.dto.ts +26 -0
- package/src/course/dto/create-course-bulk-job.dto.ts +10 -0
- package/src/course/dto/create-course-export.dto.ts +56 -0
- package/src/course/dto/create-course-structure-lesson.dto.ts +4 -3
- package/src/course/lms-bulk-upload-automation.service.ts +707 -0
- package/src/course/lms-bulk-upload-infra.service.ts +360 -0
- package/src/course/lms-bulk-upload.constants.ts +5 -0
- package/src/course/lms-bulk-upload.controller.ts +110 -4
- package/src/course/lms-bulk-upload.service.ts +1092 -204
- package/src/course/lms-setting.controller.ts +26 -8
- package/src/course/scorm12-schemas.ts +9 -0
- package/src/enterprise/training/training-student.service.ts +221 -2
- package/src/evaluation/evaluation.service.ts +123 -0
- package/src/exam/dto/create-standalone-question.dto.ts +66 -0
- package/src/exam/exam.module.ts +2 -1
- package/src/exam/exam.service.ts +86 -0
- package/src/exam/question.controller.ts +28 -0
- package/src/lesson-xp-map/dto/create-lesson-xp-map.dto.ts +17 -0
- package/src/lesson-xp-map/dto/create-lesson-xp-segment.dto.ts +102 -0
- package/src/lesson-xp-map/dto/review-lesson-xp-map.dto.ts +7 -0
- package/src/lesson-xp-map/dto/update-lesson-xp-map.dto.ts +36 -0
- package/src/lesson-xp-map/dto/update-lesson-xp-segment.dto.ts +78 -0
- package/src/lesson-xp-map/lesson-xp-ai-calculation.service.ts +570 -0
- package/src/lesson-xp-map/lesson-xp-map.controller.ts +116 -0
- package/src/lesson-xp-map/lesson-xp-map.module.ts +21 -0
- package/src/lesson-xp-map/lesson-xp-map.service.ts +442 -0
- package/src/lesson-xp-map/lesson-xp-segment.controller.ts +36 -0
- package/src/lesson-xp-map/lesson-xp-segment.service.ts +229 -0
- package/src/lms-commerce-access.subscriber.ts +88 -0
- package/src/lms.module.ts +21 -5
- package/src/platforma/dto/update-profile.dto.ts +59 -0
- package/src/platforma/platforma-video.service.ts +346 -0
- package/src/platforma/platforma.controller.ts +152 -3
- package/src/platforma/platforma.service.ts +268 -0
- package/src/student-xp/dto/grant-skill-card-xp.dto.ts +10 -0
- package/src/student-xp/student-xp.controller.ts +92 -0
- package/src/student-xp/student-xp.module.ts +12 -0
- package/src/student-xp/student-xp.service.ts +318 -0
- package/src/xp-catalog/dto/create-xp-area.dto.ts +40 -0
- package/src/xp-catalog/dto/create-xp-learning-type.dto.ts +35 -0
- package/src/xp-catalog/dto/create-xp-skill.dto.ts +35 -0
- package/src/xp-catalog/dto/update-xp-area.dto.ts +43 -0
- package/src/xp-catalog/dto/update-xp-learning-type.dto.ts +38 -0
- package/src/xp-catalog/dto/update-xp-skill.dto.ts +38 -0
- package/src/xp-catalog/xp-area.controller.ts +64 -0
- package/src/xp-catalog/xp-area.service.ts +196 -0
- package/src/xp-catalog/xp-catalog.module.ts +16 -0
- package/src/xp-catalog/xp-learning-type.controller.ts +59 -0
- package/src/xp-catalog/xp-learning-type.service.ts +170 -0
- package/src/xp-catalog/xp-skill.controller.ts +71 -0
- package/src/xp-catalog/xp-skill.service.ts +205 -0
- package/hedhog/data/video_resolution_profile.yaml +0 -7
- package/hedhog/frontend/app/video-resolution-profiles/page.tsx.ejs +0 -607
- package/hedhog/table/course_video_resolution_profile.yaml +0 -22
- package/hedhog/table/video_resolution_profile.yaml +0 -18
- package/src/video-resolution-profile/dto/create-video-resolution-profile.dto.ts +0 -16
- package/src/video-resolution-profile/dto/update-video-resolution-profile.dto.ts +0 -16
- package/src/video-resolution-profile/video-resolution-profile.controller.ts +0 -62
- package/src/video-resolution-profile/video-resolution-profile.mcp-tools.ts +0 -128
- package/src/video-resolution-profile/video-resolution-profile.module.ts +0 -13
- package/src/video-resolution-profile/video-resolution-profile.service.ts +0 -117
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { FileService } from '@hed-hog/core';
|
|
2
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import {
|
|
4
|
+
forwardRef,
|
|
5
|
+
Inject,
|
|
6
|
+
Injectable,
|
|
7
|
+
Logger,
|
|
8
|
+
NotFoundException,
|
|
9
|
+
UnauthorizedException,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { JwtService } from '@nestjs/jwt';
|
|
12
|
+
import type { Request, Response } from 'express';
|
|
13
|
+
|
|
14
|
+
@Injectable()
|
|
15
|
+
export class PlatformaVideoService {
|
|
16
|
+
private readonly logger = new Logger(PlatformaVideoService.name);
|
|
17
|
+
constructor(
|
|
18
|
+
@Inject(forwardRef(() => PrismaService))
|
|
19
|
+
private readonly prisma: PrismaService,
|
|
20
|
+
@Inject(forwardRef(() => FileService))
|
|
21
|
+
private readonly fileService: FileService,
|
|
22
|
+
@Inject(forwardRef(() => JwtService))
|
|
23
|
+
private readonly jwtService: JwtService,
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
async getVideoOptions(lessonId: number) {
|
|
27
|
+
const lesson = await this.prisma.course_lesson.findFirst({
|
|
28
|
+
where: { id: lessonId, published: true },
|
|
29
|
+
select: {
|
|
30
|
+
id: true,
|
|
31
|
+
course_lesson_file: {
|
|
32
|
+
where: { file_id: { not: null } },
|
|
33
|
+
select: { id: true, title: true, type: true, file: { select: { id: true } } },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!lesson) throw new NotFoundException('Lesson not found');
|
|
39
|
+
|
|
40
|
+
// HLS takes priority over legacy MP4 profiles
|
|
41
|
+
const hlsFile = lesson.course_lesson_file.find((f) => f.type === 'video_hls' && f.file?.id);
|
|
42
|
+
if (hlsFile) {
|
|
43
|
+
return [{ type: 'video_hls', label: 'HLS', fileId: hlsFile.file!.id! }];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const videoFiles = lesson.course_lesson_file.filter(
|
|
47
|
+
(f) => f.type === 'video_original' || f.type?.startsWith('video_profile:'),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
if (videoFiles.length === 0) return [];
|
|
51
|
+
|
|
52
|
+
return videoFiles
|
|
53
|
+
.filter((f) => f.file?.id)
|
|
54
|
+
.map((f) => {
|
|
55
|
+
const profileMatch = f.type?.match(/^video_profile:(\d+)$/);
|
|
56
|
+
const profileId = profileMatch ? Number(profileMatch[1]) : null;
|
|
57
|
+
const label =
|
|
58
|
+
f.type === 'video_original'
|
|
59
|
+
? 'Original'
|
|
60
|
+
: profileId !== null
|
|
61
|
+
? f.title || `Perfil ${profileId}`
|
|
62
|
+
: f.title || f.type || 'Vídeo';
|
|
63
|
+
|
|
64
|
+
return { type: f.type!, label, fileId: f.file!.id! };
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async generateVideoToken(lessonId: number, quality?: string) {
|
|
69
|
+
const options = await this.getVideoOptions(lessonId);
|
|
70
|
+
if (options.length === 0) throw new NotFoundException('No video available for this lesson');
|
|
71
|
+
|
|
72
|
+
const selected = quality
|
|
73
|
+
? (options.find((o) => o.type === quality) ?? options[0])
|
|
74
|
+
: options[0];
|
|
75
|
+
|
|
76
|
+
const token = this.jwtService.sign(
|
|
77
|
+
{ fileId: selected.fileId, lessonId },
|
|
78
|
+
{ secret: process.env.JWT_SECRET, expiresIn: '4h' },
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return { token, label: selected.label, type: selected.type, expiresIn: 14400 };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async streamVideo(token: string, req: Request, res: Response) {
|
|
85
|
+
let fileId: number;
|
|
86
|
+
try {
|
|
87
|
+
const payload = this.jwtService.verify<{ fileId: number }>(token, {
|
|
88
|
+
secret: process.env.JWT_SECRET,
|
|
89
|
+
});
|
|
90
|
+
fileId = payload.fileId;
|
|
91
|
+
} catch {
|
|
92
|
+
throw new UnauthorizedException('Invalid or expired video token');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const rangeHeader = req.headers['range'];
|
|
96
|
+
let start: number | undefined;
|
|
97
|
+
let end: number | undefined;
|
|
98
|
+
|
|
99
|
+
if (rangeHeader) {
|
|
100
|
+
const match = rangeHeader.match(/bytes=(\d+)-(\d*)/);
|
|
101
|
+
if (match) {
|
|
102
|
+
start = parseInt(match[1], 10);
|
|
103
|
+
end = match[2] ? parseInt(match[2], 10) : undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const result = await this.fileService.openReadStreamWithRange(fileId, start, end);
|
|
108
|
+
if (!result) throw new NotFoundException('Video file not found');
|
|
109
|
+
|
|
110
|
+
const { stream, totalSize, start: resolvedStart, end: resolvedEnd, contentLength, mimetype } = result;
|
|
111
|
+
|
|
112
|
+
const headers: Record<string, string | number> = {
|
|
113
|
+
'Content-Type': mimetype,
|
|
114
|
+
'Content-Disposition': 'inline',
|
|
115
|
+
'Accept-Ranges': 'bytes',
|
|
116
|
+
'Cache-Control': 'no-store',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
if (start !== undefined) {
|
|
120
|
+
headers['Content-Range'] = `bytes ${resolvedStart}-${resolvedEnd ?? totalSize - 1}/${totalSize || '*'}`;
|
|
121
|
+
headers['Content-Length'] = contentLength;
|
|
122
|
+
res.writeHead(206, headers);
|
|
123
|
+
} else {
|
|
124
|
+
if (totalSize > 0) headers['Content-Length'] = totalSize;
|
|
125
|
+
res.writeHead(200, headers);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
stream.pipe(res);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// HLS endpoints
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
async generateHlsToken(lessonId: number) {
|
|
136
|
+
const lesson = await this.prisma.course_lesson.findFirst({
|
|
137
|
+
where: { id: lessonId, published: true },
|
|
138
|
+
select: {
|
|
139
|
+
id: true,
|
|
140
|
+
course_lesson_file: {
|
|
141
|
+
where: { type: 'video_hls', file_id: { not: null } },
|
|
142
|
+
select: { id: true },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
if (!lesson) throw new NotFoundException('Lesson not found');
|
|
148
|
+
if (lesson.course_lesson_file.length === 0) throw new NotFoundException('No HLS stream available for this lesson');
|
|
149
|
+
|
|
150
|
+
const token = this.jwtService.sign(
|
|
151
|
+
{ lessonId },
|
|
152
|
+
{ secret: process.env.JWT_SECRET, expiresIn: '4h' },
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
return { token, expiresIn: 14400 };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private verifyHlsToken(token: string): { lessonId: number } {
|
|
159
|
+
try {
|
|
160
|
+
return this.jwtService.verify<{ lessonId: number }>(token, {
|
|
161
|
+
secret: process.env.JWT_SECRET,
|
|
162
|
+
});
|
|
163
|
+
} catch {
|
|
164
|
+
throw new UnauthorizedException('Invalid or expired HLS token');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async serveHlsMasterManifest(token: string, req: Request, res: Response) {
|
|
169
|
+
const { lessonId } = this.verifyHlsToken(token);
|
|
170
|
+
|
|
171
|
+
const manifestFile = await (this.prisma as any).file.findFirst({
|
|
172
|
+
where: {
|
|
173
|
+
location: `lms/lessons/hls/${lessonId}`,
|
|
174
|
+
filename: 'master.m3u8',
|
|
175
|
+
},
|
|
176
|
+
select: { id: true },
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
if (!manifestFile) throw new NotFoundException('HLS master manifest not found');
|
|
180
|
+
|
|
181
|
+
const { stream } = await this.fileService.openReadStreamById(manifestFile.id);
|
|
182
|
+
|
|
183
|
+
const chunks: Buffer[] = [];
|
|
184
|
+
await new Promise<void>((resolve, reject) => {
|
|
185
|
+
stream.on('data', (chunk: Buffer) => chunks.push(chunk));
|
|
186
|
+
stream.on('end', resolve);
|
|
187
|
+
stream.on('error', reject);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const baseUrl = `${req.protocol}://${req.get('host')}`;
|
|
191
|
+
const content = Buffer.concat(chunks).toString('utf8');
|
|
192
|
+
|
|
193
|
+
// Rewrite relative variant playlist paths to absolute authenticated URLs
|
|
194
|
+
const rewritten = content.replace(
|
|
195
|
+
/^(stream_\d+\/playlist\.m3u8)$/gm,
|
|
196
|
+
(_, variantPath) => `${baseUrl}/lms/platforma/hls/${token}/${variantPath}`,
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
res.set({
|
|
200
|
+
'Content-Type': 'application/x-mpegURL',
|
|
201
|
+
'Cache-Control': 'no-store',
|
|
202
|
+
'Access-Control-Allow-Origin': '*',
|
|
203
|
+
});
|
|
204
|
+
res.send(rewritten);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async serveHlsVariantPlaylist(token: string, variant: string, req: Request, res: Response) {
|
|
208
|
+
const { lessonId } = this.verifyHlsToken(token);
|
|
209
|
+
|
|
210
|
+
const playlistFile = await (this.prisma as any).file.findFirst({
|
|
211
|
+
where: {
|
|
212
|
+
location: `lms/lessons/hls/${lessonId}/${variant}`,
|
|
213
|
+
filename: 'playlist.m3u8',
|
|
214
|
+
},
|
|
215
|
+
select: { id: true },
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
if (!playlistFile) throw new NotFoundException('HLS variant playlist not found');
|
|
219
|
+
|
|
220
|
+
const { stream } = await this.fileService.openReadStreamById(playlistFile.id);
|
|
221
|
+
|
|
222
|
+
const chunks: Buffer[] = [];
|
|
223
|
+
await new Promise<void>((resolve, reject) => {
|
|
224
|
+
stream.on('data', (chunk: Buffer) => chunks.push(chunk));
|
|
225
|
+
stream.on('end', resolve);
|
|
226
|
+
stream.on('error', reject);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const baseUrl = `${req.protocol}://${req.get('host')}`;
|
|
230
|
+
const content = Buffer.concat(chunks).toString('utf8');
|
|
231
|
+
|
|
232
|
+
// Rewrite relative segment paths to absolute authenticated URLs
|
|
233
|
+
const rewritten = content.replace(
|
|
234
|
+
/^(seg\d+\.ts)$/gm,
|
|
235
|
+
(_, segName) => `${baseUrl}/lms/platforma/hls/${token}/${variant}/${segName}`,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
res.set({
|
|
239
|
+
'Content-Type': 'application/x-mpegURL',
|
|
240
|
+
'Cache-Control': 'no-store',
|
|
241
|
+
'Access-Control-Allow-Origin': '*',
|
|
242
|
+
});
|
|
243
|
+
res.send(rewritten);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async serveHlsSegment(token: string, variant: string, segment: string, res: Response) {
|
|
247
|
+
const { lessonId } = this.verifyHlsToken(token);
|
|
248
|
+
|
|
249
|
+
if (!/^seg\d+\.ts$/.test(segment)) {
|
|
250
|
+
throw new NotFoundException('Invalid segment name');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const segmentFile = await (this.prisma as any).file.findFirst({
|
|
254
|
+
where: {
|
|
255
|
+
location: `lms/lessons/hls/${lessonId}/${variant}`,
|
|
256
|
+
filename: segment,
|
|
257
|
+
},
|
|
258
|
+
select: { id: true },
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
if (!segmentFile) throw new NotFoundException('HLS segment not found');
|
|
262
|
+
|
|
263
|
+
const { stream } = await this.fileService.openReadStreamById(segmentFile.id);
|
|
264
|
+
|
|
265
|
+
res.set({
|
|
266
|
+
'Content-Type': 'video/MP2T',
|
|
267
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
268
|
+
'Access-Control-Allow-Origin': '*',
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
stream.pipe(res);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ---------------------------------------------------------------------------
|
|
275
|
+
// Subtitle (VTT) endpoints
|
|
276
|
+
// ---------------------------------------------------------------------------
|
|
277
|
+
|
|
278
|
+
async generateSubtitlesToken(lessonId: number) {
|
|
279
|
+
const lesson = await this.prisma.course_lesson.findFirst({
|
|
280
|
+
where: { id: lessonId, published: true },
|
|
281
|
+
select: { id: true },
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
if (!lesson) throw new NotFoundException('Lesson not found');
|
|
285
|
+
|
|
286
|
+
const count = await (this.prisma as any).course_lesson_transcription_segment.count({
|
|
287
|
+
where: { course_lesson_id: lessonId },
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
if (count === 0) throw new NotFoundException('No subtitles available for this lesson');
|
|
291
|
+
|
|
292
|
+
const token = this.jwtService.sign(
|
|
293
|
+
{ lessonId, type: 'subtitles' },
|
|
294
|
+
{ secret: process.env.JWT_SECRET, expiresIn: '4h' },
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
return { token, expiresIn: 14400 };
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async serveSubtitles(token: string, res: Response) {
|
|
301
|
+
let lessonId: number;
|
|
302
|
+
try {
|
|
303
|
+
const payload = this.jwtService.verify<{ lessonId: number; type: string }>(token, {
|
|
304
|
+
secret: process.env.JWT_SECRET,
|
|
305
|
+
});
|
|
306
|
+
if (payload.type !== 'subtitles') throw new Error('Wrong token type');
|
|
307
|
+
lessonId = payload.lessonId;
|
|
308
|
+
} catch {
|
|
309
|
+
throw new UnauthorizedException('Invalid or expired subtitles token');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const segments = await (this.prisma as any).course_lesson_transcription_segment.findMany({
|
|
313
|
+
where: { course_lesson_id: lessonId },
|
|
314
|
+
orderBy: { start_seconds: 'asc' },
|
|
315
|
+
select: { start_seconds: true, end_seconds: true, text: true },
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const vtt = this.buildVtt(segments);
|
|
319
|
+
|
|
320
|
+
res.set({
|
|
321
|
+
'Content-Type': 'text/vtt; charset=utf-8',
|
|
322
|
+
'Cache-Control': 'no-store',
|
|
323
|
+
'Access-Control-Allow-Origin': '*',
|
|
324
|
+
});
|
|
325
|
+
res.send(vtt);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
private secondsToVttTime(seconds: number): string {
|
|
329
|
+
const s = Number(seconds);
|
|
330
|
+
const h = Math.floor(s / 3600);
|
|
331
|
+
const m = Math.floor((s % 3600) / 60);
|
|
332
|
+
const sec = Math.floor(s % 60);
|
|
333
|
+
const ms = Math.round((s % 1) * 1000);
|
|
334
|
+
return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}:${String(sec).padStart(2, '0')}.${String(ms).padStart(3, '0')}`;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
private buildVtt(segments: { start_seconds: any; end_seconds: any; text: string }[]): string {
|
|
338
|
+
if (segments.length === 0) return 'WEBVTT\n';
|
|
339
|
+
const cues = segments.map((seg, i) => {
|
|
340
|
+
const start = this.secondsToVttTime(seg.start_seconds);
|
|
341
|
+
const end = this.secondsToVttTime(seg.end_seconds);
|
|
342
|
+
return `${i + 1}\n${start} --> ${end}\n${seg.text}`;
|
|
343
|
+
});
|
|
344
|
+
return `WEBVTT\n\n${cues.join('\n\n')}\n`;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { NoRole, User } from '@hed-hog/api';
|
|
1
|
+
import { NoRole, Public, User } from '@hed-hog/api';
|
|
2
2
|
import { NotificationService } from '@hed-hog/core';
|
|
3
|
-
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Query } from '@nestjs/common';
|
|
3
|
+
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post, Put, Query, Req, Res } from '@nestjs/common';
|
|
4
|
+
import type { Request, Response } from 'express';
|
|
5
|
+
import { BitcodeWalletService } from '../bitcode-wallet/bitcode-wallet.service';
|
|
6
|
+
import { CreateCurrentBitcodeWalletTransactionDto } from '../bitcode-wallet/dto/create-current-bitcode-wallet-transaction.dto';
|
|
7
|
+
import { EvaluationService } from '../evaluation/evaluation.service';
|
|
4
8
|
import { TrainingStudentService } from '../enterprise/training/training-student.service';
|
|
9
|
+
import { UpdatePlatformaProfileDto } from './dto/update-profile.dto';
|
|
10
|
+
import { PlatformaService } from './platforma.service';
|
|
11
|
+
import { PlatformaVideoService } from './platforma-video.service';
|
|
5
12
|
|
|
6
13
|
@NoRole()
|
|
7
14
|
@Controller('lms/platforma')
|
|
@@ -9,6 +16,10 @@ export class PlataformaController {
|
|
|
9
16
|
constructor(
|
|
10
17
|
private readonly trainingStudentService: TrainingStudentService,
|
|
11
18
|
private readonly notificationService: NotificationService,
|
|
19
|
+
private readonly platforma: PlatformaService,
|
|
20
|
+
private readonly bitcodeWalletService: BitcodeWalletService,
|
|
21
|
+
private readonly platformaVideoService: PlatformaVideoService,
|
|
22
|
+
private readonly evaluationService: EvaluationService,
|
|
12
23
|
) {}
|
|
13
24
|
|
|
14
25
|
@Get()
|
|
@@ -38,6 +49,96 @@ export class PlataformaController {
|
|
|
38
49
|
});
|
|
39
50
|
}
|
|
40
51
|
|
|
52
|
+
@Get('courses/:slug')
|
|
53
|
+
getCourseBySlug(@Param('slug') slug: string, @User('id') userId?: number) {
|
|
54
|
+
return this.trainingStudentService.getPublishedCourseBySlug(slug, userId);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Get('lessons/:lessonId')
|
|
58
|
+
getLessonDetail(@Param('lessonId', ParseIntPipe) lessonId: number) {
|
|
59
|
+
return this.trainingStudentService.getLessonDetail(lessonId);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Get('lessons/:lessonId/video-token')
|
|
63
|
+
getVideoToken(
|
|
64
|
+
@Param('lessonId', ParseIntPipe) lessonId: number,
|
|
65
|
+
@Query('quality') quality?: string,
|
|
66
|
+
) {
|
|
67
|
+
return this.platformaVideoService.generateVideoToken(lessonId, quality);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@Get('lessons/:lessonId/hls-token')
|
|
71
|
+
getHlsToken(@Param('lessonId', ParseIntPipe) lessonId: number) {
|
|
72
|
+
return this.platformaVideoService.generateHlsToken(lessonId);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@Public()
|
|
76
|
+
@Get('video/:token')
|
|
77
|
+
streamVideo(@Param('token') token: string, @Req() req: Request, @Res() res: Response) {
|
|
78
|
+
return this.platformaVideoService.streamVideo(token, req, res);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Public()
|
|
82
|
+
@Get('hls/:token/master.m3u8')
|
|
83
|
+
serveHlsMaster(@Param('token') token: string, @Req() req: Request, @Res() res: Response) {
|
|
84
|
+
return this.platformaVideoService.serveHlsMasterManifest(token, req, res);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@Public()
|
|
88
|
+
@Get('hls/:token/:variant/playlist.m3u8')
|
|
89
|
+
serveHlsVariant(
|
|
90
|
+
@Param('token') token: string,
|
|
91
|
+
@Param('variant') variant: string,
|
|
92
|
+
@Req() req: Request,
|
|
93
|
+
@Res() res: Response,
|
|
94
|
+
) {
|
|
95
|
+
return this.platformaVideoService.serveHlsVariantPlaylist(token, variant, req, res);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Public()
|
|
99
|
+
@Get('hls/:token/:variant/:segment')
|
|
100
|
+
serveHlsSegment(
|
|
101
|
+
@Param('token') token: string,
|
|
102
|
+
@Param('variant') variant: string,
|
|
103
|
+
@Param('segment') segment: string,
|
|
104
|
+
@Res() res: Response,
|
|
105
|
+
) {
|
|
106
|
+
return this.platformaVideoService.serveHlsSegment(token, variant, segment, res);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Get('lessons/:lessonId/subtitles-token')
|
|
110
|
+
getSubtitlesToken(@Param('lessonId', ParseIntPipe) lessonId: number) {
|
|
111
|
+
return this.platformaVideoService.generateSubtitlesToken(lessonId);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@Get('lessons/:lessonId/evaluation-topics')
|
|
115
|
+
getCourseLessonEvaluationTopics(@Param('lessonId', ParseIntPipe) lessonId: number) {
|
|
116
|
+
return this.evaluationService.getCourseLessonTopics(lessonId);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@Get('lessons/:lessonId/my-evaluation')
|
|
120
|
+
getMyLessonEvaluation(
|
|
121
|
+
@Param('lessonId', ParseIntPipe) lessonId: number,
|
|
122
|
+
@User('id') userId: number,
|
|
123
|
+
) {
|
|
124
|
+
return this.evaluationService.getMyLessonRatings(lessonId, userId);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@Post('lessons/:lessonId/evaluate')
|
|
128
|
+
submitLessonEvaluation(
|
|
129
|
+
@Param('lessonId', ParseIntPipe) lessonId: number,
|
|
130
|
+
@User('id') userId: number,
|
|
131
|
+
@Body() body: { ratings: Array<{ topicId: number; score: number; comment?: string }> },
|
|
132
|
+
) {
|
|
133
|
+
return this.evaluationService.submitLessonRatings(lessonId, userId, body.ratings ?? []);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@Public()
|
|
137
|
+
@Get('subtitles/:token/captions.vtt')
|
|
138
|
+
serveSubtitles(@Param('token') token: string, @Res() res: Response) {
|
|
139
|
+
return this.platformaVideoService.serveSubtitles(token, res);
|
|
140
|
+
}
|
|
141
|
+
|
|
41
142
|
@Get('notifications')
|
|
42
143
|
listNotifications(
|
|
43
144
|
@User('id') userId: number,
|
|
@@ -74,6 +175,28 @@ export class PlataformaController {
|
|
|
74
175
|
return this.notificationService.markRead(userId, id);
|
|
75
176
|
}
|
|
76
177
|
|
|
178
|
+
@Get('notifications/stream')
|
|
179
|
+
streamNotifications(
|
|
180
|
+
@User('id') userId: number,
|
|
181
|
+
@Req() req: Request,
|
|
182
|
+
@Res() res: Response,
|
|
183
|
+
) {
|
|
184
|
+
return this.notificationService.stream(userId, req, res);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@Delete('notifications/:id')
|
|
188
|
+
deleteNotification(
|
|
189
|
+
@User('id') userId: number,
|
|
190
|
+
@Param('id', ParseIntPipe) id: number,
|
|
191
|
+
) {
|
|
192
|
+
return this.notificationService.delete(userId, id);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@Delete('notifications')
|
|
196
|
+
deleteAllNotifications(@User('id') userId: number) {
|
|
197
|
+
return this.notificationService.deleteAll(userId);
|
|
198
|
+
}
|
|
199
|
+
|
|
77
200
|
@Get('streak')
|
|
78
201
|
getStreak(
|
|
79
202
|
@User('id') userId: number,
|
|
@@ -89,4 +212,30 @@ export class PlataformaController {
|
|
|
89
212
|
) {
|
|
90
213
|
return this.trainingStudentService.registerStreakActivity(userId, body);
|
|
91
214
|
}
|
|
92
|
-
|
|
215
|
+
|
|
216
|
+
@Get('bitcodes/wallet')
|
|
217
|
+
getBitcodeWallet(@User('id') userId: number) {
|
|
218
|
+
return this.bitcodeWalletService.getCurrentUserWallet(userId);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@Post('bitcodes/transactions')
|
|
222
|
+
createBitcodeTransaction(
|
|
223
|
+
@User('id') userId: number,
|
|
224
|
+
@Body() dto: CreateCurrentBitcodeWalletTransactionDto,
|
|
225
|
+
) {
|
|
226
|
+
return this.bitcodeWalletService.createCurrentUserTransaction(userId, dto);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
@Get('profile')
|
|
230
|
+
getProfile(@User('id') userId: number) {
|
|
231
|
+
return this.platforma.getProfile(userId);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@Put('profile')
|
|
235
|
+
updateProfile(
|
|
236
|
+
@User('id') userId: number,
|
|
237
|
+
@Body() dto: UpdatePlatformaProfileDto,
|
|
238
|
+
) {
|
|
239
|
+
return this.platforma.updateProfile(userId, dto);
|
|
240
|
+
}
|
|
241
|
+
}
|