@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,268 @@
|
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import { UpdatePlatformaProfileDto } from './dto/update-profile.dto';
|
|
4
|
+
|
|
5
|
+
function mapGenderToDb(
|
|
6
|
+
gender?: string | null,
|
|
7
|
+
): 'male' | 'female' | 'other' | null {
|
|
8
|
+
if (!gender) return null;
|
|
9
|
+
if (gender === 'Masculino') return 'male';
|
|
10
|
+
if (gender === 'Feminino') return 'female';
|
|
11
|
+
return 'other';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function mapGenderToDisplay(gender?: string | null): string | null {
|
|
15
|
+
if (!gender) return null;
|
|
16
|
+
if (gender === 'male') return 'Masculino';
|
|
17
|
+
if (gender === 'female') return 'Feminino';
|
|
18
|
+
return 'Prefiro nao dizer';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function buildLine1(street?: string | null, number?: string | null): string {
|
|
22
|
+
if (!street && !number) return '';
|
|
23
|
+
if (!number) return street ?? '';
|
|
24
|
+
if (!street) return number;
|
|
25
|
+
return `${street}, ${number}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function buildLine2(
|
|
29
|
+
neighborhood?: string | null,
|
|
30
|
+
complement?: string | null,
|
|
31
|
+
): string {
|
|
32
|
+
const parts = [neighborhood, complement].filter(Boolean);
|
|
33
|
+
return parts.join('; ');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function parseAddressLine1(line1?: string | null): [string, string] {
|
|
37
|
+
if (!line1) return ['', ''];
|
|
38
|
+
const idx = line1.lastIndexOf(', ');
|
|
39
|
+
if (idx === -1) return [line1, ''];
|
|
40
|
+
return [line1.slice(0, idx), line1.slice(idx + 2)];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function parseAddressLine2(line2?: string | null): [string, string] {
|
|
44
|
+
if (!line2) return ['', ''];
|
|
45
|
+
const idx = line2.indexOf('; ');
|
|
46
|
+
if (idx === -1) return [line2, ''];
|
|
47
|
+
return [line2.slice(0, idx), line2.slice(idx + 2)];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Injectable()
|
|
51
|
+
export class PlatformaService {
|
|
52
|
+
constructor(private readonly prisma: PrismaService) {}
|
|
53
|
+
|
|
54
|
+
async getProfile(userId: number) {
|
|
55
|
+
const [user, personUser] = await Promise.all([
|
|
56
|
+
this.prisma.user.findUnique({ where: { id: userId } }),
|
|
57
|
+
this.prisma.person_user.findFirst({
|
|
58
|
+
where: { user_id: userId },
|
|
59
|
+
select: { person_id: true },
|
|
60
|
+
}),
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
const personId = personUser?.person_id;
|
|
64
|
+
|
|
65
|
+
const [individual, contacts, documents, personAddresses] =
|
|
66
|
+
await Promise.all([
|
|
67
|
+
personId
|
|
68
|
+
? this.prisma.person_individual.findUnique({
|
|
69
|
+
where: { id: personId },
|
|
70
|
+
})
|
|
71
|
+
: Promise.resolve(null),
|
|
72
|
+
personId
|
|
73
|
+
? this.prisma.contact.findMany({
|
|
74
|
+
where: { person_id: personId },
|
|
75
|
+
include: { contact_type: true },
|
|
76
|
+
})
|
|
77
|
+
: Promise.resolve([]),
|
|
78
|
+
personId
|
|
79
|
+
? this.prisma.document.findMany({
|
|
80
|
+
where: { person_id: personId },
|
|
81
|
+
include: { document_type: true },
|
|
82
|
+
})
|
|
83
|
+
: Promise.resolve([]),
|
|
84
|
+
personId
|
|
85
|
+
? this.prisma.person_address.findMany({
|
|
86
|
+
where: { person_id: personId },
|
|
87
|
+
include: { address: true },
|
|
88
|
+
orderBy: { address: { is_primary: 'desc' } },
|
|
89
|
+
})
|
|
90
|
+
: Promise.resolve([]),
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
const phoneContact = contacts.find((c) => c.contact_type.code === 'PHONE');
|
|
94
|
+
const cpfDoc = documents.find((d) => d.document_type.code === 'CPF');
|
|
95
|
+
const primaryAddress =
|
|
96
|
+
personAddresses.find((pa) => pa.address.is_primary)?.address ??
|
|
97
|
+
personAddresses[0]?.address;
|
|
98
|
+
|
|
99
|
+
const [street, number] = parseAddressLine1(primaryAddress?.line1);
|
|
100
|
+
const [neighborhood, complement] = parseAddressLine2(primaryAddress?.line2);
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
id: user?.id,
|
|
104
|
+
name: user?.name ?? null,
|
|
105
|
+
cpf: cpfDoc?.value ?? null,
|
|
106
|
+
dob: individual?.birth_date
|
|
107
|
+
? individual.birth_date.toISOString().slice(0, 10)
|
|
108
|
+
: null,
|
|
109
|
+
gender: mapGenderToDisplay(individual?.gender as string | null),
|
|
110
|
+
country: primaryAddress?.country_code ?? null,
|
|
111
|
+
city: primaryAddress?.city ?? null,
|
|
112
|
+
state: primaryAddress?.state ?? null,
|
|
113
|
+
neighborhood,
|
|
114
|
+
street,
|
|
115
|
+
number,
|
|
116
|
+
complement,
|
|
117
|
+
zip: primaryAddress?.postal_code ?? null,
|
|
118
|
+
phone: phoneContact?.value ?? null,
|
|
119
|
+
profession: individual?.job_title ?? null,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async updateProfile(userId: number, dto: UpdatePlatformaProfileDto) {
|
|
124
|
+
await this.prisma.$transaction(async (tx) => {
|
|
125
|
+
if (dto.name) {
|
|
126
|
+
await tx.user.update({
|
|
127
|
+
where: { id: userId },
|
|
128
|
+
data: { name: dto.name },
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let personUser = await tx.person_user.findFirst({
|
|
133
|
+
where: { user_id: userId },
|
|
134
|
+
});
|
|
135
|
+
let personId: number;
|
|
136
|
+
|
|
137
|
+
if (!personUser) {
|
|
138
|
+
const user = await tx.user.findUnique({ where: { id: userId } });
|
|
139
|
+
const newPerson = await tx.person.create({
|
|
140
|
+
data: {
|
|
141
|
+
name: dto.name ?? user?.name ?? '',
|
|
142
|
+
type: 'individual',
|
|
143
|
+
status: 'active',
|
|
144
|
+
} as any,
|
|
145
|
+
});
|
|
146
|
+
await tx.person_user.create({
|
|
147
|
+
data: { person_id: newPerson.id, user_id: userId },
|
|
148
|
+
});
|
|
149
|
+
personId = newPerson.id;
|
|
150
|
+
} else {
|
|
151
|
+
personId = personUser.person_id;
|
|
152
|
+
if (dto.name) {
|
|
153
|
+
await tx.person.update({
|
|
154
|
+
where: { id: personId },
|
|
155
|
+
data: { name: dto.name },
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const individualData: Record<string, unknown> = {};
|
|
161
|
+
if (dto.dob !== undefined) {
|
|
162
|
+
individualData.birth_date = dto.dob ? new Date(dto.dob) : null;
|
|
163
|
+
}
|
|
164
|
+
if (dto.gender !== undefined) {
|
|
165
|
+
individualData.gender = mapGenderToDb(dto.gender);
|
|
166
|
+
}
|
|
167
|
+
if (dto.profession !== undefined) {
|
|
168
|
+
individualData.job_title = dto.profession || null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
await (tx as any).person_individual.upsert({
|
|
172
|
+
where: { id: personId },
|
|
173
|
+
create: { id: personId, ...individualData },
|
|
174
|
+
update: individualData,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const phoneType = await tx.contact_type.findFirst({
|
|
178
|
+
where: { code: 'PHONE' },
|
|
179
|
+
});
|
|
180
|
+
if (phoneType && dto.phone !== undefined) {
|
|
181
|
+
const existingPhone = await tx.contact.findFirst({
|
|
182
|
+
where: { person_id: personId, contact_type_id: phoneType.id },
|
|
183
|
+
});
|
|
184
|
+
if (dto.phone) {
|
|
185
|
+
if (existingPhone) {
|
|
186
|
+
await tx.contact.update({
|
|
187
|
+
where: { id: existingPhone.id },
|
|
188
|
+
data: { value: dto.phone },
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
await tx.contact.create({
|
|
192
|
+
data: {
|
|
193
|
+
person_id: personId,
|
|
194
|
+
contact_type_id: phoneType.id,
|
|
195
|
+
value: dto.phone,
|
|
196
|
+
is_primary: true,
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
} else if (existingPhone) {
|
|
201
|
+
await tx.contact.delete({ where: { id: existingPhone.id } });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const cpfType = await tx.document_type.findFirst({
|
|
206
|
+
where: { code: 'CPF' },
|
|
207
|
+
});
|
|
208
|
+
if (cpfType && dto.cpf !== undefined) {
|
|
209
|
+
const existingCpf = await tx.document.findFirst({
|
|
210
|
+
where: { person_id: personId, document_type_id: cpfType.id },
|
|
211
|
+
});
|
|
212
|
+
if (dto.cpf) {
|
|
213
|
+
if (existingCpf) {
|
|
214
|
+
await tx.document.update({
|
|
215
|
+
where: { id: existingCpf.id },
|
|
216
|
+
data: { value: dto.cpf },
|
|
217
|
+
});
|
|
218
|
+
} else {
|
|
219
|
+
await tx.document.create({
|
|
220
|
+
data: {
|
|
221
|
+
person_id: personId,
|
|
222
|
+
document_type_id: cpfType.id,
|
|
223
|
+
value: dto.cpf,
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
} else if (existingCpf) {
|
|
228
|
+
await tx.document.delete({ where: { id: existingCpf.id } });
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const hasAddressData =
|
|
233
|
+
dto.street || dto.city || dto.state || dto.zip || dto.country;
|
|
234
|
+
if (hasAddressData) {
|
|
235
|
+
const existingPersonAddress = await tx.person_address.findFirst({
|
|
236
|
+
where: { person_id: personId },
|
|
237
|
+
include: { address: true },
|
|
238
|
+
orderBy: { address: { is_primary: 'desc' } },
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const addressData = {
|
|
242
|
+
country_code: dto.country ?? '',
|
|
243
|
+
state: dto.state ?? '',
|
|
244
|
+
city: dto.city ?? '',
|
|
245
|
+
postal_code: (dto.zip ?? '').replace(/\D/g, ''),
|
|
246
|
+
line1: buildLine1(dto.street, dto.number),
|
|
247
|
+
line2: buildLine2(dto.neighborhood, dto.complement),
|
|
248
|
+
is_primary: true,
|
|
249
|
+
address_type: 'residential' as const,
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
if (existingPersonAddress) {
|
|
253
|
+
await tx.address.update({
|
|
254
|
+
where: { id: existingPersonAddress.address_id },
|
|
255
|
+
data: addressData,
|
|
256
|
+
});
|
|
257
|
+
} else {
|
|
258
|
+
const newAddress = await tx.address.create({ data: addressData });
|
|
259
|
+
await tx.person_address.create({
|
|
260
|
+
data: { person_id: personId, address_id: newAddress.id },
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
return { success: true };
|
|
267
|
+
}
|
|
268
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { NoRole, Role, User } from '@hed-hog/api';
|
|
2
|
+
import { Body, Controller, Get, Param, ParseIntPipe, Post, Query } from '@nestjs/common';
|
|
3
|
+
import { GrantSkillCardXpDto } from './dto/grant-skill-card-xp.dto';
|
|
4
|
+
import { StudentXpService } from './student-xp.service';
|
|
5
|
+
|
|
6
|
+
@Role()
|
|
7
|
+
@Controller('lms/xp')
|
|
8
|
+
export class StudentXpController {
|
|
9
|
+
constructor(private readonly studentXpService: StudentXpService) {}
|
|
10
|
+
|
|
11
|
+
@Get('events')
|
|
12
|
+
listEvents(
|
|
13
|
+
@Query('page') page?: string,
|
|
14
|
+
@Query('pageSize') pageSize?: string,
|
|
15
|
+
@Query('personId') personId?: string,
|
|
16
|
+
@Query('courseLessonId') courseLessonId?: string,
|
|
17
|
+
@Query('source') source?: string,
|
|
18
|
+
) {
|
|
19
|
+
return this.studentXpService.listEvents({
|
|
20
|
+
page: Number(page) || 1,
|
|
21
|
+
pageSize: Number(pageSize) || 20,
|
|
22
|
+
personId: personId ? Number(personId) : undefined,
|
|
23
|
+
courseLessonId: courseLessonId ? Number(courseLessonId) : undefined,
|
|
24
|
+
source,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Get('balances/areas')
|
|
29
|
+
listAreaBalances(
|
|
30
|
+
@Query('page') page?: string,
|
|
31
|
+
@Query('pageSize') pageSize?: string,
|
|
32
|
+
@Query('personId') personId?: string,
|
|
33
|
+
@Query('areaId') areaId?: string,
|
|
34
|
+
) {
|
|
35
|
+
return this.studentXpService.listAreaBalances({
|
|
36
|
+
page: Number(page) || 1,
|
|
37
|
+
pageSize: Number(pageSize) || 20,
|
|
38
|
+
personId: personId ? Number(personId) : undefined,
|
|
39
|
+
areaId: areaId ? Number(areaId) : undefined,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Get('balances/skills')
|
|
44
|
+
listSkillBalances(
|
|
45
|
+
@Query('page') page?: string,
|
|
46
|
+
@Query('pageSize') pageSize?: string,
|
|
47
|
+
@Query('personId') personId?: string,
|
|
48
|
+
@Query('skillId') skillId?: string,
|
|
49
|
+
) {
|
|
50
|
+
return this.studentXpService.listSkillBalances({
|
|
51
|
+
page: Number(page) || 1,
|
|
52
|
+
pageSize: Number(pageSize) || 20,
|
|
53
|
+
personId: personId ? Number(personId) : undefined,
|
|
54
|
+
skillId: skillId ? Number(skillId) : undefined,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Get('balances/learning-types')
|
|
59
|
+
listLearningTypeBalances(
|
|
60
|
+
@Query('page') page?: string,
|
|
61
|
+
@Query('pageSize') pageSize?: string,
|
|
62
|
+
@Query('personId') personId?: string,
|
|
63
|
+
@Query('learningTypeId') learningTypeId?: string,
|
|
64
|
+
) {
|
|
65
|
+
return this.studentXpService.listLearningTypeBalances({
|
|
66
|
+
page: Number(page) || 1,
|
|
67
|
+
pageSize: Number(pageSize) || 20,
|
|
68
|
+
personId: personId ? Number(personId) : undefined,
|
|
69
|
+
learningTypeId: learningTypeId ? Number(learningTypeId) : undefined,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@Get('balances/person/:personId')
|
|
74
|
+
getPersonBalanceSummary(@Param('personId', ParseIntPipe) personId: number) {
|
|
75
|
+
return this.studentXpService.getPersonBalanceSummary(personId);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@Get('my-balance')
|
|
79
|
+
@NoRole()
|
|
80
|
+
getMyBalance(@User('id') userId: number) {
|
|
81
|
+
return this.studentXpService.getMyBalance(userId);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Post('skill-card')
|
|
85
|
+
@NoRole()
|
|
86
|
+
grantSkillCardXp(
|
|
87
|
+
@User('id') userId: number,
|
|
88
|
+
@Body() dto: GrantSkillCardXpDto,
|
|
89
|
+
) {
|
|
90
|
+
return this.studentXpService.grantSkillCardXp(userId, dto);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PrismaModule } from '@hed-hog/api-prisma';
|
|
2
|
+
import { forwardRef, Module } from '@nestjs/common';
|
|
3
|
+
import { StudentXpController } from './student-xp.controller';
|
|
4
|
+
import { StudentXpService } from './student-xp.service';
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
imports: [forwardRef(() => PrismaModule)],
|
|
8
|
+
controllers: [StudentXpController],
|
|
9
|
+
providers: [StudentXpService],
|
|
10
|
+
exports: [StudentXpService],
|
|
11
|
+
})
|
|
12
|
+
export class StudentXpModule {}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import {
|
|
3
|
+
BadRequestException,
|
|
4
|
+
Injectable,
|
|
5
|
+
NotFoundException,
|
|
6
|
+
} from '@nestjs/common';
|
|
7
|
+
import { GrantSkillCardXpDto } from './dto/grant-skill-card-xp.dto';
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class StudentXpService {
|
|
11
|
+
constructor(private readonly prisma: PrismaService) {}
|
|
12
|
+
|
|
13
|
+
async listEvents(params: {
|
|
14
|
+
page?: number;
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
personId?: number;
|
|
17
|
+
courseLessonId?: number;
|
|
18
|
+
source?: string;
|
|
19
|
+
}) {
|
|
20
|
+
const page = Math.max(Number(params.page) || 1, 1);
|
|
21
|
+
const pageSize = Math.max(Number(params.pageSize) || 20, 1);
|
|
22
|
+
const offset = (page - 1) * pageSize;
|
|
23
|
+
|
|
24
|
+
const values: unknown[] = [];
|
|
25
|
+
const where: string[] = ['1 = 1'];
|
|
26
|
+
|
|
27
|
+
if (params.personId) {
|
|
28
|
+
where.push(`ce.person_id = ${this.param(values, params.personId)}`);
|
|
29
|
+
}
|
|
30
|
+
if (params.courseLessonId) {
|
|
31
|
+
where.push(`m.course_lesson_id = ${this.param(values, params.courseLessonId)}`);
|
|
32
|
+
}
|
|
33
|
+
if (params.source?.trim()) {
|
|
34
|
+
where.push(`e.source::text = ${this.param(values, params.source.trim())}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const whereClause = where.join(' AND ');
|
|
38
|
+
|
|
39
|
+
const totalRow = await this.querySingle<{ total: string }>(
|
|
40
|
+
`SELECT COUNT(*)::text AS total
|
|
41
|
+
FROM student_xp_event e
|
|
42
|
+
JOIN course_enrollment ce ON ce.id = e.course_enrollment_id
|
|
43
|
+
JOIN lesson_xp_segment s ON s.id = e.lesson_xp_segment_id
|
|
44
|
+
JOIN lesson_xp_map m ON m.id = s.lesson_xp_map_id
|
|
45
|
+
WHERE ${whereClause}`,
|
|
46
|
+
values,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const q = [...values];
|
|
50
|
+
const rows = await this.queryRows<any>(
|
|
51
|
+
`SELECT
|
|
52
|
+
e.id,
|
|
53
|
+
e.course_enrollment_id AS "courseEnrollmentId",
|
|
54
|
+
ce.person_id AS "personId",
|
|
55
|
+
e.lesson_xp_segment_id AS "lessonXpSegmentId",
|
|
56
|
+
m.course_lesson_id AS "courseLessonId",
|
|
57
|
+
e.xp_earned AS "xpEarned",
|
|
58
|
+
e.watch_percent::float AS "watchPercent",
|
|
59
|
+
e.granted_at::text AS "grantedAt",
|
|
60
|
+
e.source::text AS source,
|
|
61
|
+
e.created_at::text AS "createdAt"
|
|
62
|
+
FROM student_xp_event e
|
|
63
|
+
JOIN course_enrollment ce ON ce.id = e.course_enrollment_id
|
|
64
|
+
JOIN lesson_xp_segment s ON s.id = e.lesson_xp_segment_id
|
|
65
|
+
JOIN lesson_xp_map m ON m.id = s.lesson_xp_map_id
|
|
66
|
+
WHERE ${whereClause}
|
|
67
|
+
ORDER BY e.granted_at DESC
|
|
68
|
+
LIMIT ${this.param(q, pageSize)} OFFSET ${this.param(q, offset)}`,
|
|
69
|
+
q,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const total = Number(totalRow?.total ?? 0);
|
|
73
|
+
return { data: rows, total, page, pageSize, lastPage: Math.ceil(total / pageSize) };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async listAreaBalances(params: { page?: number; pageSize?: number; personId?: number; areaId?: number }) {
|
|
77
|
+
const page = Math.max(Number(params.page) || 1, 1);
|
|
78
|
+
const pageSize = Math.max(Number(params.pageSize) || 20, 1);
|
|
79
|
+
const offset = (page - 1) * pageSize;
|
|
80
|
+
|
|
81
|
+
const values: unknown[] = [];
|
|
82
|
+
const where: string[] = ['1 = 1'];
|
|
83
|
+
if (params.personId) where.push(`b.person_id = ${this.param(values, params.personId)}`);
|
|
84
|
+
if (params.areaId) where.push(`b.xp_area_id = ${this.param(values, params.areaId)}`);
|
|
85
|
+
const whereClause = where.join(' AND ');
|
|
86
|
+
|
|
87
|
+
const totalRow = await this.querySingle<{ total: string }>(
|
|
88
|
+
`SELECT COUNT(*)::text AS total FROM student_area_xp b WHERE ${whereClause}`,
|
|
89
|
+
values,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const q = [...values];
|
|
93
|
+
const rows = await this.queryRows<any>(
|
|
94
|
+
`SELECT
|
|
95
|
+
b.id, b.person_id AS "personId", b.xp_area_id AS "xpAreaId",
|
|
96
|
+
COALESCE(l.name, a.slug) AS "areaName",
|
|
97
|
+
b.total_xp AS "totalXp", b.event_count AS "eventCount",
|
|
98
|
+
b.last_updated_at::text AS "lastUpdatedAt"
|
|
99
|
+
FROM student_area_xp b
|
|
100
|
+
JOIN xp_area a ON a.id = b.xp_area_id
|
|
101
|
+
LEFT JOIN xp_area_locale l ON l.xp_area_id = a.id
|
|
102
|
+
AND l.locale_id = (SELECT id FROM locale WHERE code = 'pt' LIMIT 1)
|
|
103
|
+
WHERE ${whereClause}
|
|
104
|
+
ORDER BY b.total_xp DESC
|
|
105
|
+
LIMIT ${this.param(q, pageSize)} OFFSET ${this.param(q, offset)}`,
|
|
106
|
+
q,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const total = Number(totalRow?.total ?? 0);
|
|
110
|
+
return { data: rows, total, page, pageSize, lastPage: Math.ceil(total / pageSize) };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async listSkillBalances(params: { page?: number; pageSize?: number; personId?: number; skillId?: number }) {
|
|
114
|
+
const page = Math.max(Number(params.page) || 1, 1);
|
|
115
|
+
const pageSize = Math.max(Number(params.pageSize) || 20, 1);
|
|
116
|
+
const offset = (page - 1) * pageSize;
|
|
117
|
+
|
|
118
|
+
const values: unknown[] = [];
|
|
119
|
+
const where: string[] = ['1 = 1'];
|
|
120
|
+
if (params.personId) where.push(`b.person_id = ${this.param(values, params.personId)}`);
|
|
121
|
+
if (params.skillId) where.push(`b.xp_skill_id = ${this.param(values, params.skillId)}`);
|
|
122
|
+
const whereClause = where.join(' AND ');
|
|
123
|
+
|
|
124
|
+
const totalRow = await this.querySingle<{ total: string }>(
|
|
125
|
+
`SELECT COUNT(*)::text AS total FROM student_skill_xp b WHERE ${whereClause}`,
|
|
126
|
+
values,
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const q = [...values];
|
|
130
|
+
const rows = await this.queryRows<any>(
|
|
131
|
+
`SELECT
|
|
132
|
+
b.id, b.person_id AS "personId", b.xp_skill_id AS "xpSkillId",
|
|
133
|
+
COALESCE(l.name, s.slug) AS "skillName",
|
|
134
|
+
b.total_xp AS "totalXp", b.event_count AS "eventCount",
|
|
135
|
+
b.last_updated_at::text AS "lastUpdatedAt"
|
|
136
|
+
FROM student_skill_xp b
|
|
137
|
+
JOIN xp_skill s ON s.id = b.xp_skill_id
|
|
138
|
+
LEFT JOIN xp_skill_locale l ON l.xp_skill_id = s.id
|
|
139
|
+
AND l.locale_id = (SELECT id FROM locale WHERE code = 'pt' LIMIT 1)
|
|
140
|
+
WHERE ${whereClause}
|
|
141
|
+
ORDER BY b.total_xp DESC
|
|
142
|
+
LIMIT ${this.param(q, pageSize)} OFFSET ${this.param(q, offset)}`,
|
|
143
|
+
q,
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const total = Number(totalRow?.total ?? 0);
|
|
147
|
+
return { data: rows, total, page, pageSize, lastPage: Math.ceil(total / pageSize) };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async listLearningTypeBalances(params: { page?: number; pageSize?: number; personId?: number; learningTypeId?: number }) {
|
|
151
|
+
const page = Math.max(Number(params.page) || 1, 1);
|
|
152
|
+
const pageSize = Math.max(Number(params.pageSize) || 20, 1);
|
|
153
|
+
const offset = (page - 1) * pageSize;
|
|
154
|
+
|
|
155
|
+
const values: unknown[] = [];
|
|
156
|
+
const where: string[] = ['1 = 1'];
|
|
157
|
+
if (params.personId) where.push(`b.person_id = ${this.param(values, params.personId)}`);
|
|
158
|
+
if (params.learningTypeId) where.push(`b.xp_learning_type_id = ${this.param(values, params.learningTypeId)}`);
|
|
159
|
+
const whereClause = where.join(' AND ');
|
|
160
|
+
|
|
161
|
+
const totalRow = await this.querySingle<{ total: string }>(
|
|
162
|
+
`SELECT COUNT(*)::text AS total FROM student_learning_type_xp b WHERE ${whereClause}`,
|
|
163
|
+
values,
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const q = [...values];
|
|
167
|
+
const rows = await this.queryRows<any>(
|
|
168
|
+
`SELECT
|
|
169
|
+
b.id, b.person_id AS "personId", b.xp_learning_type_id AS "xpLearningTypeId",
|
|
170
|
+
COALESCE(l.name, t.slug) AS "learningTypeName",
|
|
171
|
+
b.total_xp AS "totalXp", b.event_count AS "eventCount",
|
|
172
|
+
b.last_updated_at::text AS "lastUpdatedAt"
|
|
173
|
+
FROM student_learning_type_xp b
|
|
174
|
+
JOIN xp_learning_type t ON t.id = b.xp_learning_type_id
|
|
175
|
+
LEFT JOIN xp_learning_type_locale l ON l.xp_learning_type_id = t.id
|
|
176
|
+
AND l.locale_id = (SELECT id FROM locale WHERE code = 'pt' LIMIT 1)
|
|
177
|
+
WHERE ${whereClause}
|
|
178
|
+
ORDER BY b.total_xp DESC
|
|
179
|
+
LIMIT ${this.param(q, pageSize)} OFFSET ${this.param(q, offset)}`,
|
|
180
|
+
q,
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const total = Number(totalRow?.total ?? 0);
|
|
184
|
+
return { data: rows, total, page, pageSize, lastPage: Math.ceil(total / pageSize) };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async getPersonBalanceSummary(personId: number) {
|
|
188
|
+
const [areas, skills, learningTypes, totalRow] = await Promise.all([
|
|
189
|
+
this.queryRows<any>(
|
|
190
|
+
`SELECT b.xp_area_id AS "xpAreaId", COALESCE(l.name, a.slug) AS name, b.total_xp AS "totalXp", b.event_count AS "eventCount"
|
|
191
|
+
FROM student_area_xp b
|
|
192
|
+
JOIN xp_area a ON a.id = b.xp_area_id
|
|
193
|
+
LEFT JOIN xp_area_locale l ON l.xp_area_id = a.id AND l.locale_id = (SELECT id FROM locale WHERE code = 'pt' LIMIT 1)
|
|
194
|
+
WHERE b.person_id = $1 ORDER BY b.total_xp DESC`,
|
|
195
|
+
[personId],
|
|
196
|
+
),
|
|
197
|
+
this.queryRows<any>(
|
|
198
|
+
`SELECT b.xp_skill_id AS "xpSkillId", COALESCE(l.name, s.slug) AS name, b.total_xp AS "totalXp", b.event_count AS "eventCount"
|
|
199
|
+
FROM student_skill_xp b
|
|
200
|
+
JOIN xp_skill s ON s.id = b.xp_skill_id
|
|
201
|
+
LEFT JOIN xp_skill_locale l ON l.xp_skill_id = s.id AND l.locale_id = (SELECT id FROM locale WHERE code = 'pt' LIMIT 1)
|
|
202
|
+
WHERE b.person_id = $1 ORDER BY b.total_xp DESC`,
|
|
203
|
+
[personId],
|
|
204
|
+
),
|
|
205
|
+
this.queryRows<any>(
|
|
206
|
+
`SELECT b.xp_learning_type_id AS "xpLearningTypeId", COALESCE(l.name, t.slug) AS name, b.total_xp AS "totalXp", b.event_count AS "eventCount"
|
|
207
|
+
FROM student_learning_type_xp b
|
|
208
|
+
JOIN xp_learning_type t ON t.id = b.xp_learning_type_id
|
|
209
|
+
LEFT JOIN xp_learning_type_locale l ON l.xp_learning_type_id = t.id AND l.locale_id = (SELECT id FROM locale WHERE code = 'pt' LIMIT 1)
|
|
210
|
+
WHERE b.person_id = $1 ORDER BY b.total_xp DESC`,
|
|
211
|
+
[personId],
|
|
212
|
+
),
|
|
213
|
+
this.querySingle<{ total: string }>(
|
|
214
|
+
`SELECT GREATEST(
|
|
215
|
+
(SELECT COALESCE(SUM(total_xp), 0) FROM student_area_xp WHERE person_id = $1),
|
|
216
|
+
(SELECT COALESCE(SUM(total_xp), 0) FROM student_skill_xp WHERE person_id = $1),
|
|
217
|
+
(SELECT COALESCE(SUM(total_xp), 0) FROM student_learning_type_xp WHERE person_id = $1)
|
|
218
|
+
)::text AS total`,
|
|
219
|
+
[personId],
|
|
220
|
+
),
|
|
221
|
+
]);
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
personId,
|
|
225
|
+
totalXp: Number(totalRow?.total ?? 0),
|
|
226
|
+
areas,
|
|
227
|
+
skills,
|
|
228
|
+
learningTypes,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
private param(values: unknown[], value: unknown) {
|
|
233
|
+
values.push(value);
|
|
234
|
+
return `$${values.length}`;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private async queryRows<T>(query: string, values: unknown[] = []) {
|
|
238
|
+
return this.prisma.$queryRawUnsafe<T[]>(query, ...values);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private async querySingle<T>(query: string, values: unknown[] = []) {
|
|
242
|
+
const rows = await this.prisma.$queryRawUnsafe<T[]>(query, ...values);
|
|
243
|
+
return rows[0] ?? null;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private async resolvePersonId(userId: number): Promise<number> {
|
|
247
|
+
const row = await this.querySingle<{ personId: number }>(
|
|
248
|
+
`SELECT person_id AS "personId" FROM person_user WHERE user_id = $1 LIMIT 1`,
|
|
249
|
+
[userId],
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
if (!row) {
|
|
253
|
+
throw new NotFoundException('No person profile found for this user');
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return Number(row.personId);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
async getMyBalance(userId: number) {
|
|
260
|
+
const personId = await this.resolvePersonId(userId);
|
|
261
|
+
return this.getPersonBalanceSummary(personId);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async grantSkillCardXp(userId: number, dto: GrantSkillCardXpDto) {
|
|
265
|
+
const skillCardSlug = String(dto.skillCardSlug ?? '').trim();
|
|
266
|
+
|
|
267
|
+
if (!skillCardSlug) {
|
|
268
|
+
throw new BadRequestException('Skill card slug is required');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const parsedXpEarned = Math.trunc(Number(dto.xpEarned));
|
|
272
|
+
const xpEarned = Number.isFinite(parsedXpEarned)
|
|
273
|
+
? Math.max(1, parsedXpEarned)
|
|
274
|
+
: 1;
|
|
275
|
+
const personId = await this.resolvePersonId(userId);
|
|
276
|
+
|
|
277
|
+
const skill = await this.querySingle<{ id: number; xpAreaId: number | null }>(
|
|
278
|
+
`SELECT id, xp_area_id AS "xpAreaId" FROM xp_skill WHERE slug = $1 LIMIT 1`,
|
|
279
|
+
[skillCardSlug],
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
if (!skill) {
|
|
283
|
+
throw new NotFoundException('XP skill not found');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
await this.prisma.$transaction(async (tx) => {
|
|
287
|
+
await tx.$executeRawUnsafe(
|
|
288
|
+
`INSERT INTO student_skill_xp (person_id, xp_skill_id, total_xp, event_count, last_updated_at, created_at, updated_at)
|
|
289
|
+
VALUES ($1, $2, $3, 1, now(), now(), now())
|
|
290
|
+
ON CONFLICT (person_id, xp_skill_id) DO UPDATE
|
|
291
|
+
SET total_xp = student_skill_xp.total_xp + EXCLUDED.total_xp,
|
|
292
|
+
event_count = student_skill_xp.event_count + 1,
|
|
293
|
+
last_updated_at = now(),
|
|
294
|
+
updated_at = now()`,
|
|
295
|
+
personId,
|
|
296
|
+
skill.id,
|
|
297
|
+
xpEarned,
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
if (skill.xpAreaId) {
|
|
301
|
+
await tx.$executeRawUnsafe(
|
|
302
|
+
`INSERT INTO student_area_xp (person_id, xp_area_id, total_xp, event_count, last_updated_at, created_at, updated_at)
|
|
303
|
+
VALUES ($1, $2, $3, 1, now(), now(), now())
|
|
304
|
+
ON CONFLICT (person_id, xp_area_id) DO UPDATE
|
|
305
|
+
SET total_xp = student_area_xp.total_xp + EXCLUDED.total_xp,
|
|
306
|
+
event_count = student_area_xp.event_count + 1,
|
|
307
|
+
last_updated_at = now(),
|
|
308
|
+
updated_at = now()`,
|
|
309
|
+
personId,
|
|
310
|
+
skill.xpAreaId,
|
|
311
|
+
xpEarned,
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
return this.getPersonBalanceSummary(personId);
|
|
317
|
+
}
|
|
318
|
+
}
|