@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
|
@@ -16,6 +16,26 @@ let TrainingAdminService = class TrainingAdminService {
|
|
|
16
16
|
constructor(prisma) {
|
|
17
17
|
this.prisma = prisma;
|
|
18
18
|
}
|
|
19
|
+
async recordLicenseEvent(params) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const eventModel = this.prisma.enterprise_student_license_event;
|
|
22
|
+
if (!eventModel)
|
|
23
|
+
return;
|
|
24
|
+
try {
|
|
25
|
+
await eventModel.create({
|
|
26
|
+
data: {
|
|
27
|
+
enterprise_id: params.enterpriseId,
|
|
28
|
+
person_id: params.personId,
|
|
29
|
+
event_type: params.eventType,
|
|
30
|
+
previous_status: (_a = params.previousStatus) !== null && _a !== void 0 ? _a : null,
|
|
31
|
+
next_status: (_b = params.nextStatus) !== null && _b !== void 0 ? _b : null,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (_c) {
|
|
36
|
+
// Keep license operations working until the YAML table is applied.
|
|
37
|
+
}
|
|
38
|
+
}
|
|
19
39
|
async getDashboard(userId, requestedEnterpriseId) {
|
|
20
40
|
if (requestedEnterpriseId !== undefined) {
|
|
21
41
|
const allowed = await this.prisma.enterprise_user.findFirst({
|
|
@@ -297,60 +317,67 @@ let TrainingAdminService = class TrainingAdminService {
|
|
|
297
317
|
throw new common_1.NotFoundException('No active enterprise found for this user');
|
|
298
318
|
}
|
|
299
319
|
const enterpriseId = enterpriseUser.enterprise_id;
|
|
300
|
-
const { search, status, deliveryMode, instructorId } = options;
|
|
320
|
+
const { page = 1, pageSize = 10, search, status, deliveryMode, instructorId } = options;
|
|
301
321
|
const now = new Date();
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
select: {
|
|
332
|
-
file: { select: { location: true } },
|
|
333
|
-
image_type: { select: { slug: true } },
|
|
334
|
-
},
|
|
322
|
+
const where = {
|
|
323
|
+
AND: [
|
|
324
|
+
{ enterprise_class_group: { some: { enterprise_id: enterpriseId } } },
|
|
325
|
+
...(status ? [{ status: status }] : []),
|
|
326
|
+
...(deliveryMode ? [{ delivery_mode: deliveryMode }] : []),
|
|
327
|
+
...(instructorId !== undefined ? [{ instructor_id: instructorId }] : []),
|
|
328
|
+
...(search
|
|
329
|
+
? [
|
|
330
|
+
{
|
|
331
|
+
OR: [
|
|
332
|
+
{ title: { contains: search, mode: 'insensitive' } },
|
|
333
|
+
{ code: { contains: search, mode: 'insensitive' } },
|
|
334
|
+
{ course: { title: { contains: search, mode: 'insensitive' } } },
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
]
|
|
338
|
+
: []),
|
|
339
|
+
],
|
|
340
|
+
};
|
|
341
|
+
const include = api_prisma_1.Prisma.validator()({
|
|
342
|
+
course: {
|
|
343
|
+
select: {
|
|
344
|
+
id: true,
|
|
345
|
+
title: true,
|
|
346
|
+
course_image: {
|
|
347
|
+
where: { image_type: { slug: { in: ['course-logo', 'course-banner'] } } },
|
|
348
|
+
orderBy: { is_primary: 'desc' },
|
|
349
|
+
select: {
|
|
350
|
+
file: { select: { location: true } },
|
|
351
|
+
image_type: { select: { slug: true } },
|
|
335
352
|
},
|
|
336
353
|
},
|
|
337
354
|
},
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
|
-
course_class_session: {
|
|
347
|
-
where: { session_date: { gte: now } },
|
|
348
|
-
orderBy: { session_date: 'asc' },
|
|
349
|
-
take: 1,
|
|
350
|
-
select: { session_date: true, start_time: true, location: true },
|
|
355
|
+
},
|
|
356
|
+
instructor: {
|
|
357
|
+
include: { person: { select: { name: true } } },
|
|
358
|
+
},
|
|
359
|
+
_count: {
|
|
360
|
+
select: {
|
|
361
|
+
course_enrollment: { where: { status: { not: 'cancelled' } } },
|
|
351
362
|
},
|
|
352
363
|
},
|
|
364
|
+
course_class_session: {
|
|
365
|
+
where: { session_date: { gte: now } },
|
|
366
|
+
orderBy: { session_date: 'asc' },
|
|
367
|
+
take: 1,
|
|
368
|
+
select: { session_date: true, start_time: true, location: true },
|
|
369
|
+
},
|
|
353
370
|
});
|
|
371
|
+
const [classGroups, total] = await this.prisma.$transaction([
|
|
372
|
+
this.prisma.course_class_group.findMany({
|
|
373
|
+
where,
|
|
374
|
+
orderBy: { start_date: 'desc' },
|
|
375
|
+
include,
|
|
376
|
+
skip: (page - 1) * pageSize,
|
|
377
|
+
take: pageSize,
|
|
378
|
+
}),
|
|
379
|
+
this.prisma.course_class_group.count({ where }),
|
|
380
|
+
]);
|
|
354
381
|
const cgIds = classGroups.map((cg) => cg.id);
|
|
355
382
|
const completedCounts = cgIds.length > 0
|
|
356
383
|
? await this.prisma.course_enrollment.groupBy({
|
|
@@ -396,7 +423,7 @@ let TrainingAdminService = class TrainingAdminService {
|
|
|
396
423
|
completionRate,
|
|
397
424
|
};
|
|
398
425
|
});
|
|
399
|
-
return { data, total:
|
|
426
|
+
return { data, total, page, pageSize, lastPage: Math.ceil(total / pageSize) };
|
|
400
427
|
}
|
|
401
428
|
// ── Class-group detail endpoints ─────────────────────────────────────────────
|
|
402
429
|
async assertAdminHasAccessToClassGroup(userId, classGroupId) {
|
|
@@ -745,16 +772,31 @@ let TrainingAdminService = class TrainingAdminService {
|
|
|
745
772
|
if (existingStudent.status !== 'inactive') {
|
|
746
773
|
throw new common_1.ConflictException('This person already has an active license');
|
|
747
774
|
}
|
|
748
|
-
|
|
775
|
+
const updated = await this.prisma.enterprise_student.update({
|
|
749
776
|
where: { id: existingStudent.id },
|
|
750
777
|
data: { status: 'active' },
|
|
751
778
|
select: { id: true, person_id: true, status: true, created_at: true },
|
|
752
779
|
});
|
|
780
|
+
await this.recordLicenseEvent({
|
|
781
|
+
enterpriseId,
|
|
782
|
+
personId,
|
|
783
|
+
eventType: 'status_changed',
|
|
784
|
+
previousStatus: existingStudent.status,
|
|
785
|
+
nextStatus: 'active',
|
|
786
|
+
});
|
|
787
|
+
return updated;
|
|
753
788
|
}
|
|
754
|
-
|
|
789
|
+
const createdStudent = await this.prisma.enterprise_student.create({
|
|
755
790
|
data: { enterprise_id: enterpriseId, person_id: personId, status: 'pending' },
|
|
756
791
|
select: { id: true, person_id: true, status: true, created_at: true },
|
|
757
792
|
});
|
|
793
|
+
await this.recordLicenseEvent({
|
|
794
|
+
enterpriseId,
|
|
795
|
+
personId,
|
|
796
|
+
eventType: 'assigned',
|
|
797
|
+
nextStatus: 'pending',
|
|
798
|
+
});
|
|
799
|
+
return createdStudent;
|
|
758
800
|
}
|
|
759
801
|
async revokeLicense(userId, personId) {
|
|
760
802
|
const enterpriseUser = await this.prisma.enterprise_user.findFirst({
|
|
@@ -765,15 +807,23 @@ let TrainingAdminService = class TrainingAdminService {
|
|
|
765
807
|
throw new common_1.NotFoundException('No active enterprise found for this user');
|
|
766
808
|
const existing = await this.prisma.enterprise_student.findFirst({
|
|
767
809
|
where: { enterprise_id: enterpriseUser.enterprise_id, person_id: personId },
|
|
768
|
-
select: { id: true },
|
|
810
|
+
select: { id: true, status: true },
|
|
769
811
|
});
|
|
770
812
|
if (!existing)
|
|
771
813
|
throw new common_1.NotFoundException('Student not found in your enterprise');
|
|
772
|
-
|
|
814
|
+
const updated = await this.prisma.enterprise_student.update({
|
|
773
815
|
where: { id: existing.id },
|
|
774
816
|
data: { status: 'inactive' },
|
|
775
817
|
select: { id: true },
|
|
776
818
|
});
|
|
819
|
+
await this.recordLicenseEvent({
|
|
820
|
+
enterpriseId: enterpriseUser.enterprise_id,
|
|
821
|
+
personId,
|
|
822
|
+
eventType: 'revoked',
|
|
823
|
+
previousStatus: existing.status,
|
|
824
|
+
nextStatus: 'inactive',
|
|
825
|
+
});
|
|
826
|
+
return updated;
|
|
777
827
|
}
|
|
778
828
|
// ── Enrollment methods ────────────────────────────────────────────────────────
|
|
779
829
|
async getEnrollableStudents(userId, classGroupId, search) {
|
|
@@ -959,6 +1009,12 @@ let TrainingAdminService = class TrainingAdminService {
|
|
|
959
1009
|
},
|
|
960
1010
|
select: { id: true },
|
|
961
1011
|
});
|
|
1012
|
+
await this.recordLicenseEvent({
|
|
1013
|
+
enterpriseId,
|
|
1014
|
+
personId,
|
|
1015
|
+
eventType: 'assigned',
|
|
1016
|
+
nextStatus: 'active',
|
|
1017
|
+
});
|
|
962
1018
|
}
|
|
963
1019
|
const existingEnrollment = await this.prisma.course_enrollment.findFirst({
|
|
964
1020
|
where: { course_class_group_id: classGroupId, person_id: personId },
|