@hed-hog/lms 0.0.331 → 0.0.347
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/class-group/class-group.controller.d.ts +8 -8
- package/dist/class-group/class-group.service.d.ts +8 -8
- package/dist/course/course.controller.d.ts +6 -1
- package/dist/course/course.controller.d.ts.map +1 -1
- package/dist/course/course.controller.js +19 -2
- package/dist/course/course.controller.js.map +1 -1
- package/dist/course/course.service.d.ts +6 -0
- package/dist/course/course.service.d.ts.map +1 -1
- package/dist/course/course.service.js +63 -28
- package/dist/course/course.service.js.map +1 -1
- package/dist/course/dto/create-course.dto.d.ts +1 -0
- package/dist/course/dto/create-course.dto.d.ts.map +1 -1
- package/dist/course/dto/create-course.dto.js +5 -0
- package/dist/course/dto/create-course.dto.js.map +1 -1
- package/dist/enterprise/enterprise.controller.d.ts +84 -12
- package/dist/enterprise/enterprise.controller.d.ts.map +1 -1
- package/dist/enterprise/enterprise.controller.js +10 -0
- package/dist/enterprise/enterprise.controller.js.map +1 -1
- package/dist/enterprise/enterprise.service.d.ts +90 -12
- package/dist/enterprise/enterprise.service.d.ts.map +1 -1
- package/dist/enterprise/enterprise.service.js +413 -40
- package/dist/enterprise/enterprise.service.js.map +1 -1
- package/dist/enterprise/training/training-admin.controller.d.ts +9 -6
- package/dist/enterprise/training/training-admin.controller.d.ts.map +1 -1
- package/dist/enterprise/training/training-admin.controller.js +10 -6
- package/dist/enterprise/training/training-admin.controller.js.map +1 -1
- package/dist/enterprise/training/training-admin.service.d.ts +11 -5
- package/dist/enterprise/training/training-admin.service.d.ts.map +1 -1
- package/dist/enterprise/training/training-admin.service.js +108 -52
- package/dist/enterprise/training/training-admin.service.js.map +1 -1
- package/dist/enterprise/training/training-viewer.controller.d.ts +3 -0
- package/dist/enterprise/training/training-viewer.controller.d.ts.map +1 -1
- package/dist/evaluation/evaluation.controller.d.ts +2 -2
- package/dist/evaluation/evaluation.service.d.ts +2 -2
- package/dist/instructor/dto/create-instructor-skill.dto.d.ts +0 -4
- package/dist/instructor/dto/create-instructor-skill.dto.d.ts.map +1 -1
- package/dist/instructor/dto/create-instructor-skill.dto.js +0 -21
- package/dist/instructor/dto/create-instructor-skill.dto.js.map +1 -1
- package/dist/instructor/dto/update-instructor-skill.dto.d.ts +0 -4
- package/dist/instructor/dto/update-instructor-skill.dto.d.ts.map +1 -1
- package/dist/instructor/dto/update-instructor-skill.dto.js +0 -22
- package/dist/instructor/dto/update-instructor-skill.dto.js.map +1 -1
- package/dist/instructor/instructor-skill.controller.d.ts +4 -4
- package/dist/instructor/instructor-skill.service.d.ts +4 -7
- package/dist/instructor/instructor-skill.service.d.ts.map +1 -1
- package/dist/instructor/instructor-skill.service.js +2 -89
- package/dist/instructor/instructor-skill.service.js.map +1 -1
- package/dist/instructor/instructor.controller.d.ts +21 -0
- package/dist/instructor/instructor.controller.d.ts.map +1 -1
- package/dist/instructor/instructor.controller.js +19 -0
- package/dist/instructor/instructor.controller.js.map +1 -1
- package/dist/instructor/instructor.service.d.ts +27 -0
- package/dist/instructor/instructor.service.d.ts.map +1 -1
- package/dist/instructor/instructor.service.js +79 -25
- package/dist/instructor/instructor.service.js.map +1 -1
- package/dist/lms.module.d.ts.map +1 -1
- package/dist/lms.module.js.map +1 -1
- package/dist/training/dto/create-training.dto.d.ts +1 -0
- package/dist/training/dto/create-training.dto.d.ts.map +1 -1
- package/dist/training/dto/create-training.dto.js +5 -0
- package/dist/training/dto/create-training.dto.js.map +1 -1
- package/dist/training/training.controller.d.ts +4 -0
- package/dist/training/training.controller.d.ts.map +1 -1
- package/dist/training/training.service.d.ts +8 -0
- package/dist/training/training.service.d.ts.map +1 -1
- package/dist/training/training.service.js +71 -6
- package/dist/training/training.service.js.map +1 -1
- package/hedhog/data/route.yaml +23 -1
- package/hedhog/frontend/app/_components/class-form-sheet.tsx.ejs +80 -33
- package/hedhog/frontend/app/_components/course-form-sheet.tsx.ejs +3 -3
- package/hedhog/frontend/app/_components/create-lms-instructor-sheet.tsx.ejs +591 -0
- package/hedhog/frontend/app/certificates/issued/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/certificates/models/page.tsx.ejs +39 -7
- package/hedhog/frontend/app/classes/[id]/page.tsx.ejs +1 -3
- package/hedhog/frontend/app/classes/page.tsx.ejs +34 -7
- package/hedhog/frontend/app/courses/[id]/_components/CourseClassificationCard.tsx.ejs +3 -33
- package/hedhog/frontend/app/courses/[id]/_components/CourseContentCard.tsx.ejs +9 -9
- package/hedhog/frontend/app/courses/[id]/_components/CourseMainInfoCard.tsx.ejs +109 -0
- package/hedhog/frontend/app/courses/[id]/_components/CourseMultiEntityPicker.tsx.ejs +40 -13
- package/hedhog/frontend/app/courses/[id]/_components/CourseRelationsCard.tsx.ejs +76 -81
- package/hedhog/frontend/app/courses/[id]/_components/CourseSummaryCard.tsx.ejs +60 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-scheduled-classes-tab.tsx.ejs +406 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/course-tree.tsx.ejs +134 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/detail-course.tsx.ejs +113 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/detail-lesson.tsx.ejs +314 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/detail-session.tsx.ejs +174 -0
- package/hedhog/frontend/app/courses/[id]/structure/_components/editor-course.tsx.ejs +243 -34
- package/hedhog/frontend/app/courses/[id]/structure/_components/mock-data.ts.ejs +185 -0
- package/hedhog/frontend/app/courses/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/enterprise/_components/enterprise-activity-timeline.tsx.ejs +87 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-admin-create-sheet.tsx.ejs +4 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-administrators-tab.tsx.ejs +31 -5
- package/hedhog/frontend/app/enterprise/_components/enterprise-classes-tab.tsx.ejs +79 -20
- package/hedhog/frontend/app/enterprise/_components/enterprise-company-identity-card.tsx.ejs +11 -2
- package/hedhog/frontend/app/enterprise/_components/enterprise-course-edit-sheet.tsx.ejs +201 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-courses-tab.tsx.ejs +55 -24
- package/hedhog/frontend/app/enterprise/_components/enterprise-detail-sheet.tsx.ejs +430 -296
- package/hedhog/frontend/app/enterprise/_components/enterprise-mocks.ts.ejs +277 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-overview-analytics.tsx.ejs +205 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-person-edit-sheet.tsx.ejs +97 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-sheet.tsx.ejs +82 -57
- package/hedhog/frontend/app/enterprise/_components/enterprise-student-create-sheet.tsx.ejs +4 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-students-tab.tsx.ejs +60 -22
- package/hedhog/frontend/app/enterprise/_components/enterprise-types.ts.ejs +54 -0
- package/hedhog/frontend/app/enterprise/_components/enterprise-user-create-sheet.tsx.ejs +211 -0
- package/hedhog/frontend/app/enterprise/page.tsx.ejs +39 -7
- package/hedhog/frontend/app/exams/[id]/questions/page.tsx.ejs +31 -19
- package/hedhog/frontend/app/exams/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/instructor-skills/page.tsx.ejs +51 -104
- package/hedhog/frontend/app/instructors/_components/instructor-form-sheet.tsx.ejs +625 -366
- package/hedhog/frontend/app/instructors/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/paths/page.tsx.ejs +76 -8
- package/hedhog/frontend/app/reports/evaluations/page.tsx.ejs +6 -1
- package/hedhog/frontend/app/training/page.tsx.ejs +78 -9
- package/hedhog/frontend/messages/en.json +101 -10
- package/hedhog/frontend/messages/pt.json +115 -11
- package/hedhog/table/enterprise_student_license_event.yaml +30 -0
- package/hedhog/table/instructor_skill.yaml +0 -11
- package/hedhog/table/learning_path.yaml +4 -0
- package/package.json +6 -6
- package/src/course/course.controller.ts +18 -0
- package/src/course/course.service.ts +85 -26
- package/src/course/dto/create-course.dto.ts +4 -0
- package/src/enterprise/enterprise.controller.ts +5 -0
- package/src/enterprise/enterprise.service.ts +507 -29
- package/src/enterprise/training/training-admin.controller.ts +4 -0
- package/src/enterprise/training/training-admin.service.ts +115 -51
- package/src/instructor/dto/create-instructor-skill.dto.ts +0 -17
- package/src/instructor/dto/update-instructor-skill.dto.ts +0 -18
- package/src/instructor/instructor-skill.service.ts +2 -97
- package/src/instructor/instructor.controller.ts +16 -0
- package/src/instructor/instructor.service.ts +87 -10
- package/src/lms.module.ts +1 -0
- package/src/training/dto/create-training.dto.ts +4 -0
- package/src/training/training.service.ts +104 -5
|
@@ -12,6 +12,80 @@ export class TrainingService {
|
|
|
12
12
|
private readonly integrationApi: IntegrationDeveloperApiService,
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
|
+
private normalizeProgressMode(value?: string | null) {
|
|
16
|
+
if (!value) return undefined;
|
|
17
|
+
const normalized = value.trim().toLowerCase();
|
|
18
|
+
|
|
19
|
+
if (normalized === 'free' || normalized === 'livre') return 'free';
|
|
20
|
+
if (normalized === 'sequential' || normalized === 'sequencial') {
|
|
21
|
+
return 'sequential';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private progressModeToPt(value?: string | null) {
|
|
28
|
+
return this.normalizeProgressMode(value) === 'free' ? 'livre' : 'sequencial';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private async getTrainingExtras(ids: number[]) {
|
|
32
|
+
const extrasById = new Map<number, { progress_mode?: 'sequential' | 'free' | null }>();
|
|
33
|
+
|
|
34
|
+
const normalizedIds = ids
|
|
35
|
+
.map((id) => Number(id))
|
|
36
|
+
.filter((id) => Number.isInteger(id) && id > 0);
|
|
37
|
+
|
|
38
|
+
if (normalizedIds.length === 0) {
|
|
39
|
+
return extrasById;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
const rows = (await this.prisma.$queryRawUnsafe(
|
|
44
|
+
`
|
|
45
|
+
SELECT id, progress_mode
|
|
46
|
+
FROM learning_path
|
|
47
|
+
WHERE id IN (${normalizedIds.join(',')})
|
|
48
|
+
`,
|
|
49
|
+
)) as Array<{
|
|
50
|
+
id: number;
|
|
51
|
+
progress_mode: 'sequential' | 'free' | null;
|
|
52
|
+
}>;
|
|
53
|
+
|
|
54
|
+
for (const row of rows) {
|
|
55
|
+
extrasById.set(row.id, {
|
|
56
|
+
progress_mode: row.progress_mode,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
return extrasById;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return extrasById;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private async persistTrainingProgressMode(
|
|
67
|
+
id: number,
|
|
68
|
+
progressMode?: 'sequential' | 'free',
|
|
69
|
+
) {
|
|
70
|
+
if (progressMode === undefined) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
await this.prisma.$executeRawUnsafe(
|
|
76
|
+
`
|
|
77
|
+
UPDATE learning_path
|
|
78
|
+
SET progress_mode = $1
|
|
79
|
+
WHERE id = $2
|
|
80
|
+
`,
|
|
81
|
+
progressMode,
|
|
82
|
+
id,
|
|
83
|
+
);
|
|
84
|
+
} catch {
|
|
85
|
+
// Some environments may still be behind the current learning_path schema.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
15
89
|
async list(params: {
|
|
16
90
|
page?: number;
|
|
17
91
|
pageSize?: number;
|
|
@@ -110,12 +184,14 @@ export class TrainingService {
|
|
|
110
184
|
this.prisma.learning_path.count({ where }),
|
|
111
185
|
]);
|
|
112
186
|
|
|
187
|
+
const extrasById = await this.getTrainingExtras(paths.map((path) => path.id));
|
|
188
|
+
|
|
113
189
|
return {
|
|
114
190
|
total,
|
|
115
191
|
page,
|
|
116
192
|
pageSize,
|
|
117
193
|
lastPage: Math.max(1, Math.ceil(total / pageSize)),
|
|
118
|
-
data: paths.map((path) => this.mapTraining(path)),
|
|
194
|
+
data: paths.map((path) => this.mapTraining(path, extrasById.get(path.id))),
|
|
119
195
|
};
|
|
120
196
|
}
|
|
121
197
|
|
|
@@ -179,7 +255,9 @@ export class TrainingService {
|
|
|
179
255
|
});
|
|
180
256
|
|
|
181
257
|
if (!path) return null;
|
|
182
|
-
|
|
258
|
+
|
|
259
|
+
const extrasById = await this.getTrainingExtras([id]);
|
|
260
|
+
return this.mapTraining(path, extrasById.get(id));
|
|
183
261
|
}
|
|
184
262
|
|
|
185
263
|
async create(dto: CreateTrainingDto) {
|
|
@@ -187,6 +265,8 @@ export class TrainingService {
|
|
|
187
265
|
const stepItems = this.resolveIncomingSteps(dto);
|
|
188
266
|
const normalizedLevel = this.normalizeLevel(dto.level) ?? 'beginner';
|
|
189
267
|
const normalizedStatus = this.normalizeStatus(dto.status) ?? 'draft';
|
|
268
|
+
const normalizedProgressMode =
|
|
269
|
+
this.normalizeProgressMode(dto.progressMode) ?? 'sequential';
|
|
190
270
|
|
|
191
271
|
const created = await this.prisma.learning_path.create({
|
|
192
272
|
data: {
|
|
@@ -242,7 +322,14 @@ export class TrainingService {
|
|
|
242
322
|
},
|
|
243
323
|
});
|
|
244
324
|
|
|
245
|
-
|
|
325
|
+
await this.persistTrainingProgressMode(created.id, normalizedProgressMode);
|
|
326
|
+
|
|
327
|
+
const extrasById = await this.getTrainingExtras([created.id]);
|
|
328
|
+
|
|
329
|
+
const trainingResult = this.mapTraining(
|
|
330
|
+
created,
|
|
331
|
+
extrasById.get(created.id),
|
|
332
|
+
);
|
|
246
333
|
|
|
247
334
|
await this.integrationApi.publishEvent({
|
|
248
335
|
eventName: 'lms.training.created',
|
|
@@ -262,6 +349,10 @@ export class TrainingService {
|
|
|
262
349
|
dto.level !== undefined ? this.normalizeLevel(dto.level) : undefined;
|
|
263
350
|
const normalizedStatus =
|
|
264
351
|
dto.status !== undefined ? this.normalizeStatus(dto.status) : undefined;
|
|
352
|
+
const normalizedProgressMode =
|
|
353
|
+
dto.progressMode !== undefined
|
|
354
|
+
? this.normalizeProgressMode(dto.progressMode)
|
|
355
|
+
: undefined;
|
|
265
356
|
|
|
266
357
|
if (stepsWereProvided) {
|
|
267
358
|
await this.prisma.learning_path_step.deleteMany({
|
|
@@ -329,7 +420,11 @@ export class TrainingService {
|
|
|
329
420
|
},
|
|
330
421
|
});
|
|
331
422
|
|
|
332
|
-
|
|
423
|
+
await this.persistTrainingProgressMode(id, normalizedProgressMode);
|
|
424
|
+
|
|
425
|
+
const extrasById = await this.getTrainingExtras([id]);
|
|
426
|
+
|
|
427
|
+
const updateTrainingResult = this.mapTraining(updated, extrasById.get(id));
|
|
333
428
|
|
|
334
429
|
await this.integrationApi.publishEvent({
|
|
335
430
|
eventName: 'lms.training.updated',
|
|
@@ -356,7 +451,10 @@ export class TrainingService {
|
|
|
356
451
|
return { success: true };
|
|
357
452
|
}
|
|
358
453
|
|
|
359
|
-
private mapTraining(
|
|
454
|
+
private mapTraining(
|
|
455
|
+
path: any,
|
|
456
|
+
extras?: { progress_mode?: 'sequential' | 'free' | null },
|
|
457
|
+
) {
|
|
360
458
|
const steps = [...(path.learning_path_step ?? [])].sort(
|
|
361
459
|
(a: any, b: any) => (a?.order ?? 0) - (b?.order ?? 0),
|
|
362
460
|
);
|
|
@@ -419,6 +517,7 @@ export class TrainingService {
|
|
|
419
517
|
courseIds,
|
|
420
518
|
examIds,
|
|
421
519
|
items,
|
|
520
|
+
progressionMode: this.progressModeToPt(extras?.progress_mode),
|
|
422
521
|
cargaTotal,
|
|
423
522
|
alunos: path._count?.learning_path_enrollment ?? 0,
|
|
424
523
|
status: this.statusToPt(path.status),
|