@programisto/edrm-exams 0.3.6 → 0.3.8

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 (30) hide show
  1. package/dist/bin/www.js +1 -1
  2. package/dist/modules/edrm-exams/listeners/correct.listener.d.ts +1 -1
  3. package/dist/modules/edrm-exams/listeners/correct.listener.js +1 -1
  4. package/dist/modules/edrm-exams/models/candidate.model.d.ts +1 -1
  5. package/dist/modules/edrm-exams/models/candidate.model.js +1 -1
  6. package/dist/modules/edrm-exams/models/company.model.d.ts +1 -1
  7. package/dist/modules/edrm-exams/models/company.model.js +1 -1
  8. package/dist/modules/edrm-exams/models/contact.model.d.ts +1 -1
  9. package/dist/modules/edrm-exams/models/contact.model.js +1 -1
  10. package/dist/modules/edrm-exams/models/test-category.models.d.ts +1 -1
  11. package/dist/modules/edrm-exams/models/test-category.models.js +1 -1
  12. package/dist/modules/edrm-exams/models/test-job.model.d.ts +1 -1
  13. package/dist/modules/edrm-exams/models/test-job.model.js +1 -1
  14. package/dist/modules/edrm-exams/models/test-question.model.d.ts +1 -1
  15. package/dist/modules/edrm-exams/models/test-question.model.js +1 -1
  16. package/dist/modules/edrm-exams/models/test-result.model.d.ts +1 -1
  17. package/dist/modules/edrm-exams/models/test-result.model.js +1 -1
  18. package/dist/modules/edrm-exams/models/test.model.d.ts +1 -1
  19. package/dist/modules/edrm-exams/models/test.model.js +1 -1
  20. package/dist/modules/edrm-exams/models/user.model.d.ts +1 -1
  21. package/dist/modules/edrm-exams/models/user.model.js +1 -1
  22. package/dist/modules/edrm-exams/routes/company.router.d.ts +1 -1
  23. package/dist/modules/edrm-exams/routes/company.router.js +1 -1
  24. package/dist/modules/edrm-exams/routes/exams-candidate.router.d.ts +1 -1
  25. package/dist/modules/edrm-exams/routes/exams-candidate.router.js +1 -1
  26. package/dist/modules/edrm-exams/routes/exams.router.d.ts +1 -1
  27. package/dist/modules/edrm-exams/routes/exams.router.js +8 -6
  28. package/dist/modules/edrm-exams/routes/result.router.d.ts +1 -1
  29. package/dist/modules/edrm-exams/routes/result.router.js +1 -1
  30. package/package.json +2 -2
package/dist/bin/www.js CHANGED
@@ -9,5 +9,5 @@ if (fs.existsSync(localAppPath)) {
9
9
  await import(localAppPath);
10
10
  }
11
11
  else {
12
- await import('@programisto/endurance-core');
12
+ await import('@programisto/endurance');
13
13
  }
@@ -1,2 +1,2 @@
1
- import { enduranceListener } from '@programisto/endurance-core';
1
+ import { enduranceListener } from '@programisto/endurance';
2
2
  export default enduranceListener;
@@ -1,4 +1,4 @@
1
- import { enduranceListener, enduranceEventTypes, enduranceEmitter } from '@programisto/endurance-core';
1
+ import { enduranceListener, enduranceEventTypes, enduranceEmitter } from '@programisto/endurance';
2
2
  import TestQuestion from '../models/test-question.model.js';
3
3
  import { generateLiveMessageAssistant } from '../lib/openai.js';
