@programisto/edrm-exams 0.3.7 → 0.3.9

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 (31) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/www.js +1 -1
  3. package/dist/modules/edrm-exams/listeners/correct.listener.d.ts +1 -1
  4. package/dist/modules/edrm-exams/listeners/correct.listener.js +1 -1
  5. package/dist/modules/edrm-exams/models/candidate.model.d.ts +1 -1
  6. package/dist/modules/edrm-exams/models/candidate.model.js +1 -1
  7. package/dist/modules/edrm-exams/models/company.model.d.ts +1 -1
  8. package/dist/modules/edrm-exams/models/company.model.js +1 -1
  9. package/dist/modules/edrm-exams/models/contact.model.d.ts +1 -1
  10. package/dist/modules/edrm-exams/models/contact.model.js +1 -1
  11. package/dist/modules/edrm-exams/models/test-category.models.d.ts +1 -1
  12. package/dist/modules/edrm-exams/models/test-category.models.js +1 -1
  13. package/dist/modules/edrm-exams/models/test-job.model.d.ts +1 -1
  14. package/dist/modules/edrm-exams/models/test-job.model.js +1 -1
  15. package/dist/modules/edrm-exams/models/test-question.model.d.ts +1 -1
  16. package/dist/modules/edrm-exams/models/test-question.model.js +1 -1
  17. package/dist/modules/edrm-exams/models/test-result.model.d.ts +1 -1
  18. package/dist/modules/edrm-exams/models/test-result.model.js +1 -1
  19. package/dist/modules/edrm-exams/models/test.model.d.ts +1 -1
  20. package/dist/modules/edrm-exams/models/test.model.js +1 -1
  21. package/dist/modules/edrm-exams/models/user.model.d.ts +1 -1
  22. package/dist/modules/edrm-exams/models/user.model.js +1 -1
  23. package/dist/modules/edrm-exams/routes/company.router.d.ts +1 -1
  24. package/dist/modules/edrm-exams/routes/company.router.js +136 -7
  25. package/dist/modules/edrm-exams/routes/exams-candidate.router.d.ts +1 -1
  26. package/dist/modules/edrm-exams/routes/exams-candidate.router.js +227 -8
  27. package/dist/modules/edrm-exams/routes/exams.router.d.ts +1 -1
  28. package/dist/modules/edrm-exams/routes/exams.router.js +1022 -40
  29. package/dist/modules/edrm-exams/routes/result.router.d.ts +1 -1
  30. package/dist/modules/edrm-exams/routes/result.router.js +153 -6
  31. package/package.json +2 -2
package/README.md CHANGED
@@ -21,7 +21,7 @@ The Endurance Framework is a highly modular and scalable Node.js project templat
21
21
 
22
22
  ### Installation
23
23
 
24
- 1. Install our CLI:
24
+ 1. Install our CLI (optionnal):
25
25
 
