@hed-hog/lms 0.0.304 → 0.0.305

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/README.md +413 -401
  2. package/dist/certificate/certificate.controller.d.ts +90 -0
  3. package/dist/certificate/certificate.controller.d.ts.map +1 -0
  4. package/dist/certificate/certificate.controller.js +121 -0
  5. package/dist/certificate/certificate.controller.js.map +1 -0
  6. package/dist/certificate/certificate.module.d.ts +3 -0
  7. package/dist/certificate/certificate.module.d.ts.map +1 -0
  8. package/dist/certificate/certificate.module.js +26 -0
  9. package/dist/certificate/certificate.module.js.map +1 -0
  10. package/dist/certificate/certificate.service.d.ts +115 -0
  11. package/dist/certificate/certificate.service.d.ts.map +1 -0
  12. package/dist/certificate/certificate.service.js +343 -0
  13. package/dist/certificate/certificate.service.js.map +1 -0
  14. package/dist/certificate/dto/create-certificate-template.dto.d.ts +8 -0
  15. package/dist/certificate/dto/create-certificate-template.dto.d.ts.map +1 -0
  16. package/dist/certificate/dto/create-certificate-template.dto.js +44 -0
  17. package/dist/certificate/dto/create-certificate-template.dto.js.map +1 -0
  18. package/dist/certificate/dto/update-certificate-template.dto.d.ts +6 -0
  19. package/dist/certificate/dto/update-certificate-template.dto.d.ts.map +1 -0
  20. package/dist/certificate/dto/update-certificate-template.dto.js +9 -0
  21. package/dist/certificate/dto/update-certificate-template.dto.js.map +1 -0
  22. package/dist/class-group/class-group.controller.d.ts +305 -0
  23. package/dist/class-group/class-group.controller.d.ts.map +1 -0
  24. package/dist/class-group/class-group.controller.js +257 -0
  25. package/dist/class-group/class-group.controller.js.map +1 -0
  26. package/dist/class-group/class-group.module.d.ts +3 -0
  27. package/dist/class-group/class-group.module.d.ts.map +1 -0
  28. package/dist/class-group/class-group.module.js +25 -0
  29. package/dist/class-group/class-group.module.js.map +1 -0
  30. package/dist/class-group/class-group.service.d.ts +354 -0
  31. package/dist/class-group/class-group.service.d.ts.map +1 -0
  32. package/dist/class-group/class-group.service.js +1356 -0
  33. package/dist/class-group/class-group.service.js.map +1 -0
  34. package/dist/class-group/dto/create-class-group.dto.d.ts +33 -0
  35. package/dist/class-group/dto/create-class-group.dto.d.ts.map +1 -0
  36. package/dist/class-group/dto/create-class-group.dto.js +165 -0
  37. package/dist/class-group/dto/create-class-group.dto.js.map +1 -0
  38. package/dist/class-group/dto/create-session.dto.d.ts +22 -0
  39. package/dist/class-group/dto/create-session.dto.d.ts.map +1 -0
  40. package/dist/class-group/dto/create-session.dto.js +117 -0
  41. package/dist/class-group/dto/create-session.dto.js.map +1 -0
  42. package/dist/class-group/dto/enrollment.dto.d.ts +22 -0
  43. package/dist/class-group/dto/enrollment.dto.d.ts.map +1 -0
  44. package/dist/class-group/dto/enrollment.dto.js +89 -0
  45. package/dist/class-group/dto/enrollment.dto.js.map +1 -0
  46. package/dist/class-group/dto/update-class-group.dto.d.ts +6 -0
  47. package/dist/class-group/dto/update-class-group.dto.d.ts.map +1 -0
  48. package/dist/class-group/dto/update-class-group.dto.js +9 -0
  49. package/dist/class-group/dto/update-class-group.dto.js.map +1 -0
  50. package/dist/class-group/dto/update-session.dto.d.ts +7 -0
  51. package/dist/class-group/dto/update-session.dto.d.ts.map +1 -0
  52. package/dist/class-group/dto/update-session.dto.js +24 -0
  53. package/dist/class-group/dto/update-session.dto.js.map +1 -0
  54. package/dist/course/course-structure.controller.d.ts +127 -0
  55. package/dist/course/course-structure.controller.d.ts.map +1 -0
  56. package/dist/course/course-structure.controller.js +115 -0
  57. package/dist/course/course-structure.controller.js.map +1 -0
  58. package/dist/course/course-structure.service.d.ts +142 -0
  59. package/dist/course/course-structure.service.d.ts.map +1 -0
  60. package/dist/course/course-structure.service.js +445 -0
  61. package/dist/course/course-structure.service.js.map +1 -0
  62. package/dist/course/course.controller.d.ts +195 -0
  63. package/dist/course/course.controller.d.ts.map +1 -0
  64. package/dist/course/course.controller.js +104 -0
  65. package/dist/course/course.controller.js.map +1 -0
  66. package/dist/course/course.module.d.ts +3 -0
  67. package/dist/course/course.module.d.ts.map +1 -0
  68. package/dist/course/course.module.js +28 -0
  69. package/dist/course/course.module.js.map +1 -0
  70. package/dist/course/course.service.d.ts +215 -0
  71. package/dist/course/course.service.d.ts.map +1 -0
  72. package/dist/course/course.service.js +743 -0
  73. package/dist/course/course.service.js.map +1 -0
  74. package/dist/course/dto/create-course-structure-lesson.dto.d.ts +24 -0
  75. package/dist/course/dto/create-course-structure-lesson.dto.d.ts.map +1 -0
  76. package/dist/course/dto/create-course-structure-lesson.dto.js +118 -0
  77. package/dist/course/dto/create-course-structure-lesson.dto.js.map +1 -0
  78. package/dist/course/dto/create-course-structure-session.dto.d.ts +7 -0
  79. package/dist/course/dto/create-course-structure-session.dto.d.ts.map +1 -0
  80. package/dist/course/dto/create-course-structure-session.dto.js +40 -0
  81. package/dist/course/dto/create-course-structure-session.dto.js.map +1 -0
  82. package/dist/course/dto/create-course.dto.d.ts +26 -0
  83. package/dist/course/dto/create-course.dto.d.ts.map +1 -0
  84. package/dist/course/dto/create-course.dto.js +138 -0
  85. package/dist/course/dto/create-course.dto.js.map +1 -0
  86. package/dist/course/dto/update-course-structure-lesson.dto.d.ts +6 -0
  87. package/dist/course/dto/update-course-structure-lesson.dto.d.ts.map +1 -0
  88. package/dist/course/dto/update-course-structure-lesson.dto.js +9 -0
  89. package/dist/course/dto/update-course-structure-lesson.dto.js.map +1 -0
  90. package/dist/course/dto/update-course-structure-session.dto.d.ts +6 -0
  91. package/dist/course/dto/update-course-structure-session.dto.d.ts.map +1 -0
  92. package/dist/course/dto/update-course-structure-session.dto.js +9 -0
  93. package/dist/course/dto/update-course-structure-session.dto.js.map +1 -0
  94. package/dist/course/dto/update-course.dto.d.ts +6 -0
  95. package/dist/course/dto/update-course.dto.d.ts.map +1 -0
  96. package/dist/course/dto/update-course.dto.js +9 -0
  97. package/dist/course/dto/update-course.dto.js.map +1 -0
  98. package/dist/dashboard/dashboard.controller.d.ts +101 -0
  99. package/dist/dashboard/dashboard.controller.d.ts.map +1 -0
  100. package/dist/dashboard/dashboard.controller.js +40 -0
  101. package/dist/dashboard/dashboard.controller.js.map +1 -0
  102. package/dist/dashboard/dashboard.module.d.ts +3 -0
  103. package/dist/dashboard/dashboard.module.d.ts.map +1 -0
  104. package/dist/dashboard/dashboard.module.js +25 -0
  105. package/dist/dashboard/dashboard.module.js.map +1 -0
  106. package/dist/dashboard/dashboard.service.d.ts +130 -0
  107. package/dist/dashboard/dashboard.service.d.ts.map +1 -0
  108. package/dist/dashboard/dashboard.service.js +626 -0
  109. package/dist/dashboard/dashboard.service.js.map +1 -0
  110. package/dist/enterprise/dto/add-enterprise-class-group.dto.d.ts +4 -0
  111. package/dist/enterprise/dto/add-enterprise-class-group.dto.d.ts.map +1 -0
  112. package/dist/enterprise/dto/add-enterprise-class-group.dto.js +22 -0
  113. package/dist/enterprise/dto/add-enterprise-class-group.dto.js.map +1 -0
  114. package/dist/enterprise/dto/add-enterprise-course.dto.d.ts +5 -0
  115. package/dist/enterprise/dto/add-enterprise-course.dto.d.ts.map +1 -0
  116. package/dist/enterprise/dto/add-enterprise-course.dto.js +27 -0
  117. package/dist/enterprise/dto/add-enterprise-course.dto.js.map +1 -0
  118. package/dist/enterprise/dto/add-enterprise-lead.dto.d.ts +4 -0
  119. package/dist/enterprise/dto/add-enterprise-lead.dto.d.ts.map +1 -0
  120. package/dist/enterprise/dto/add-enterprise-lead.dto.js +22 -0
  121. package/dist/enterprise/dto/add-enterprise-lead.dto.js.map +1 -0
  122. package/dist/enterprise/dto/add-enterprise-student.dto.d.ts +5 -0
  123. package/dist/enterprise/dto/add-enterprise-student.dto.d.ts.map +1 -0
  124. package/dist/enterprise/dto/add-enterprise-student.dto.js +27 -0
  125. package/dist/enterprise/dto/add-enterprise-student.dto.js.map +1 -0
  126. package/dist/enterprise/dto/add-enterprise-user.dto.d.ts +7 -0
  127. package/dist/enterprise/dto/add-enterprise-user.dto.d.ts.map +1 -0
  128. package/dist/enterprise/dto/add-enterprise-user.dto.js +36 -0
  129. package/dist/enterprise/dto/add-enterprise-user.dto.js.map +1 -0
  130. package/dist/enterprise/dto/create-enterprise.dto.d.ts +10 -0
  131. package/dist/enterprise/dto/create-enterprise.dto.d.ts.map +1 -0
  132. package/dist/enterprise/dto/create-enterprise.dto.js +54 -0
  133. package/dist/enterprise/dto/create-enterprise.dto.js.map +1 -0
  134. package/dist/enterprise/dto/update-enterprise-student.dto.d.ts +4 -0
  135. package/dist/enterprise/dto/update-enterprise-student.dto.d.ts.map +1 -0
  136. package/dist/enterprise/dto/update-enterprise-student.dto.js +22 -0
  137. package/dist/enterprise/dto/update-enterprise-student.dto.js.map +1 -0
  138. package/dist/enterprise/dto/update-enterprise-user.dto.d.ts +5 -0
  139. package/dist/enterprise/dto/update-enterprise-user.dto.d.ts.map +1 -0
  140. package/dist/enterprise/dto/update-enterprise-user.dto.js +27 -0
  141. package/dist/enterprise/dto/update-enterprise-user.dto.js.map +1 -0
  142. package/dist/enterprise/dto/update-enterprise.dto.d.ts +6 -0
  143. package/dist/enterprise/dto/update-enterprise.dto.d.ts.map +1 -0
  144. package/dist/enterprise/dto/update-enterprise.dto.js +9 -0
  145. package/dist/enterprise/dto/update-enterprise.dto.js.map +1 -0
  146. package/dist/enterprise/enterprise.controller.d.ts +269 -0
  147. package/dist/enterprise/enterprise.controller.d.ts.map +1 -0
  148. package/dist/enterprise/enterprise.controller.js +311 -0
  149. package/dist/enterprise/enterprise.controller.js.map +1 -0
  150. package/dist/enterprise/enterprise.module.d.ts +3 -0
  151. package/dist/enterprise/enterprise.module.d.ts.map +1 -0
  152. package/dist/enterprise/enterprise.module.js +25 -0
  153. package/dist/enterprise/enterprise.module.js.map +1 -0
  154. package/dist/enterprise/enterprise.service.d.ts +282 -0
  155. package/dist/enterprise/enterprise.service.d.ts.map +1 -0
  156. package/dist/enterprise/enterprise.service.js +627 -0
  157. package/dist/enterprise/enterprise.service.js.map +1 -0
  158. package/dist/evaluation/evaluation.controller.d.ts +56 -0
  159. package/dist/evaluation/evaluation.controller.d.ts.map +1 -0
  160. package/dist/evaluation/evaluation.controller.js +76 -0
  161. package/dist/evaluation/evaluation.controller.js.map +1 -0
  162. package/dist/evaluation/evaluation.module.d.ts +3 -0
  163. package/dist/evaluation/evaluation.module.d.ts.map +1 -0
  164. package/dist/evaluation/evaluation.module.js +25 -0
  165. package/dist/evaluation/evaluation.module.js.map +1 -0
  166. package/dist/evaluation/evaluation.service.d.ts +67 -0
  167. package/dist/evaluation/evaluation.service.d.ts.map +1 -0
  168. package/dist/evaluation/evaluation.service.js +378 -0
  169. package/dist/evaluation/evaluation.service.js.map +1 -0
  170. package/dist/exam/dto/create-exam-question.dto.d.ts +25 -0
  171. package/dist/exam/dto/create-exam-question.dto.d.ts.map +1 -0
  172. package/dist/exam/dto/create-exam-question.dto.js +117 -0
  173. package/dist/exam/dto/create-exam-question.dto.js.map +1 -0
  174. package/dist/exam/dto/create-exam.dto.d.ts +11 -0
  175. package/dist/exam/dto/create-exam.dto.d.ts.map +1 -0
  176. package/dist/exam/dto/create-exam.dto.js +63 -0
  177. package/dist/exam/dto/create-exam.dto.js.map +1 -0
  178. package/dist/exam/dto/reorder-exam-questions.dto.d.ts +4 -0
  179. package/dist/exam/dto/reorder-exam-questions.dto.d.ts.map +1 -0
  180. package/dist/exam/dto/reorder-exam-questions.dto.js +23 -0
  181. package/dist/exam/dto/reorder-exam-questions.dto.js.map +1 -0
  182. package/dist/exam/dto/save-exam-attempt-answers.dto.d.ts +14 -0
  183. package/dist/exam/dto/save-exam-attempt-answers.dto.d.ts.map +1 -0
  184. package/dist/exam/dto/save-exam-attempt-answers.dto.js +68 -0
  185. package/dist/exam/dto/save-exam-attempt-answers.dto.js.map +1 -0
  186. package/dist/exam/dto/start-exam-attempt.dto.d.ts +4 -0
  187. package/dist/exam/dto/start-exam-attempt.dto.d.ts.map +1 -0
  188. package/dist/exam/dto/start-exam-attempt.dto.js +23 -0
  189. package/dist/exam/dto/start-exam-attempt.dto.js.map +1 -0
  190. package/dist/exam/dto/submit-exam-attempt.dto.d.ts +5 -0
  191. package/dist/exam/dto/submit-exam-attempt.dto.d.ts.map +1 -0
  192. package/dist/exam/dto/submit-exam-attempt.dto.js +23 -0
  193. package/dist/exam/dto/submit-exam-attempt.dto.js.map +1 -0
  194. package/dist/exam/dto/update-exam-question.dto.d.ts +6 -0
  195. package/dist/exam/dto/update-exam-question.dto.d.ts.map +1 -0
  196. package/dist/exam/dto/update-exam-question.dto.js +9 -0
  197. package/dist/exam/dto/update-exam-question.dto.js.map +1 -0
  198. package/dist/exam/dto/update-exam.dto.d.ts +6 -0
  199. package/dist/exam/dto/update-exam.dto.d.ts.map +1 -0
  200. package/dist/exam/dto/update-exam.dto.js +9 -0
  201. package/dist/exam/dto/update-exam.dto.js.map +1 -0
  202. package/dist/exam/exam-attempt.controller.d.ts +273 -0
  203. package/dist/exam/exam-attempt.controller.d.ts.map +1 -0
  204. package/dist/exam/exam-attempt.controller.js +84 -0
  205. package/dist/exam/exam-attempt.controller.js.map +1 -0
  206. package/dist/exam/exam-attempt.service.d.ts +302 -0
  207. package/dist/exam/exam-attempt.service.d.ts.map +1 -0
  208. package/dist/exam/exam-attempt.service.js +776 -0
  209. package/dist/exam/exam-attempt.service.js.map +1 -0
  210. package/dist/exam/exam.controller.d.ts +162 -0
  211. package/dist/exam/exam.controller.d.ts.map +1 -0
  212. package/dist/exam/exam.controller.js +158 -0
  213. package/dist/exam/exam.controller.js.map +1 -0
  214. package/dist/exam/exam.module.d.ts +3 -0
  215. package/dist/exam/exam.module.d.ts.map +1 -0
  216. package/dist/exam/exam.module.js +27 -0
  217. package/dist/exam/exam.module.js.map +1 -0
  218. package/dist/exam/exam.service.d.ts +179 -0
  219. package/dist/exam/exam.service.d.ts.map +1 -0
  220. package/dist/exam/exam.service.js +597 -0
  221. package/dist/exam/exam.service.js.map +1 -0
  222. package/dist/index.d.ts +28 -0
  223. package/dist/index.d.ts.map +1 -1
  224. package/dist/index.js +28 -0
  225. package/dist/index.js.map +1 -1
  226. package/dist/instructor/dto/create-instructor.dto.d.ts +10 -0
  227. package/dist/instructor/dto/create-instructor.dto.d.ts.map +1 -0
  228. package/dist/instructor/dto/create-instructor.dto.js +55 -0
  229. package/dist/instructor/dto/create-instructor.dto.js.map +1 -0
  230. package/dist/instructor/dto/update-instructor.dto.d.ts +9 -0
  231. package/dist/instructor/dto/update-instructor.dto.d.ts.map +1 -0
  232. package/dist/instructor/dto/update-instructor.dto.js +51 -0
  233. package/dist/instructor/dto/update-instructor.dto.js.map +1 -0
  234. package/dist/instructor/instructor.controller.d.ts +52 -0
  235. package/dist/instructor/instructor.controller.d.ts.map +1 -0
  236. package/dist/instructor/instructor.controller.js +98 -0
  237. package/dist/instructor/instructor.controller.js.map +1 -0
  238. package/dist/instructor/instructor.module.d.ts +3 -0
  239. package/dist/instructor/instructor.module.d.ts.map +1 -0
  240. package/dist/instructor/instructor.module.js +25 -0
  241. package/dist/instructor/instructor.module.js.map +1 -0
  242. package/dist/instructor/instructor.service.d.ts +79 -0
  243. package/dist/instructor/instructor.service.d.ts.map +1 -0
  244. package/dist/instructor/instructor.service.js +528 -0
  245. package/dist/instructor/instructor.service.js.map +1 -0
  246. package/dist/lms.module.d.ts.map +1 -1
  247. package/dist/lms.module.js +36 -4
  248. package/dist/lms.module.js.map +1 -1
  249. package/dist/reports/reports.controller.d.ts +69 -0
  250. package/dist/reports/reports.controller.d.ts.map +1 -0
  251. package/dist/reports/reports.controller.js +40 -0
  252. package/dist/reports/reports.controller.js.map +1 -0
  253. package/dist/reports/reports.module.d.ts +3 -0
  254. package/dist/reports/reports.module.d.ts.map +1 -0
  255. package/dist/reports/reports.module.js +25 -0
  256. package/dist/reports/reports.module.js.map +1 -0
  257. package/dist/reports/reports.service.d.ts +80 -0
  258. package/dist/reports/reports.service.d.ts.map +1 -0
  259. package/dist/reports/reports.service.js +366 -0
  260. package/dist/reports/reports.service.js.map +1 -0
  261. package/dist/training/dto/create-training.dto.d.ts +19 -0
  262. package/dist/training/dto/create-training.dto.d.ts.map +1 -0
  263. package/dist/training/dto/create-training.dto.js +98 -0
  264. package/dist/training/dto/create-training.dto.js.map +1 -0
  265. package/dist/training/dto/update-training.dto.d.ts +6 -0
  266. package/dist/training/dto/update-training.dto.d.ts.map +1 -0
  267. package/dist/training/dto/update-training.dto.js +9 -0
  268. package/dist/training/dto/update-training.dto.js.map +1 -0
  269. package/dist/training/training.controller.d.ts +195 -0
  270. package/dist/training/training.controller.d.ts.map +1 -0
  271. package/dist/training/training.controller.js +104 -0
  272. package/dist/training/training.controller.js.map +1 -0
  273. package/dist/training/training.module.d.ts +3 -0
  274. package/dist/training/training.module.d.ts.map +1 -0
  275. package/dist/training/training.module.js +25 -0
  276. package/dist/training/training.module.js.map +1 -0
  277. package/dist/training/training.service.d.ts +213 -0
  278. package/dist/training/training.service.d.ts.map +1 -0
  279. package/dist/training/training.service.js +497 -0
  280. package/dist/training/training.service.js.map +1 -0
  281. package/hedhog/data/dashboard.yaml +6 -0
  282. package/hedhog/data/dashboard_component.yaml +153 -0
  283. package/hedhog/data/dashboard_component_role.yaml +97 -0
  284. package/hedhog/data/dashboard_item.yaml +167 -0
  285. package/hedhog/data/dashboard_role.yaml +6 -0
  286. package/hedhog/data/instructor_qualification.yaml +16 -0
  287. package/hedhog/data/menu.yaml +129 -19
  288. package/hedhog/data/role.yaml +25 -1
  289. package/hedhog/data/route.yaml +867 -0
  290. package/hedhog/frontend/app/_components/class-form-sheet.tsx.ejs +1992 -0
  291. package/hedhog/frontend/app/_components/course-form-sheet.tsx.ejs +480 -0
  292. package/hedhog/frontend/app/_components/create-lms-instructor-sheet.tsx.ejs +591 -0
  293. package/hedhog/frontend/app/_components/create-lms-person-sheet.tsx.ejs +164 -0
  294. package/hedhog/frontend/app/_components/create-lms-student-person-sheet.tsx.ejs +120 -0
  295. package/hedhog/frontend/app/_components/lms-class-calendar.tsx.ejs +272 -0
  296. package/hedhog/frontend/app/_components/mobile-calendar.tsx.ejs +277 -0
  297. package/hedhog/frontend/app/_lib/editor/canvasInstance.ts.ejs +48 -0
  298. package/hedhog/frontend/app/_lib/editor/pctHelpers.ts.ejs +50 -0
  299. package/hedhog/frontend/app/_lib/editor/templateSerializer.ts.ejs +268 -0
  300. package/hedhog/frontend/app/_lib/editor/types.ts.ejs +94 -0
  301. package/hedhog/frontend/app/_lib/store/useTemplateStore.ts.ejs +284 -0
  302. package/hedhog/frontend/app/certificates/issued/page.tsx.ejs +638 -0
  303. package/hedhog/frontend/app/certificates/models/CanvasStage.tsx.ejs +916 -0
  304. package/hedhog/frontend/app/certificates/models/LeftPanel.tsx.ejs +200 -0
  305. package/hedhog/frontend/app/certificates/models/RightPanel.tsx.ejs +769 -0
  306. package/hedhog/frontend/app/certificates/models/TemplateEditorPage.tsx.ejs +104 -0
  307. package/hedhog/frontend/app/certificates/models/TopBar.tsx.ejs +354 -0
  308. package/hedhog/frontend/app/certificates/models/editor/page.tsx.ejs +5 -0
  309. package/hedhog/frontend/app/certificates/models/page.tsx.ejs +883 -0
  310. package/hedhog/frontend/app/classes/[id]/_components/event-summary-popover.tsx.ejs +279 -0
  311. package/hedhog/frontend/app/classes/[id]/_components/quick-create-session-popover.tsx.ejs +1027 -0
  312. package/hedhog/frontend/app/classes/[id]/page.tsx.ejs +3130 -993
  313. package/hedhog/frontend/app/classes/page.tsx.ejs +2731 -759
  314. package/hedhog/frontend/app/courses/[id]/_components/CourseCertificateCard.tsx.ejs +80 -0
  315. package/hedhog/frontend/app/courses/[id]/_components/CourseClassificationCard.tsx.ejs +226 -0
  316. package/hedhog/frontend/app/courses/[id]/_components/CourseContentCard.tsx.ejs +71 -0
  317. package/hedhog/frontend/app/courses/[id]/_components/CourseDangerZoneCard.tsx.ejs +42 -0
  318. package/hedhog/frontend/app/courses/[id]/_components/CourseFlagsCard.tsx.ejs +111 -0
  319. package/hedhog/frontend/app/courses/[id]/_components/CourseMainInfoCard.tsx.ejs +113 -0
  320. package/hedhog/frontend/app/courses/[id]/_components/CourseMediaCard.tsx.ejs +215 -0
  321. package/hedhog/frontend/app/courses/[id]/_components/CourseMultiEntityPicker.tsx.ejs +236 -0
  322. package/hedhog/frontend/app/courses/[id]/_components/CourseRelationsCard.tsx.ejs +141 -0
  323. package/hedhog/frontend/app/courses/[id]/_components/CourseSectionCard.tsx.ejs +57 -0
  324. package/hedhog/frontend/app/courses/[id]/_components/CourseSummaryCard.tsx.ejs +60 -0
  325. package/hedhog/frontend/app/courses/[id]/_components/course-edit-types.ts.ejs +33 -0
  326. package/hedhog/frontend/app/courses/[id]/page.tsx.ejs +933 -1103
  327. package/hedhog/frontend/app/courses/[id]/structure/page.tsx.ejs +699 -117
  328. package/hedhog/frontend/app/courses/page.tsx.ejs +1018 -1042
  329. package/hedhog/frontend/app/enterprise/[id]/page.tsx.ejs +317 -0
  330. package/hedhog/frontend/app/enterprise/_components/enterprise-activity-panel.tsx.ejs +88 -0
  331. package/hedhog/frontend/app/enterprise/_components/enterprise-admin-create-sheet.tsx.ejs +318 -0
  332. package/hedhog/frontend/app/enterprise/_components/enterprise-administrators-tab.tsx.ejs +332 -0
  333. package/hedhog/frontend/app/enterprise/_components/enterprise-class-create-sheet.tsx.ejs +57 -0
  334. package/hedhog/frontend/app/enterprise/_components/enterprise-classes-tab.tsx.ejs +390 -0
  335. package/hedhog/frontend/app/enterprise/_components/enterprise-company-identity-card.tsx.ejs +112 -0
  336. package/hedhog/frontend/app/enterprise/_components/enterprise-course-create-sheet.tsx.ejs +183 -0
  337. package/hedhog/frontend/app/enterprise/_components/enterprise-courses-tab.tsx.ejs +363 -0
  338. package/hedhog/frontend/app/enterprise/_components/enterprise-detail-constants.ts.ejs +88 -0
  339. package/hedhog/frontend/app/enterprise/_components/enterprise-detail-sheet.tsx.ejs +548 -0
  340. package/hedhog/frontend/app/enterprise/_components/enterprise-detail-utils.ts.ejs +33 -0
  341. package/hedhog/frontend/app/enterprise/_components/enterprise-mocks.ts.ejs +266 -0
  342. package/hedhog/frontend/app/enterprise/_components/enterprise-person-picker.ts.ejs +31 -0
  343. package/hedhog/frontend/app/enterprise/_components/enterprise-progress-bar.tsx.ejs +21 -0
  344. package/hedhog/frontend/app/enterprise/_components/enterprise-related-tab.tsx.ejs +187 -0
  345. package/hedhog/frontend/app/enterprise/_components/enterprise-sheet.tsx.ejs +397 -0
  346. package/hedhog/frontend/app/enterprise/_components/enterprise-student-create-sheet.tsx.ejs +167 -0
  347. package/hedhog/frontend/app/enterprise/_components/enterprise-students-tab.tsx.ejs +267 -0
  348. package/hedhog/frontend/app/enterprise/_components/enterprise-system-user-picker.ts.ejs +42 -0
  349. package/hedhog/frontend/app/enterprise/_components/enterprise-types.ts.ejs +96 -0
  350. package/hedhog/frontend/app/enterprise/_components/enterprise-user-create-sheet.tsx.ejs +207 -0
  351. package/hedhog/frontend/app/enterprise/_components/enterprise-user-distribution-chart.tsx.ejs +149 -0
  352. package/hedhog/frontend/app/enterprise/page.tsx.ejs +596 -0
  353. package/hedhog/frontend/app/evaluations/page.tsx.ejs +1250 -0
  354. package/hedhog/frontend/app/exams/[id]/attempt/page.tsx.ejs +642 -196
  355. package/hedhog/frontend/app/exams/[id]/page.tsx.ejs +11 -0
  356. package/hedhog/frontend/app/exams/[id]/questions/page.tsx.ejs +1316 -436
  357. package/hedhog/frontend/app/exams/page.tsx.ejs +799 -546
  358. package/hedhog/frontend/app/layout.tsx.ejs +5 -0
  359. package/hedhog/frontend/app/page.tsx.ejs +5 -1222
  360. package/hedhog/frontend/app/reports/courses/page.tsx.ejs +843 -0
  361. package/hedhog/frontend/app/reports/dashboard/page.tsx.ejs +890 -0
  362. package/hedhog/frontend/app/reports/page.tsx.ejs +802 -808
  363. package/hedhog/frontend/app/reports/students/page.tsx.ejs +772 -0
  364. package/hedhog/frontend/app/training/page.tsx.ejs +1873 -628
  365. package/hedhog/frontend/messages/en.json +1606 -111
  366. package/hedhog/frontend/messages/pt.json +1636 -134
  367. package/hedhog/frontend/widgets/active-classes-kpi.tsx.ejs +74 -0
  368. package/hedhog/frontend/widgets/active-courses-kpi.tsx.ejs +74 -0
  369. package/hedhog/frontend/widgets/approval-rate-kpi.tsx.ejs +81 -0
  370. package/hedhog/frontend/widgets/category-distribution-chart.tsx.ejs +119 -0
  371. package/hedhog/frontend/widgets/class-calendar.tsx.ejs +440 -0
  372. package/hedhog/frontend/widgets/completion-rate-kpi.tsx.ejs +81 -0
  373. package/hedhog/frontend/widgets/engagement-chart.tsx.ejs +120 -0
  374. package/hedhog/frontend/widgets/footer-summary.tsx.ejs +80 -0
  375. package/hedhog/frontend/widgets/issued-certificates-kpi.tsx.ejs +74 -0
  376. package/hedhog/frontend/widgets/latest-enrollments.tsx.ejs +166 -0
  377. package/hedhog/frontend/widgets/student-growth-chart.tsx.ejs +89 -0
  378. package/hedhog/frontend/widgets/top-courses-chart.tsx.ejs +104 -0
  379. package/hedhog/frontend/widgets/total-students-kpi.tsx.ejs +78 -0
  380. package/hedhog/frontend/widgets/upcoming-classes.tsx.ejs +152 -0
  381. package/hedhog/table/course.yaml +28 -10
  382. package/hedhog/table/course_class_group.yaml +8 -0
  383. package/hedhog/table/course_class_session.yaml +33 -0
  384. package/hedhog/table/course_instructor.yaml +27 -0
  385. package/hedhog/table/enterprise.yaml +29 -0
  386. package/hedhog/table/enterprise_class_group.yaml +20 -0
  387. package/hedhog/table/enterprise_course.yaml +23 -0
  388. package/hedhog/table/enterprise_student.yaml +24 -0
  389. package/hedhog/table/enterprise_user.yaml +35 -0
  390. package/hedhog/table/instructor_qualification.yaml +26 -0
  391. package/hedhog/table/instructor_qualification_assignment.yaml +22 -0
  392. package/hedhog/table/question.yaml +6 -0
  393. package/package.json +7 -7
  394. package/src/certificate/certificate.controller.ts +83 -0
  395. package/src/certificate/certificate.module.ts +13 -0
  396. package/src/certificate/certificate.service.ts +413 -0
  397. package/src/certificate/dto/create-certificate-template.dto.ts +25 -0
  398. package/src/certificate/dto/update-certificate-template.dto.ts +6 -0
  399. package/src/class-group/class-group.controller.ts +189 -0
  400. package/src/class-group/class-group.module.ts +12 -0
  401. package/src/class-group/class-group.service.ts +1802 -0
  402. package/src/class-group/dto/create-class-group.dto.ts +139 -0
  403. package/src/class-group/dto/create-session.dto.ts +102 -0
  404. package/src/class-group/dto/enrollment.dto.ts +70 -0
  405. package/src/class-group/dto/update-class-group.dto.ts +4 -0
  406. package/src/class-group/dto/update-session.dto.ts +9 -0
  407. package/src/course/course-structure.controller.ts +85 -0
  408. package/src/course/course-structure.service.ts +525 -0
  409. package/src/course/course.controller.ts +69 -0
  410. package/src/course/course.module.ts +15 -0
  411. package/src/course/course.service.ts +920 -0
  412. package/src/course/dto/create-course-structure-lesson.dto.ts +97 -0
  413. package/src/course/dto/create-course-structure-session.dto.ts +22 -0
  414. package/src/course/dto/create-course.dto.ts +111 -0
  415. package/src/course/dto/update-course-structure-lesson.dto.ts +6 -0
  416. package/src/course/dto/update-course-structure-session.dto.ts +6 -0
  417. package/src/course/dto/update-course.dto.ts +4 -0
  418. package/src/dashboard/dashboard.controller.ts +14 -0
  419. package/src/dashboard/dashboard.module.ts +12 -0
  420. package/src/dashboard/dashboard.service.ts +726 -0
  421. package/src/enterprise/dto/add-enterprise-class-group.dto.ts +7 -0
  422. package/src/enterprise/dto/add-enterprise-course.dto.ts +11 -0
  423. package/src/enterprise/dto/add-enterprise-student.dto.ts +16 -0
  424. package/src/enterprise/dto/add-enterprise-user.dto.ts +23 -0
  425. package/src/enterprise/dto/create-enterprise.dto.ts +41 -0
  426. package/src/enterprise/dto/update-enterprise-student.dto.ts +7 -0
  427. package/src/enterprise/dto/update-enterprise-user.dto.ts +11 -0
  428. package/src/enterprise/dto/update-enterprise.dto.ts +4 -0
  429. package/src/enterprise/enterprise.controller.ts +233 -0
  430. package/src/enterprise/enterprise.module.ts +12 -0
  431. package/src/enterprise/enterprise.service.ts +712 -0
  432. package/src/evaluation/evaluation.controller.ts +44 -0
  433. package/src/evaluation/evaluation.module.ts +12 -0
  434. package/src/evaluation/evaluation.service.ts +394 -0
  435. package/src/exam/dto/create-exam-question.dto.ts +103 -0
  436. package/src/exam/dto/create-exam.dto.ts +41 -0
  437. package/src/exam/dto/reorder-exam-questions.dto.ts +8 -0
  438. package/src/exam/dto/save-exam-attempt-answers.dto.ts +55 -0
  439. package/src/exam/dto/start-exam-attempt.dto.ts +8 -0
  440. package/src/exam/dto/submit-exam-attempt.dto.ts +8 -0
  441. package/src/exam/dto/update-exam-question.dto.ts +4 -0
  442. package/src/exam/dto/update-exam.dto.ts +4 -0
  443. package/src/exam/exam-attempt.controller.ts +65 -0
  444. package/src/exam/exam-attempt.service.ts +1008 -0
  445. package/src/exam/exam.controller.ts +102 -0
  446. package/src/exam/exam.module.ts +14 -0
  447. package/src/exam/exam.service.ts +784 -0
  448. package/src/index.ts +29 -0
  449. package/src/instructor/dto/create-instructor.dto.ts +43 -0
  450. package/src/instructor/dto/update-instructor.dto.ts +38 -0
  451. package/src/instructor/instructor.controller.ts +73 -0
  452. package/src/instructor/instructor.module.ts +12 -0
  453. package/src/instructor/instructor.service.ts +646 -0
  454. package/src/lms.module.ts +36 -4
  455. package/src/reports/reports.controller.ts +14 -0
  456. package/src/reports/reports.module.ts +12 -0
  457. package/src/reports/reports.service.ts +485 -0
  458. package/src/training/dto/create-training.dto.ts +81 -0
  459. package/src/training/dto/update-training.dto.ts +4 -0
  460. package/src/training/training.controller.ts +68 -0
  461. package/src/training/training.module.ts +12 -0
  462. package/src/training/training.service.ts +574 -0