4
4
  import TestResult, { TestState } from '../models/test-result.model.js';
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  import { Types } from 'mongoose';
3
3
  export declare enum ExperienceLevel {
4
4
  JUNIOR = "JUNIOR",
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  import { Types } from 'mongoose';
12
12
  // Enum pour les niveaux d'expérience
13
13
  /* eslint-disable no-unused-vars */
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  declare class Company extends EnduranceSchema {
3
3
  name: string;
4
4
  logo: string;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  let Company = class Company extends EnduranceSchema {
12
12
  name;
13
13
  logo;
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  import { Types } from 'mongoose';
3
3
  declare class Contact extends EnduranceSchema {
4
4
  firstname: string;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  import { Types } from 'mongoose';
12
12
  let Contact = class Contact extends EnduranceSchema {
13
13
  firstname;
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  declare class TestCategory extends EnduranceSchema {
3
3
  name: string;
4
4
  static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof TestCategory, import("@typegoose/typegoose/lib/types").BeAnObject>;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  let TestCategory = class TestCategory extends EnduranceSchema {
12
12
  name;
13
13
  static getModel() {
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  declare class TestJob extends EnduranceSchema {
3
3
  name: string;
4
4
  static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof TestJob, import("@typegoose/typegoose/lib/types").BeAnObject>;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  let TestJob = class TestJob extends EnduranceSchema {
12
12
  name;
13
13
  static getModel() {
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  declare enum QuestionType {
3
3
  MCQ = "MCQ",
4
4
  FreeQuestion = "free question",
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  var QuestionType;
12
12
  (function (QuestionType) {
13
13
  // eslint-disable-next-line no-unused-vars
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema, ObjectId } from '@programisto/endurance-core';
1
+ import { EnduranceSchema, ObjectId } from '@programisto/endurance';
2
2
  import Test from './test.model.js';
3
3
  import User from './user.model.js';
4
4
  export declare enum TestState {
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  import Test from './test.model.js';
12
12
  import User from './user.model.js';
13
13
  export var TestState;
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  import Company from './company.model.js';
3
3
  import TestQuestion from './test-question.model.js';
4
4
  import TestCategory from './test-category.models.js';
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  import Company from './company.model.js';
12
12
  import TestJob from './test-job.model.js';
13
13
  import User from './user.model.js';
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  import Company from './company.model.js';
3
3
  declare enum UserRole {
4
4
  Admin = "admin",
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
10
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
11
11
  import Company from './company.model.js';
12
12
  var UserRole;
13
13
  (function (UserRole) {
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter } from '@programisto/endurance-core';
1
+ import { EnduranceRouter } from '@programisto/endurance';
2
2
  declare class CompanyRouter extends EnduranceRouter {
3
3
  constructor();
4
4
  setupRoutes(): void;
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter, EnduranceAuthMiddleware } from '@programisto/endurance-core';
1
+ import { EnduranceRouter, EnduranceAuthMiddleware } from '@programisto/endurance';
2
2
  import Company from '../models/company.model.js';
3
3
  import UserExam from '../models/user.model.js';
4
4
  class CompanyRouter extends EnduranceRouter {
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter } from '@programisto/endurance-core';
1
+ import { EnduranceRouter } from '@programisto/endurance';
2
2
  declare class CandidateRouter extends EnduranceRouter {
3
3
  constructor();
4
4
  setupRoutes(): void;
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter, EnduranceAuthMiddleware, enduranceEmitter, enduranceEventTypes } from '@programisto/endurance-core';
1
+ import { EnduranceRouter, EnduranceAuthMiddleware, enduranceEmitter, enduranceEventTypes } from '@programisto/endurance';
2
2
  import CandidateModel from '../models/candidate.model.js';
3
3
  import ContactModel from '../models/contact.model.js';
4
4
  import TestResult from '../models/test-result.model.js';
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter } from '@programisto/endurance-core';
1
+ import { EnduranceRouter } from '@programisto/endurance';
2
2
  declare class ExamsRouter extends EnduranceRouter {
3
3
  constructor();
4
4
  private generateAndSaveQuestion;
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter, EnduranceAuthMiddleware, enduranceEmitter as emitter, enduranceEventTypes as eventTypes } from '@programisto/endurance-core';
1
+ import { EnduranceRouter, EnduranceAuthMiddleware, enduranceEmitter as emitter, enduranceEventTypes as eventTypes } from '@programisto/endurance';
2
2
  import Test from '../models/test.model.js';
3
3
  import TestQuestion from '../models/test-question.model.js';
4
4
  import TestResult from '../models/test-result.model.js';
@@ -35,7 +35,7 @@ class ExamsRouter extends EnduranceRouter {
35
35
  constructor() {
36
36
  super(EnduranceAuthMiddleware.getInstance());
37
37
  }
38
- async generateAndSaveQuestion(test, categoryInfo, useAssistant = false) {
38
+ async generateAndSaveQuestion(test, categoryInfo, useAssistant = false, questionTypeOverride) {
39
39
  try {
40
40
  const categoryDoc = await TestCategory.findById(categoryInfo.categoryId);
41
41
  if (!categoryDoc) {
@@ -50,7 +50,9 @@ class ExamsRouter extends EnduranceRouter {
50
50
  job: jobName,
51
51
  seniority: test.seniorityLevel,
52
52
  category: categoryDoc.name,
53
- questionType: ['MCQ', 'free question', 'exercice'][Math.floor(Math.random() * 3)],
53
+ questionType: (questionTypeOverride && questionTypeOverride !== 'ALL')
54
+ ? questionTypeOverride
55
+ : ['MCQ', 'free question', 'exercice'][Math.floor(Math.random() * 3)],
54
56
  expertiseLevel: categoryInfo.expertiseLevel,
55
57
  otherQuestions: otherQuestions.map(question => question.instruction).join('\n')
56
58
  };
@@ -990,7 +992,7 @@ class ExamsRouter extends EnduranceRouter {
990
992
  // Générer plusieurs questions pour un test
991
993
  this.put('/test/generateQuestions/:id', authenticatedOptions, async (req, res) => {
992
994
  const { id } = req.params;
993
- const { numberOfQuestions, category } = req.body;
995
+ const { numberOfQuestions, category, questionType } = req.body;
994
996
  if (!numberOfQuestions || numberOfQuestions <= 0) {
995
997
  return res.status(400).json({ message: 'Le nombre de questions doit être positif' });
996
998
  }
@@ -1028,7 +1030,7 @@ class ExamsRouter extends EnduranceRouter {
1028
1030
  const categoryInfo = categoriesToUse[0];
1029
1031
  while (questionsGenerated < numberOfQuestions && attempts < maxAttempts) {
1030
1032
  attempts++;
1031
- const question = await this.generateAndSaveQuestion(test, categoryInfo, true);
1033
+ const question = await this.generateAndSaveQuestion(test, categoryInfo, true, questionType);
1032
1034
  if (question) {
1033
1035
  generatedQuestions.push(question);
1034
1036
  questionsGenerated++;
@@ -1043,7 +1045,7 @@ class ExamsRouter extends EnduranceRouter {
1043
1045
  // Sélectionner une catégorie aléatoire
1044
1046
  const randomCategoryIndex = Math.floor(Math.random() * shuffledCategories.length);
1045
1047
  const categoryInfo = shuffledCategories[randomCategoryIndex];
1046
- const question = await this.generateAndSaveQuestion(test, categoryInfo, true);
1048
+ const question = await this.generateAndSaveQuestion(test, categoryInfo, true, questionType);
1047
1049
  if (question) {
1048
1050
  generatedQuestions.push(question);
1049
1051
  questionsGenerated++;
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter } from '@programisto/endurance-core';
1
+ import { EnduranceRouter } from '@programisto/endurance';
2
2
  declare class ResultRouter extends EnduranceRouter {
3
3
  constructor();
4
4
  setupRoutes(): void;
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter, EnduranceAuthMiddleware, enduranceEmitter, enduranceEventTypes } from '@programisto/endurance-core';
1
+ import { EnduranceRouter, EnduranceAuthMiddleware, enduranceEmitter, enduranceEventTypes } from '@programisto/endurance';
2
2
  import CandidateModel from '../models/candidate.model.js';
3
3
  import TestResult, { TestState } from '../models/test-result.model.js';
4
4
  import Test from '../models/test.model.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@programisto/edrm-exams",
4
- "version": "0.3.6",
4
+ "version": "0.3.8",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -17,7 +17,7 @@
17
17
  "prepare": "husky install"
18
18
  },
19
19
  "dependencies": {
20
- "@programisto/endurance-core": "^1.1.6",
20
+ "@programisto/endurance": "^1.0.2",
21
21
  "aws-sdk": "^2.1692.0",
22
22
  "debug": "^4.3.7",
23
23
  "fs": "^0.0.1-security",