26
26
  ```sh
27
27
  npm install -g endurance
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 {
@@ -10,7 +10,27 @@ class CompanyRouter extends EnduranceRouter {
10
10
  requireAuth: false,
11
11
  permissions: []
12
12
  };
13
- // Obtenir une entreprise par son ID
13
+ /**
14
+ * @swagger
15
+ * /companies/{id}:
16
+ * get:
17
+ * summary: Détail d'une entreprise
18
+ * description: Récupère une entreprise par son identifiant.
19
+ * tags: [Entreprises]
20
+ * parameters:
21
+ * - in: path
22
+ * name: id
23
+ * required: true
24
+ * schema:
25
+ * type: string
26
+ * responses:
27
+ * 200:
28
+ * description: Entreprise trouvée
29
+ * 404:
30
+ * description: Entreprise non trouvée
31
+ * 500:
32
+ * description: Erreur interne
33
+ */
14
34
  this.get('/:id', authenticatedOptions, async (req, res) => {
15
35
  const { id } = req.params;
16
36
  try {
@@ -25,7 +45,33 @@ class CompanyRouter extends EnduranceRouter {
25
45
  res.status(500).json({ message: 'Erreur interne du serveur' });
26
46
  }
27
47
  });
28
- // Créer une nouvelle entreprise
48
+ /**
49
+ * @swagger
50
+ * /companies/create:
51
+ * post:
52
+ * summary: Créer une entreprise
53
+ * description: Crée une nouvelle entreprise avec nom et logo.
54
+ * tags: [Entreprises]
55
+ * requestBody:
56
+ * required: true
57
+ * content:
58
+ * application/json:
59
+ * schema:
60
+ * type: object
61
+ * required: [name, logo]
62
+ * properties:
63
+ * name:
64
+ * type: string
65
+ * logo:
66
+ * type: string
67
+ * responses:
68
+ * 201:
69
+ * description: Entreprise créée
70
+ * 400:
71
+ * description: Paramètres manquants
72
+ * 500:
73
+ * description: Erreur interne
74
+ */
29
75
  this.post('/create', authenticatedOptions, async (req, res) => {
30
76
  const { name, logo } = req.body;
31
77
  if (!name || !logo) {
@@ -41,7 +87,38 @@ class CompanyRouter extends EnduranceRouter {
41
87
  res.status(500).json({ message: 'Erreur interne du serveur' });
42
88
  }
43
89
  });
44
- // Mettre à jour une entreprise
90
+ /**
91
+ * @swagger
92
+ * /companies/{id}:
93
+ * put:
94
+ * summary: Mettre à jour une entreprise
95
+ * description: Met à jour le nom ou le logo d'une entreprise.
96
+ * tags: [Entreprises]
97
+ * parameters:
98
+ * - in: path
99
+ * name: id
100
+ * required: true
101
+ * schema:
102
+ * type: string
103
+ * requestBody:
104
+ * required: true
105
+ * content:
106
+ * application/json:
107
+ * schema:
108
+ * type: object
109
+ * properties:
110
+ * name:
111
+ * type: string
112
+ * logo:
113
+ * type: string
114
+ * responses:
115
+ * 200:
116
+ * description: Entreprise mise à jour
117
+ * 404:
118
+ * description: Entreprise non trouvée
119
+ * 500:
120
+ * description: Erreur interne
121
+ */
45
122
  this.put('/:id', authenticatedOptions, async (req, res) => {
46
123
  const { id } = req.params;
47
124
  const { name, logo } = req.body;
@@ -63,7 +140,27 @@ class CompanyRouter extends EnduranceRouter {
63
140
  res.status(500).json({ message: 'Erreur interne du serveur' });
64
141
  }
65
142
  });
66
- // Supprimer une entreprise
143
+ /**
144
+ * @swagger
145
+ * /companies/{id}:
146
+ * delete:
147
+ * summary: Supprimer une entreprise
148
+ * description: Supprime une entreprise par son ID.
149
+ * tags: [Entreprises]
150
+ * parameters:
151
+ * - in: path
152
+ * name: id
153
+ * required: true
154
+ * schema:
155
+ * type: string
156
+ * responses:
157
+ * 200:
158
+ * description: Entreprise supprimée
159
+ * 404:
160
+ * description: Entreprise non trouvée
161
+ * 500:
162
+ * description: Erreur interne
163
+ */
67
164
  this.delete('/:id', authenticatedOptions, async (req, res) => {
68
165
  const { id } = req.params;
69
166
  try {
@@ -78,7 +175,27 @@ class CompanyRouter extends EnduranceRouter {
78
175
  res.status(500).json({ message: 'Erreur interne du serveur' });
79
176
  }
80
177
  });
81
- // Obtenir le nombre d'utilisateurs d'une entreprise
178
+ /**
179
+ * @swagger
180
+ * /companies/numberOfUser/{id}:
181
+ * get:
182
+ * summary: Nombre d'utilisateurs d'une entreprise
183
+ * description: Retourne le nombre d'utilisateurs associés à l'entreprise.
184
+ * tags: [Entreprises]
185
+ * parameters:
186
+ * - in: path
187
+ * name: id
188
+ * required: true
189
+ * schema:
190
+ * type: string
191
+ * responses:
192
+ * 200:
193
+ * description: Nombre d'utilisateurs retourné
194
+ * 404:
195
+ * description: Entreprise non trouvée
196
+ * 500:
197
+ * description: Erreur interne
198
+ */
82
199
  this.get('/numberOfUser/:id', authenticatedOptions, async (req, res) => {
83
200
  const { id } = req.params;
84
201
  try {
@@ -91,7 +208,19 @@ class CompanyRouter extends EnduranceRouter {
91
208
  res.status(500).json({ message: 'Erreur interne du serveur' });
92
209
  }
93
210
  });
94
- // Lister toutes les entreprises
211
+ /**
212
+ * @swagger
213
+ * /companies:
214
+ * get:
215
+ * summary: Lister les entreprises
216
+ * description: Retourne l'ensemble des entreprises.
217
+ * tags: [Entreprises]
218
+ * responses:
219
+ * 200:
220
+ * description: Liste des entreprises
221
+ * 500:
222
+ * description: Erreur interne
223
+ */
95
224
  this.get('/', authenticatedOptions, async (req, res) => {
96
225
  try {
97
226
  const companies = await Company.find();
@@ -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;