@@ -0,0 +1,574 @@
1
+ import { PrismaService } from '@hed-hog/api-prisma';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { CreateTrainingDto, LearningPathItemDto } from './dto/create-training.dto';
4
+ import { UpdateTrainingDto } from './dto/update-training.dto';
5
+
6
+ @Injectable()
7
+ export class TrainingService {
8
+ constructor(private readonly prisma: PrismaService) {}
9
+
10
+ async list(params: {
11
+ page?: number;
12
+ pageSize?: number;
13
+ search?: string;
14
+ status?: string;
15
+ level?: string;
16
+ area?: string;
17
+ }) {
18
+ const page = Math.max(Number(params.page) || 1, 1);
19
+ const pageSize = Math.max(Number(params.pageSize) || 12, 1);
20
+ const skip = (page - 1) * pageSize;
21
+
22
+ const where: any = {};
23
+
24
+ const normalizedStatus = this.normalizeStatus(params.status);
25
+ if (normalizedStatus) {
26
+ where.status = normalizedStatus;
27
+ }
28
+
29
+ const normalizedLevel = this.normalizeLevel(params.level);
30
+ if (normalizedLevel) {
31
+ where.level = normalizedLevel;
32
+ }
33
+
34
+ if (params.search?.trim()) {
35
+ const search = params.search.trim();
36
+ where.OR = [
37
+ { title: { contains: search, mode: 'insensitive' } },
38
+ { slug: { contains: search, mode: 'insensitive' } },
39
+ { description: { contains: search, mode: 'insensitive' } },
40
+ { short_description: { contains: search, mode: 'insensitive' } },
41
+ ];
42
+ }
43
+
44
+ const areaSlugs = this.areaToCategorySlugs(params.area);
45
+ if (areaSlugs.length > 0) {
46
+ where.learning_path_step = {
47
+ some: {
48
+ step_type: 'course',
49
+ course: {
50
+ course_category: {
51
+ some: {
52
+ category: {
53
+ slug: {
54
+ in: areaSlugs,
55
+ },
56
+ },
57
+ },
58
+ },
59
+ },
60
+ },
61
+ };
62
+ }
63
+
64
+ const [paths, total] = await Promise.all([
65
+ this.prisma.learning_path.findMany({
66
+ skip,
67
+ take: pageSize,
68
+ where,
69
+ orderBy: { created_at: 'desc' },
70
+ include: {
71
+ learning_path_step: {
72
+ orderBy: { order: 'asc' },
73
+ include: {
74
+ course: {
75
+ select: {
76
+ id: true,
77
+ title: true,
78
+ duration_hours: true,
79
+ course_category: {
80
+ include: {
81
+ category: {
82
+ select: { slug: true },
83
+ },
84
+ },
85
+ },
86
+ },
87
+ },
88
+ exam: {
89
+ select: {
90
+ id: true,
91
+ title: true,
92
+ time_limit_minutes: true,
93
+ },
94
+ },
95
+ },
96
+ },
97
+ _count: {
98
+ select: {
99
+ learning_path_enrollment: true,
100
+ learning_path_step: true,
101
+ },
102
+ },
103
+ },
104
+ }),
105
+ this.prisma.learning_path.count({ where }),
106
+ ]);
107
+
108
+ return {
109
+ total,
110
+ page,
111
+ pageSize,
112
+ lastPage: Math.max(1, Math.ceil(total / pageSize)),
113
+ data: paths.map((path) => this.mapTraining(path)),
114
+ };
115
+ }
116
+
117
+ async stats() {
118
+ const [totalTraining, activeTraining, enrolledStudents, coveredCourses] =
119
+ await Promise.all([
120
+ this.prisma.learning_path.count(),
121
+ this.prisma.learning_path.count({ where: { status: 'active' } }),
122
+ this.prisma.learning_path_enrollment.count(),
123
+ this.prisma.learning_path_step.groupBy({
124
+ by: ['course_id'],
125
+ where: { course_id: { not: null } },
126
+ }),
127
+ ]);
128
+
129
+ return {
130
+ totalTraining,
131
+ activeTraining,
132
+ enrolledStudents,
133
+ coveredCourses: coveredCourses.length,
134
+ };
135
+ }
136
+
137
+ async getById(id: number) {
138
+ const path = await this.prisma.learning_path.findUnique({
139
+ where: { id },
140
+ include: {
141
+ learning_path_step: {
142
+ orderBy: { order: 'asc' },
143
+ include: {
144
+ course: {
145
+ select: {
146
+ id: true,
147
+ title: true,
148
+ duration_hours: true,
149
+ course_category: {
150
+ include: {
151
+ category: {
152
+ select: { slug: true },
153
+ },
154
+ },
155
+ },
156
+ },
157
+ },
158
+ exam: {
159
+ select: {
160
+ id: true,
161
+ title: true,
162
+ time_limit_minutes: true,
163
+ },
164
+ },
165
+ },
166
+ },
167
+ _count: {
168
+ select: {
169
+ learning_path_enrollment: true,
170
+ learning_path_step: true,
171
+ },
172
+ },
173
+ },
174
+ });
175
+
176
+ if (!path) return null;
177
+ return this.mapTraining(path);
178
+ }
179
+
180
+ async create(dto: CreateTrainingDto) {
181
+ const slug = dto.slug?.trim() || this.slugify(dto.title);
182
+ const stepItems = this.resolveIncomingSteps(dto);
183
+ const normalizedLevel = this.normalizeLevel(dto.level) ?? 'beginner';
184
+ const normalizedStatus = this.normalizeStatus(dto.status) ?? 'draft';
185
+
186
+ const created = await this.prisma.learning_path.create({
187
+ data: {
188
+ title: dto.title,
189
+ slug,
190
+ description: dto.description,
191
+ short_description: dto.shortDescription,
192
+ level: normalizedLevel,
193
+ status: normalizedStatus,
194
+ ...(dto.primaryColor !== undefined && { primary_color: dto.primaryColor }),
195
+ ...(dto.secondaryColor !== undefined && { secondary_color: dto.secondaryColor }),
196
+ ...(stepItems.length > 0 && {
197
+ learning_path_step: {
198
+ create: stepItems.map((item, index) =>
199
+ this.toLearningPathCreateStep(item, index),
200
+ ),
201
+ },
202
+ }),
203
+ },
204
+ include: {
205
+ learning_path_step: {
206
+ orderBy: { order: 'asc' },
207
+ include: {
208
+ course: {
209
+ select: {
210
+ id: true,
211
+ title: true,
212
+ duration_hours: true,
213
+ course_category: {
214
+ include: {
215
+ category: {
216
+ select: { slug: true },
217
+ },
218
+ },
219
+ },
220
+ },
221
+ },
222
+ exam: {
223
+ select: {
224
+ id: true,
225
+ title: true,
226
+ time_limit_minutes: true,
227
+ },
228
+ },
229
+ },
230
+ },
231
+ _count: {
232
+ select: {
233
+ learning_path_enrollment: true,
234
+ learning_path_step: true,
235
+ },
236
+ },
237
+ },
238
+ });
239
+
240
+ return this.mapTraining(created);
241
+ }
242
+
243
+ async update(id: number, dto: UpdateTrainingDto) {
244
+ const stepItems = this.resolveIncomingSteps(dto);
245
+ const stepsWereProvided = dto.items !== undefined || dto.courseIds !== undefined;
246
+ const normalizedLevel =
247
+ dto.level !== undefined ? this.normalizeLevel(dto.level) : undefined;
248
+ const normalizedStatus =
249
+ dto.status !== undefined ? this.normalizeStatus(dto.status) : undefined;
250
+
251
+ if (stepsWereProvided) {
252
+ await this.prisma.learning_path_step.deleteMany({
253
+ where: {
254
+ learning_path_id: id,
255
+ },
256
+ });
257
+ }
258
+
259
+ const updated = await this.prisma.learning_path.update({
260
+ where: { id },
261
+ data: {
262
+ ...(dto.title !== undefined && { title: dto.title }),
263
+ ...(dto.slug !== undefined && { slug: dto.slug || this.slugify(dto.title ?? '') }),
264
+ ...(dto.description !== undefined && { description: dto.description }),
265
+ ...(dto.shortDescription !== undefined && {
266
+ short_description: dto.shortDescription,
267
+ }),
268
+ ...(normalizedLevel !== undefined && { level: normalizedLevel }),
269
+ ...(normalizedStatus !== undefined && { status: normalizedStatus }),
270
+ ...(dto.primaryColor !== undefined && { primary_color: dto.primaryColor }),
271
+ ...(dto.secondaryColor !== undefined && { secondary_color: dto.secondaryColor }),
272
+ ...(stepsWereProvided &&
273
+ stepItems.length > 0 && {
274
+ learning_path_step: {
275
+ create: stepItems.map((item, index) =>
276
+ this.toLearningPathCreateStep(item, index),
277
+ ),
278
+ },
279
+ }),
280
+ },
281
+ include: {
282
+ learning_path_step: {
283
+ orderBy: { order: 'asc' },
284
+ include: {
285
+ course: {
286
+ select: {
287
+ id: true,
288
+ title: true,
289
+ duration_hours: true,
290
+ course_category: {
291
+ include: {
292
+ category: {
293
+ select: { slug: true },
294
+ },
295
+ },
296
+ },
297
+ },
298
+ },
299
+ exam: {
300
+ select: {
301
+ id: true,
302
+ title: true,
303
+ time_limit_minutes: true,
304
+ },
305
+ },
306
+ },
307
+ },
308
+ _count: {
309
+ select: {
310
+ learning_path_enrollment: true,
311
+ learning_path_step: true,
312
+ },
313
+ },
314
+ },
315
+ });
316
+
317
+ return this.mapTraining(updated);
318
+ }
319
+
320
+ async remove(id: number) {
321
+ await this.prisma.learning_path.delete({ where: { id } });
322
+ return { success: true };
323
+ }
324
+
325
+ private mapTraining(path: any) {
326
+ const steps = [...(path.learning_path_step ?? [])].sort(
327
+ (a: any, b: any) => (a?.order ?? 0) - (b?.order ?? 0),
328
+ );
329
+ const courseSteps = steps.filter((step: any) => step?.course);
330
+ const examSteps = steps.filter((step: any) => step?.exam);
331
+
332
+ const courses = courseSteps.map((step: any) => step.course.title);
333
+ const exams = examSteps.map((step: any) => step.exam.title);
334
+ const courseIds = courseSteps.map((step: any) => step.course.id);
335
+ const examIds = examSteps.map((step: any) => step.exam.id);
336
+ const cargaTotal = courseSteps.reduce(
337
+ (sum: number, step: any) => sum + (step.course?.duration_hours ?? 0),
338
+ 0,
339
+ );
340
+
341
+ const firstCategorySlug = steps
342
+ .flatMap((step: any) => step.course?.course_category ?? [])
343
+ .map((item: any) => item.category?.slug)
344
+ .find(Boolean);
345
+
346
+ const items = steps
347
+ .map((step: any, index: number) => {
348
+ if (step?.course) {
349
+ return {
350
+ id: step.id,
351
+ type: 'course' as const,
352
+ itemId: step.course.id,
353
+ title: step.course.title,
354
+ durationHours: step.course.duration_hours ?? 0,
355
+ order: step.order ?? index,
356
+ isRequired: step.is_required !== false,
357
+ };
358
+ }
359
+
360
+ if (step?.exam) {
361
+ return {
362
+ id: step.id,
363
+ type: 'exam' as const,
364
+ itemId: step.exam.id,
365
+ title: step.exam.title,
366
+ durationMinutes: step.exam.time_limit_minutes ?? 0,
367
+ order: step.order ?? index,
368
+ isRequired: step.is_required !== false,
369
+ };
370
+ }
371
+
372
+ return null;
373
+ })
374
+ .filter(Boolean);
375
+
376
+ return {
377
+ id: path.id,
378
+ nome: path.title,
379
+ descricao: path.description ?? path.short_description ?? '',
380
+ area: this.slugToArea(firstCategorySlug),
381
+ nivel: this.levelToPt(path.level),
382
+ prerequisitos: path.short_description ?? '',
383
+ cursos: courses,
384
+ exams,
385
+ courseIds,
386
+ examIds,
387
+ items,
388
+ cargaTotal,
389
+ alunos: path._count?.learning_path_enrollment ?? 0,
390
+ status: this.statusToPt(path.status),
391
+ criadoEm: path.created_at,
392
+ primaryColor: path.primary_color ?? undefined,
393
+ secondaryColor: path.secondary_color ?? undefined,
394
+ code: this.idToCode(path.id),
395
+ slug: path.slug,
396
+ level: path.level,
397
+ statusRaw: path.status,
398
+ students: path._count?.learning_path_enrollment ?? 0,
399
+ createdAt: path.created_at,
400
+ };
401
+ }
402
+
403
+ private resolveIncomingSteps(dto: {
404
+ items?: LearningPathItemDto[];
405
+ courseIds?: number[];
406
+ }) {
407
+ if (dto.items !== undefined) {
408
+ const normalized = dto.items
409
+ .map((item, index) => ({
410
+ type: item.type,
411
+ itemId: Number(item.itemId),
412
+ order: Number.isFinite(item.order) ? Number(item.order) : index,
413
+ isRequired: item.isRequired !== false,
414
+ }))
415
+ .filter(
416
+ (item) =>
417
+ (item.type === 'course' || item.type === 'exam') &&
418
+ Number.isFinite(item.itemId) &&
419
+ item.itemId > 0,
420
+ );
421
+
422
+ const uniqueByPair = new Map<string, (typeof normalized)[number]>();
423
+ normalized.forEach((item) => {
424
+ uniqueByPair.set(`${item.type}:${item.itemId}`, item);
425
+ });
426
+
427
+ return Array.from(uniqueByPair.values()).sort(
428
+ (a, b) => a.order - b.order,
429
+ );
430
+ }
431
+
432
+ const courseIds = [...new Set(dto.courseIds ?? [])].filter(
433
+ (courseId) => Number.isFinite(courseId) && courseId > 0,
434
+ );
435
+
436
+ return courseIds.map((courseId, index) => ({
437
+ type: 'course' as const,
438
+ itemId: courseId,
439
+ order: index,
440
+ isRequired: true,
441
+ }));
442
+ }
443
+
444
+ private toLearningPathCreateStep(
445
+ item: {
446
+ type: 'course' | 'exam';
447
+ itemId: number;
448
+ order: number;
449
+ isRequired: boolean;
450
+ },
451
+ fallbackOrder: number,
452
+ ) {
453
+ return {
454
+ step_type: item.type,
455
+ course_id: item.type === 'course' ? item.itemId : null,
456
+ exam_id: item.type === 'exam' ? item.itemId : null,
457
+ order: Number.isFinite(item.order) ? item.order : fallbackOrder,
458
+ is_required: item.isRequired,
459
+ };
460
+ }
461
+
462
+ private normalizeStatus(value?: string) {
463
+ if (!value) return undefined;
464
+ const normalized = value.trim().toLowerCase();
465
+
466
+ if (normalized === 'ativa' || normalized === 'active') return 'active';
467
+ if (normalized === 'rascunho' || normalized === 'draft') return 'draft';
468
+ if (normalized === 'encerrada' || normalized === 'archived') {
469
+ return 'archived';
470
+ }
471
+
472
+ return undefined;
473
+ }
474
+
475
+ private normalizeLevel(value?: string) {
476
+ if (!value) return undefined;
477
+ const normalized = value
478
+ .trim()
479
+ .toLowerCase()
480
+ .normalize('NFD')
481
+ .replace(/[\u0300-\u036f]/g, '');
482
+
483
+ if (normalized === 'iniciante' || normalized === 'beginner') {
484
+ return 'beginner';
485
+ }
486
+ if (normalized === 'intermediario' || normalized === 'intermediate') {
487
+ return 'intermediate';
488
+ }
489
+ if (normalized === 'avancado' || normalized === 'advanced') {
490
+ return 'advanced';
491
+ }
492
+
493
+ return undefined;
494
+ }
495
+
496
+ private areaToCategorySlugs(value?: string) {
497
+ if (!value || value === 'todos') return [];
498
+
499
+ const normalized = value
500
+ .trim()
501
+ .toLowerCase()
502
+ .normalize('NFD')
503
+ .replace(/[\u0300-\u036f]/g, '');
504
+
505
+ const map: Record<string, string[]> = {
506
+ tecnologia: ['tecnologia', 'technology'],
507
+ design: ['design'],
508
+ gestao: ['gestao', 'management'],
509
+ marketing: ['marketing'],
510
+ financas: ['financas', 'finance'],
511
+ };
512
+
513
+ return map[normalized] ?? [normalized];
514
+ }
515
+
516
+ private slugToArea(slug?: string) {
517
+ if (!slug) return 'Tecnologia';
518
+
519
+ const normalized = slug
520
+ .trim()
521
+ .toLowerCase()
522
+ .normalize('NFD')
523
+ .replace(/[\u0300-\u036f]/g, '');
524
+
525
+ const map: Record<string, string> = {
526
+ tecnologia: 'Tecnologia',
527
+ technology: 'Tecnologia',
528
+ design: 'Design',
529
+ gestao: 'Gestao',
530
+ management: 'Gestao',
531
+ marketing: 'Marketing',
532
+ financas: 'Financas',
533
+ finance: 'Financas',
534
+ };
535
+
536
+ return map[normalized] ?? 'Tecnologia';
537
+ }
538
+
539
+ private levelToPt(level: string) {
540
+ const map: Record<string, string> = {
541
+ beginner: 'Iniciante',
542
+ intermediate: 'Intermediario',
543
+ advanced: 'Avancado',
544
+ };
545
+
546
+ return map[level] ?? level;
547
+ }
548
+
549
+ private statusToPt(status: string) {
550
+ const map: Record<string, string> = {
551
+ draft: 'rascunho',
552
+ active: 'ativa',
553
+ archived: 'encerrada',
554
+ };
555
+
556
+ return map[status] ?? status;
557
+ }
558
+
559
+ private slugify(value: string) {
560
+ return value
561
+ .toLowerCase()
562
+ .normalize('NFD')
563
+ .replace(/[\u0300-\u036f]/g, '')
564
+ .replace(/[^a-z0-9\s-]/g, '')
565
+ .trim()
566
+ .replace(/\s+/g, '-')
567
+ .replace(/-+/g, '-')
568
+ .slice(0, 255);
569
+ }
570
+
571
+ private idToCode(id: number) {
572
+ return `TR-${String(id).padStart(3, '0')}`;
573
+ }
574
+ }