@programisto/edrm-storage 0.3.1
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/README.md +135 -0
- package/dist/bin/www.d.ts +2 -0
- package/dist/bin/www.js +13 -0
- package/dist/modules/edrm-exams/lib/openai/correctQuestion.txt +9 -0
- package/dist/modules/edrm-exams/lib/openai/createQuestion.txt +6 -0
- package/dist/modules/edrm-exams/lib/openai.d.ts +37 -0
- package/dist/modules/edrm-exams/lib/openai.js +135 -0
- package/dist/modules/edrm-exams/listeners/correct.listener.d.ts +2 -0
- package/dist/modules/edrm-exams/listeners/correct.listener.js +167 -0
- package/dist/modules/edrm-exams/models/candidate.model.d.ts +21 -0
- package/dist/modules/edrm-exams/models/candidate.model.js +75 -0
- package/dist/modules/edrm-exams/models/candidate.models.d.ts +21 -0
- package/dist/modules/edrm-exams/models/candidate.models.js +75 -0
- package/dist/modules/edrm-exams/models/company.model.d.ts +8 -0
- package/dist/modules/edrm-exams/models/company.model.js +34 -0
- package/dist/modules/edrm-exams/models/contact.model.d.ts +14 -0
- package/dist/modules/edrm-exams/models/contact.model.js +60 -0
- package/dist/modules/edrm-exams/models/test-category.models.d.ts +7 -0
- package/dist/modules/edrm-exams/models/test-category.models.js +29 -0
- package/dist/modules/edrm-exams/models/test-job.model.d.ts +7 -0
- package/dist/modules/edrm-exams/models/test-job.model.js +29 -0
- package/dist/modules/edrm-exams/models/test-question.model.d.ts +25 -0
- package/dist/modules/edrm-exams/models/test-question.model.js +70 -0
- package/dist/modules/edrm-exams/models/test-result.model.d.ts +26 -0
- package/dist/modules/edrm-exams/models/test-result.model.js +70 -0
- package/dist/modules/edrm-exams/models/test.model.d.ts +47 -0
- package/dist/modules/edrm-exams/models/test.model.js +133 -0
- package/dist/modules/edrm-exams/models/user.model.d.ts +18 -0
- package/dist/modules/edrm-exams/models/user.model.js +73 -0
- package/dist/modules/edrm-exams/routes/company.router.d.ts +7 -0
- package/dist/modules/edrm-exams/routes/company.router.js +108 -0
- package/dist/modules/edrm-exams/routes/exams-candidate.router.d.ts +7 -0
- package/dist/modules/edrm-exams/routes/exams-candidate.router.js +448 -0
- package/dist/modules/edrm-exams/routes/exams.router.d.ts +8 -0
- package/dist/modules/edrm-exams/routes/exams.router.js +1343 -0
- package/dist/modules/edrm-exams/routes/result.router.d.ts +7 -0
- package/dist/modules/edrm-exams/routes/result.router.js +370 -0
- package/dist/modules/edrm-exams/routes/user.router.d.ts +7 -0
- package/dist/modules/edrm-exams/routes/user.router.js +96 -0
- package/dist/modules/edrm-storage/config/edrm-storage.config.d.ts +29 -0
- package/dist/modules/edrm-storage/config/edrm-storage.config.js +31 -0
- package/dist/modules/edrm-storage/config/environment.example.d.ts +54 -0
- package/dist/modules/edrm-storage/config/environment.example.js +130 -0
- package/dist/modules/edrm-storage/examples/usage.example.d.ts +52 -0
- package/dist/modules/edrm-storage/examples/usage.example.js +156 -0
- package/dist/modules/edrm-storage/index.d.ts +5 -0
- package/dist/modules/edrm-storage/index.js +8 -0
- package/dist/modules/edrm-storage/integration/edrm-storage-integration.d.ts +53 -0
- package/dist/modules/edrm-storage/integration/edrm-storage-integration.js +132 -0
- package/dist/modules/edrm-storage/interfaces/storage-provider.interface.d.ts +35 -0
- package/dist/modules/edrm-storage/interfaces/storage-provider.interface.js +1 -0
- package/dist/modules/edrm-storage/migrations/edrm-storage.migration.d.ts +6 -0
- package/dist/modules/edrm-storage/migrations/edrm-storage.migration.js +151 -0
- package/dist/modules/edrm-storage/models/file.model.d.ts +78 -0
- package/dist/modules/edrm-storage/models/file.model.js +190 -0
- package/dist/modules/edrm-storage/providers/s3-storage.provider.d.ts +18 -0
- package/dist/modules/edrm-storage/providers/s3-storage.provider.js +95 -0
- package/dist/modules/edrm-storage/routes/edrm-storage.router.d.ts +8 -0
- package/dist/modules/edrm-storage/routes/edrm-storage.router.js +155 -0
- package/dist/modules/edrm-storage/scripts/quick-start.d.ts +7 -0
- package/dist/modules/edrm-storage/scripts/quick-start.js +114 -0
- package/dist/modules/edrm-storage/services/edrm-storage.service.d.ts +29 -0
- package/dist/modules/edrm-storage/services/edrm-storage.service.js +188 -0
- package/dist/modules/edrm-storage/tests/edrm-storage.service.test.d.ts +1 -0
- package/dist/modules/edrm-storage/tests/edrm-storage.service.test.js +143 -0
- package/dist/modules/edrm-storage/tests/integration.test.d.ts +1 -0
- package/dist/modules/edrm-storage/tests/integration.test.js +141 -0
- package/package.json +81 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
import { Types } from 'mongoose';
|
|
12
|
+
// Enum pour les niveaux d'expérience
|
|
13
|
+
/* eslint-disable no-unused-vars */
|
|
14
|
+
export var ExperienceLevel;
|
|
15
|
+
(function (ExperienceLevel) {
|
|
16
|
+
ExperienceLevel["JUNIOR"] = "JUNIOR";
|
|
17
|
+
ExperienceLevel["INTERMEDIATE"] = "INTERMEDIATE";
|
|
18
|
+
ExperienceLevel["SENIOR"] = "SENIOR";
|
|
19
|
+
ExperienceLevel["EXPERT"] = "EXPERT";
|
|
20
|
+
})(ExperienceLevel || (ExperienceLevel = {}));
|
|
21
|
+
/* eslint-enable no-unused-vars */
|
|
22
|
+
let Candidate = class Candidate extends EnduranceSchema {
|
|
23
|
+
contact;
|
|
24
|
+
experienceLevel;
|
|
25
|
+
yearsOfExperience;
|
|
26
|
+
skills;
|
|
27
|
+
magicLinkToken;
|
|
28
|
+
magicLinkExpiresAt;
|
|
29
|
+
authToken;
|
|
30
|
+
authTokenExpiresAt;
|
|
31
|
+
static getModel() {
|
|
32
|
+
return CandidateModel;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
EnduranceModelType.prop({ required: true, ref: 'Contact' }),
|
|
37
|
+
__metadata("design:type", Types.ObjectId)
|
|
38
|
+
], Candidate.prototype, "contact", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
EnduranceModelType.prop({ required: false, enum: ExperienceLevel, default: ExperienceLevel.JUNIOR }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], Candidate.prototype, "experienceLevel", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
EnduranceModelType.prop({ required: false, type: Number, default: 0 }),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], Candidate.prototype, "yearsOfExperience", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
EnduranceModelType.prop({ type: [String], required: true }),
|
|
49
|
+
__metadata("design:type", Array)
|
|
50
|
+
], Candidate.prototype, "skills", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
EnduranceModelType.prop({ required: false, type: String }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], Candidate.prototype, "magicLinkToken", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
EnduranceModelType.prop({ required: false, type: Date }),
|
|
57
|
+
__metadata("design:type", Date)
|
|
58
|
+
], Candidate.prototype, "magicLinkExpiresAt", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
EnduranceModelType.prop({ required: false, type: String }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], Candidate.prototype, "authToken", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
EnduranceModelType.prop({ required: false, type: Date }),
|
|
65
|
+
__metadata("design:type", Date)
|
|
66
|
+
], Candidate.prototype, "authTokenExpiresAt", void 0);
|
|
67
|
+
Candidate = __decorate([
|
|
68
|
+
EnduranceModelType.modelOptions({
|
|
69
|
+
options: {
|
|
70
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
], Candidate);
|
|
74
|
+
const CandidateModel = EnduranceModelType.getModelForClass(Candidate);
|
|
75
|
+
export default CandidateModel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EnduranceSchema } from '@programisto/endurance-core';
|
|
2
|
+
declare class Company extends EnduranceSchema {
|
|
3
|
+
name: string;
|
|
4
|
+
logo: string;
|
|
5
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof Company, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
6
|
+
}
|
|
7
|
+
declare const CompanyModel: import("@typegoose/typegoose").ReturnModelType<typeof Company, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
8
|
+
export default CompanyModel;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
let Company = class Company extends EnduranceSchema {
|
|
12
|
+
name;
|
|
13
|
+
logo;
|
|
14
|
+
static getModel() {
|
|
15
|
+
return CompanyModel;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
EnduranceModelType.prop({ required: true }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], Company.prototype, "name", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
EnduranceModelType.prop({ required: true }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], Company.prototype, "logo", void 0);
|
|
26
|
+
Company = __decorate([
|
|
27
|
+
EnduranceModelType.modelOptions({
|
|
28
|
+
options: {
|
|
29
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
], Company);
|
|
33
|
+
const CompanyModel = EnduranceModelType.getModelForClass(Company);
|
|
34
|
+
export default CompanyModel;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EnduranceSchema } from '@programisto/endurance-core';
|
|
2
|
+
import { Types } from 'mongoose';
|
|
3
|
+
declare class Contact extends EnduranceSchema {
|
|
4
|
+
firstname: string;
|
|
5
|
+
lastname: string;
|
|
6
|
+
email: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
linkedin?: string;
|
|
9
|
+
city: string;
|
|
10
|
+
notes: Types.ObjectId[];
|
|
11
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof Contact, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
12
|
+
}
|
|
13
|
+
declare const ContactModel: import("@typegoose/typegoose").ReturnModelType<typeof Contact, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
14
|
+
export default ContactModel;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
import { Types } from 'mongoose';
|
|
12
|
+
let Contact = class Contact extends EnduranceSchema {
|
|
13
|
+
firstname;
|
|
14
|
+
lastname;
|
|
15
|
+
email;
|
|
16
|
+
phone;
|
|
17
|
+
linkedin;
|
|
18
|
+
city;
|
|
19
|
+
notes;
|
|
20
|
+
static getModel() {
|
|
21
|
+
return ContactModel;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
__decorate([
|
|
25
|
+
EnduranceModelType.prop({ required: true }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], Contact.prototype, "firstname", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
EnduranceModelType.prop({ required: true }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], Contact.prototype, "lastname", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
EnduranceModelType.prop({ required: true }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Contact.prototype, "email", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
EnduranceModelType.prop(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Contact.prototype, "phone", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
EnduranceModelType.prop(),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Contact.prototype, "linkedin", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
EnduranceModelType.prop({ required: true }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], Contact.prototype, "city", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
EnduranceModelType.prop({ type: [Types.ObjectId], ref: 'Note', default: [] }),
|
|
50
|
+
__metadata("design:type", Array)
|
|
51
|
+
], Contact.prototype, "notes", void 0);
|
|
52
|
+
Contact = __decorate([
|
|
53
|
+
EnduranceModelType.modelOptions({
|
|
54
|
+
options: {
|
|
55
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
], Contact);
|
|
59
|
+
const ContactModel = EnduranceModelType.getModelForClass(Contact);
|
|
60
|
+
export default ContactModel;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EnduranceSchema } from '@programisto/endurance-core';
|
|
2
|
+
declare class TestCategory extends EnduranceSchema {
|
|
3
|
+
name: string;
|
|
4
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof TestCategory, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
5
|
+
}
|
|
6
|
+
declare const TestCategoryModel: import("@typegoose/typegoose").ReturnModelType<typeof TestCategory, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
7
|
+
export default TestCategoryModel;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
let TestCategory = class TestCategory extends EnduranceSchema {
|
|
12
|
+
name;
|
|
13
|
+
static getModel() {
|
|
14
|
+
return TestCategoryModel;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
EnduranceModelType.prop({ required: true }),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], TestCategory.prototype, "name", void 0);
|
|
21
|
+
TestCategory = __decorate([
|
|
22
|
+
EnduranceModelType.modelOptions({
|
|
23
|
+
options: {
|
|
24
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
], TestCategory);
|
|
28
|
+
const TestCategoryModel = EnduranceModelType.getModelForClass(TestCategory);
|
|
29
|
+
export default TestCategoryModel;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EnduranceSchema } from '@programisto/endurance-core';
|
|
2
|
+
declare class TestJob extends EnduranceSchema {
|
|
3
|
+
name: string;
|
|
4
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof TestJob, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
5
|
+
}
|
|
6
|
+
declare const TestJobModel: import("@typegoose/typegoose").ReturnModelType<typeof TestJob, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
7
|
+
export default TestJobModel;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
let TestJob = class TestJob extends EnduranceSchema {
|
|
12
|
+
name;
|
|
13
|
+
static getModel() {
|
|
14
|
+
return TestJobModel;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
EnduranceModelType.prop({ required: true }),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], TestJob.prototype, "name", void 0);
|
|
21
|
+
TestJob = __decorate([
|
|
22
|
+
EnduranceModelType.modelOptions({
|
|
23
|
+
options: {
|
|
24
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
], TestJob);
|
|
28
|
+
const TestJobModel = EnduranceModelType.getModelForClass(TestJob);
|
|
29
|
+
export default TestJobModel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EnduranceSchema } from '@programisto/endurance-core';
|
|
2
|
+
declare enum QuestionType {
|
|
3
|
+
MCQ = "MCQ",
|
|
4
|
+
FreeQuestion = "free question",
|
|
5
|
+
Exercise = "exercice"
|
|
6
|
+
}
|
|
7
|
+
interface PossibleResponse {
|
|
8
|
+
possibleResponse: string;
|
|
9
|
+
valid: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare enum TextType {
|
|
12
|
+
Text = "text",
|
|
13
|
+
Code = "code"
|
|
14
|
+
}
|
|
15
|
+
declare class TestQuestion extends EnduranceSchema {
|
|
16
|
+
questionType: QuestionType;
|
|
17
|
+
instruction: string;
|
|
18
|
+
maxScore: number;
|
|
19
|
+
possibleResponses: PossibleResponse[];
|
|
20
|
+
time: number;
|
|
21
|
+
textType: TextType;
|
|
22
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof TestQuestion, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
23
|
+
}
|
|
24
|
+
declare const TestQuestionModel: import("@typegoose/typegoose").ReturnModelType<typeof TestQuestion, import("@typegoose/typegoose/lib/types").BeAnObject>;
|
|
25
|
+
export default TestQuestionModel;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
var QuestionType;
|
|
12
|
+
(function (QuestionType) {
|
|
13
|
+
// eslint-disable-next-line no-unused-vars
|
|
14
|
+
QuestionType["MCQ"] = "MCQ";
|
|
15
|
+
// eslint-disable-next-line no-unused-vars
|
|
16
|
+
QuestionType["FreeQuestion"] = "free question";
|
|
17
|
+
// eslint-disable-next-line no-unused-vars
|
|
18
|
+
QuestionType["Exercise"] = "exercice";
|
|
19
|
+
})(QuestionType || (QuestionType = {}));
|
|
20
|
+
var TextType;
|
|
21
|
+
(function (TextType) {
|
|
22
|
+
// eslint-disable-next-line no-unused-vars
|
|
23
|
+
TextType["Text"] = "text";
|
|
24
|
+
// eslint-disable-next-line no-unused-vars
|
|
25
|
+
TextType["Code"] = "code";
|
|
26
|
+
})(TextType || (TextType = {}));
|
|
27
|
+
let TestQuestion = class TestQuestion extends EnduranceSchema {
|
|
28
|
+
questionType;
|
|
29
|
+
instruction;
|
|
30
|
+
maxScore;
|
|
31
|
+
possibleResponses;
|
|
32
|
+
time;
|
|
33
|
+
textType;
|
|
34
|
+
static getModel() {
|
|
35
|
+
return TestQuestionModel;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
EnduranceModelType.prop({ required: true, enum: QuestionType }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], TestQuestion.prototype, "questionType", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
EnduranceModelType.prop({ required: true }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], TestQuestion.prototype, "instruction", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
EnduranceModelType.prop({ required: true }),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], TestQuestion.prototype, "maxScore", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
EnduranceModelType.prop({ type: [Object], required: false }),
|
|
52
|
+
__metadata("design:type", Array)
|
|
53
|
+
], TestQuestion.prototype, "possibleResponses", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
EnduranceModelType.prop({ required: true }),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], TestQuestion.prototype, "time", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
EnduranceModelType.prop({ required: false, enum: TextType, default: TextType.Text }),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], TestQuestion.prototype, "textType", void 0);
|
|
62
|
+
TestQuestion = __decorate([
|
|
63
|
+
EnduranceModelType.modelOptions({
|
|
64
|
+
options: {
|
|
65
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
], TestQuestion);
|
|
69
|
+
const TestQuestionModel = EnduranceModelType.getModelForClass(TestQuestion);
|
|
70
|
+
export default TestQuestionModel;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EnduranceSchema, ObjectId } from '@programisto/endurance-core';
|
|
2
|
+
import Test from './test.model.js';
|
|
3
|
+
import User from './user.model.js';
|
|
4
|
+
export declare enum TestState {
|
|
5
|
+
Pending = "pending",
|
|
6
|
+
InProgress = "inProgress",
|
|
7
|
+
Finish = "finish"
|
|
8
|
+
}
|
|
9
|
+
interface Response {
|
|
10
|
+
questionId: ObjectId;
|
|
11
|
+
response: string;
|
|
12
|
+
score?: number;
|
|
13
|
+
comment?: string;
|
|
14
|
+
}
|
|
15
|
+
declare class TestResult extends EnduranceSchema {
|
|
16
|
+
testId: typeof Test;
|
|
17
|
+
candidateId: typeof User;
|
|
18
|
+
state: TestState;
|
|
19
|
+
responses: Response[];
|
|
20
|
+
score?: number;
|
|
21
|
+
startTime?: Date;
|
|
22
|
+
endTime?: Date;
|
|
23
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof TestResult, import("@typegoose/typegoose/lib/types.js").BeAnObject>;
|
|
24
|
+
}
|
|
25
|
+
declare const TestResultModel: import("@typegoose/typegoose").ReturnModelType<typeof TestResult, import("@typegoose/typegoose/lib/types.js").BeAnObject>;
|
|
26
|
+
export default TestResultModel;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
import Test from './test.model.js';
|
|
12
|
+
import User from './user.model.js';
|
|
13
|
+
export var TestState;
|
|
14
|
+
(function (TestState) {
|
|
15
|
+
// eslint-disable-next-line no-unused-vars
|
|
16
|
+
TestState["Pending"] = "pending";
|
|
17
|
+
// eslint-disable-next-line no-unused-vars
|
|
18
|
+
TestState["InProgress"] = "inProgress";
|
|
19
|
+
// eslint-disable-next-line no-unused-vars
|
|
20
|
+
TestState["Finish"] = "finish";
|
|
21
|
+
})(TestState || (TestState = {}));
|
|
22
|
+
let TestResult = class TestResult extends EnduranceSchema {
|
|
23
|
+
testId;
|
|
24
|
+
candidateId;
|
|
25
|
+
state;
|
|
26
|
+
responses;
|
|
27
|
+
score;
|
|
28
|
+
startTime;
|
|
29
|
+
endTime;
|
|
30
|
+
static getModel() {
|
|
31
|
+
return TestResultModel;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
__decorate([
|
|
35
|
+
EnduranceModelType.prop({ ref: () => Test, required: true }),
|
|
36
|
+
__metadata("design:type", Object)
|
|
37
|
+
], TestResult.prototype, "testId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
EnduranceModelType.prop({ ref: () => User, required: true }),
|
|
40
|
+
__metadata("design:type", Object)
|
|
41
|
+
], TestResult.prototype, "candidateId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
EnduranceModelType.prop({ required: true, enum: TestState, default: TestState.Pending }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], TestResult.prototype, "state", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
EnduranceModelType.prop({ type: [Object], required: true }),
|
|
48
|
+
__metadata("design:type", Array)
|
|
49
|
+
], TestResult.prototype, "responses", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
EnduranceModelType.prop(),
|
|
52
|
+
__metadata("design:type", Number)
|
|
53
|
+
], TestResult.prototype, "score", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
EnduranceModelType.prop(),
|
|
56
|
+
__metadata("design:type", Date)
|
|
57
|
+
], TestResult.prototype, "startTime", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
EnduranceModelType.prop(),
|
|
60
|
+
__metadata("design:type", Date)
|
|
61
|
+
], TestResult.prototype, "endTime", void 0);
|
|
62
|
+
TestResult = __decorate([
|
|
63
|
+
EnduranceModelType.modelOptions({
|
|
64
|
+
options: {
|
|
65
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
], TestResult);
|
|
69
|
+
const TestResultModel = EnduranceModelType.getModelForClass(TestResult);
|
|
70
|
+
export default TestResultModel;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { EnduranceSchema } from '@programisto/endurance-core';
|
|
2
|
+
import Company from './company.model.js';
|
|
3
|
+
import TestQuestion from './test-question.model.js';
|
|
4
|
+
import TestCategory from './test-category.models.js';
|
|
5
|
+
import TestJob from './test-job.model.js';
|
|
6
|
+
import User from './user.model.js';
|
|
7
|
+
declare enum TestState {
|
|
8
|
+
Draft = "draft",
|
|
9
|
+
Published = "published",
|
|
10
|
+
Archived = "archived"
|
|
11
|
+
}
|
|
12
|
+
declare enum SeniorityLevel {
|
|
13
|
+
Student = "student",
|
|
14
|
+
Junior = "junior",
|
|
15
|
+
Intermediate = "intermediate",
|
|
16
|
+
Senior = "senior"
|
|
17
|
+
}
|
|
18
|
+
declare enum ExpertiseLevel {
|
|
19
|
+
Beginner = "beginner",
|
|
20
|
+
Intermediate = "intermediate",
|
|
21
|
+
Advanced = "advanced"
|
|
22
|
+
}
|
|
23
|
+
interface TestQuestions {
|
|
24
|
+
questionId: typeof TestQuestion;
|
|
25
|
+
order: number;
|
|
26
|
+
}
|
|
27
|
+
interface TestCategoryWithExpertise {
|
|
28
|
+
categoryId: typeof TestCategory;
|
|
29
|
+
expertiseLevel: ExpertiseLevel;
|
|
30
|
+
}
|
|
31
|
+
declare class Test extends EnduranceSchema {
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
companyId: typeof Company;
|
|
35
|
+
userId: typeof User;
|
|
36
|
+
questions: TestQuestions[];
|
|
37
|
+
state: TestState;
|
|
38
|
+
duration?: number;
|
|
39
|
+
passingScore?: number;
|
|
40
|
+
categories?: TestCategoryWithExpertise[];
|
|
41
|
+
targetJob: typeof TestJob;
|
|
42
|
+
seniorityLevel: SeniorityLevel;
|
|
43
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof Test, import("@typegoose/typegoose/lib/types.js").BeAnObject>;
|
|
44
|
+
migrateTargetJob(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
declare const TestModel: import("@typegoose/typegoose").ReturnModelType<typeof Test, import("@typegoose/typegoose/lib/types.js").BeAnObject>;
|
|
47
|
+
export default TestModel;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
|
|
11
|
+
import Company from './company.model.js';
|
|
12
|
+
import TestJob from './test-job.model.js';
|
|
13
|
+
import User from './user.model.js';
|
|
14
|
+
var TestState;
|
|
15
|
+
(function (TestState) {
|
|
16
|
+
// eslint-disable-next-line no-unused-vars
|
|
17
|
+
TestState["Draft"] = "draft";
|
|
18
|
+
// eslint-disable-next-line no-unused-vars
|
|
19
|
+
TestState["Published"] = "published";
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
21
|
+
TestState["Archived"] = "archived";
|
|
22
|
+
})(TestState || (TestState = {}));
|
|
23
|
+
var SeniorityLevel;
|
|
24
|
+
(function (SeniorityLevel) {
|
|
25
|
+
// eslint-disable-next-line no-unused-vars
|
|
26
|
+
SeniorityLevel["Student"] = "student";
|
|
27
|
+
// eslint-disable-next-line no-unused-vars
|
|
28
|
+
SeniorityLevel["Junior"] = "junior";
|
|
29
|
+
// eslint-disable-next-line no-unused-vars
|
|
30
|
+
SeniorityLevel["Intermediate"] = "intermediate";
|
|
31
|
+
// eslint-disable-next-line no-unused-vars
|
|
32
|
+
SeniorityLevel["Senior"] = "senior";
|
|
33
|
+
})(SeniorityLevel || (SeniorityLevel = {}));
|
|
34
|
+
var ExpertiseLevel;
|
|
35
|
+
(function (ExpertiseLevel) {
|
|
36
|
+
// eslint-disable-next-line no-unused-vars
|
|
37
|
+
ExpertiseLevel["Beginner"] = "beginner";
|
|
38
|
+
// eslint-disable-next-line no-unused-vars
|
|
39
|
+
ExpertiseLevel["Intermediate"] = "intermediate";
|
|
40
|
+
// eslint-disable-next-line no-unused-vars
|
|
41
|
+
ExpertiseLevel["Advanced"] = "advanced";
|
|
42
|
+
})(ExpertiseLevel || (ExpertiseLevel = {}));
|
|
43
|
+
let Test = class Test extends EnduranceSchema {
|
|
44
|
+
title;
|
|
45
|
+
description;
|
|
46
|
+
companyId;
|
|
47
|
+
userId;
|
|
48
|
+
questions;
|
|
49
|
+
state;
|
|
50
|
+
duration;
|
|
51
|
+
passingScore;
|
|
52
|
+
categories;
|
|
53
|
+
targetJob;
|
|
54
|
+
seniorityLevel;
|
|
55
|
+
static getModel() {
|
|
56
|
+
return TestModel;
|
|
57
|
+
}
|
|
58
|
+
// Méthode pour migrer automatiquement les anciennes données
|
|
59
|
+
async migrateTargetJob() {
|
|
60
|
+
const testData = this;
|
|
61
|
+
// Si targetJob est une string (ancien format), on la migre
|
|
62
|
+
if (typeof testData.targetJob === 'string') {
|
|
63
|
+
try {
|
|
64
|
+
// Chercher si le job existe déjà
|
|
65
|
+
let jobType = await TestJob.findOne({ name: testData.targetJob });
|
|
66
|
+
// Si pas trouvé, on le crée
|
|
67
|
+
if (!jobType) {
|
|
68
|
+
jobType = new TestJob({ name: testData.targetJob });
|
|
69
|
+
await jobType.save();
|
|
70
|
+
}
|
|
71
|
+
// Mettre à jour la référence
|
|
72
|
+
this.targetJob = jobType._id;
|
|
73
|
+
await this.save();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error('Erreur lors de la migration du targetJob:', error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
__decorate([
|
|
82
|
+
EnduranceModelType.prop({ required: true }),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], Test.prototype, "title", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
EnduranceModelType.prop({ required: false }),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], Test.prototype, "description", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
EnduranceModelType.prop({ ref: () => Company, required: false }),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], Test.prototype, "companyId", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
EnduranceModelType.prop({ ref: () => User, required: false }),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], Test.prototype, "userId", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
EnduranceModelType.prop({ type: [Object], required: true }),
|
|
99
|
+
__metadata("design:type", Array)
|
|
100
|
+
], Test.prototype, "questions", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
EnduranceModelType.prop({ required: true, enum: TestState, default: TestState.Draft }),
|
|
103
|
+
__metadata("design:type", String)
|
|
104
|
+
], Test.prototype, "state", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
EnduranceModelType.prop(),
|
|
107
|
+
__metadata("design:type", Number)
|
|
108
|
+
], Test.prototype, "duration", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
EnduranceModelType.prop(),
|
|
111
|
+
__metadata("design:type", Number)
|
|
112
|
+
], Test.prototype, "passingScore", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
EnduranceModelType.prop({ type: [Object], required: false }),
|
|
115
|
+
__metadata("design:type", Array)
|
|
116
|
+
], Test.prototype, "categories", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
EnduranceModelType.prop({ ref: () => TestJob, required: true }),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], Test.prototype, "targetJob", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
EnduranceModelType.prop({ required: true, enum: SeniorityLevel }),
|
|
123
|
+
__metadata("design:type", String)
|
|
124
|
+
], Test.prototype, "seniorityLevel", void 0);
|
|
125
|
+
Test = __decorate([
|
|
126
|
+
EnduranceModelType.modelOptions({
|
|
127
|
+
options: {
|
|
128
|
+
allowMixed: EnduranceModelType.Severity.ALLOW
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
], Test);
|
|
132
|
+
const TestModel = EnduranceModelType.getModelForClass(Test);
|
|
133
|
+
export default TestModel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EnduranceSchema } from '@programisto/endurance-core';
|
|
2
|
+
import Company from './company.model.js';
|
|
3
|
+
declare enum UserRole {
|
|
4
|
+
Admin = "admin",
|
|
5
|
+
Recruiter = "recruiter",
|
|
6
|
+
Candidate = "candidate"
|
|
7
|
+
}
|
|
8
|
+
declare class UserExam extends EnduranceSchema {
|
|
9
|
+
firstName: string;
|
|
10
|
+
lastName: string;
|
|
11
|
+
email: string;
|
|
12
|
+
password: string;
|
|
13
|
+
role: UserRole;
|
|
14
|
+
companyId?: typeof Company;
|
|
15
|
+
static getModel(): import("@typegoose/typegoose").ReturnModelType<typeof UserExam, import("@typegoose/typegoose/lib/types.js").BeAnObject>;
|
|
16
|
+
}
|
|
17
|
+
declare const UserExamModel: import("@typegoose/typegoose").ReturnModelType<typeof UserExam, import("@typegoose/typegoose/lib/types.js").BeAnObject>;
|
|
18
|
+
export default UserExamModel;
|