@taiger-common/model 1.0.47 → 1.0.49

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.
@@ -1,12 +1,308 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.programSchema = exports.programModule = exports.DIFFICULTY_KEYS = exports.PROGRAM_SUBJECT_KEYS = void 0;
4
+ exports.programSchema = exports.programModule = exports.DIFFICULTY_KEYS = exports.PROGRAM_SUBJECT_KEYS = exports.SCHOOL_TYPES = exports.SchoolType = exports.SCHOOL_TAGS = exports.DIFFICULTY = exports.SemesterType = exports.PROGRAM_SUBJECTS = void 0;
4
5
  var mongoose_1 = require("mongoose");
5
- var core_1 = require("@taiger-common/core");
6
6
  var ObjectId = mongoose_1.Schema.Types.ObjectId;
7
- var SCHOOL_TAG_KEYS = Object.keys(core_1.SCHOOL_TAGS);
8
- exports.PROGRAM_SUBJECT_KEYS = Object.keys(core_1.PROGRAM_SUBJECTS);
9
- exports.DIFFICULTY_KEYS = Object.keys(core_1.DIFFICULTY);
7
+ exports.PROGRAM_SUBJECTS = {
8
+ LING: {
9
+ label: 'Linguistics',
10
+ category: 'AH'
11
+ },
12
+ MUS: {
13
+ label: 'Music',
14
+ category: 'AH'
15
+ },
16
+ THEO: {
17
+ label: 'Theology, Divinity and Religious Studies',
18
+ category: 'AH'
19
+ },
20
+ ARCH: {
21
+ label: 'Archaeology',
22
+ category: 'AH'
23
+ },
24
+ 'ARCH-BE': {
25
+ label: 'Architecture and Built Environment',
26
+ category: 'AH'
27
+ },
28
+ 'ART-DES': {
29
+ label: 'Art and Design',
30
+ category: 'AH'
31
+ },
32
+ CLAH: {
33
+ label: 'Classics and Ancient History',
34
+ category: 'AH'
35
+ },
36
+ ELL: {
37
+ label: 'English Language and Literature',
38
+ category: 'AH'
39
+ },
40
+ HIST: {
41
+ label: 'History',
42
+ category: 'AH'
43
+ },
44
+ ARTH: {
45
+ label: 'Art History',
46
+ category: 'AH'
47
+ },
48
+ 'MOD-LANG': {
49
+ label: 'Modern Languages',
50
+ category: 'AH'
51
+ },
52
+ 'PERF-ART': {
53
+ label: 'Performing Arts',
54
+ category: 'AH'
55
+ },
56
+ PHIL: {
57
+ label: 'Philosophy',
58
+ category: 'AH'
59
+ },
60
+ 'CHEM-ENG': {
61
+ label: 'Engineering - Chemical',
62
+ category: 'ET'
63
+ },
64
+ 'CIV-STR-ENG': {
65
+ label: 'Engineering - Civil and Structural',
66
+ category: 'ET'
67
+ },
68
+ CSIS: {
69
+ label: 'Computer Science and Information Systems',
70
+ category: 'ET'
71
+ },
72
+ 'DS-AI': {
73
+ label: 'Data Science and Artificial Intelligence',
74
+ category: 'ET'
75
+ },
76
+ 'ELEC-ENG': {
77
+ label: 'Engineering - Electrical and Electronic',
78
+ category: 'ET'
79
+ },
80
+ 'PETRO-ENG': {
81
+ label: 'Engineering - Petroleum',
82
+ category: 'ET'
83
+ },
84
+ 'MECH-ENG': {
85
+ label: 'Engineering - Mechanical',
86
+ category: 'ET'
87
+ },
88
+ 'MIN-MIN-ENG': {
89
+ label: 'Engineering - Mineral and Mining',
90
+ category: 'ET'
91
+ },
92
+ 'AG-FOR': {
93
+ label: 'Agriculture and Forestry',
94
+ category: 'LSM'
95
+ },
96
+ 'ANA-PHYS': {
97
+ label: 'Anatomy and Physiology',
98
+ category: 'LSM'
99
+ },
100
+ 'BIO-SCI': {
101
+ label: 'Biological Sciences',
102
+ category: 'LSM'
103
+ },
104
+ DENT: {
105
+ label: 'Dentistry',
106
+ category: 'LSM'
107
+ },
108
+ MED: {
109
+ label: 'Medicine',
110
+ category: 'LSM'
111
+ },
112
+ NURS: {
113
+ label: 'Nursing',
114
+ category: 'LSM'
115
+ },
116
+ PHARM: {
117
+ label: 'Pharmacy and Pharmacology',
118
+ category: 'LSM'
119
+ },
120
+ PSYCH: {
121
+ label: 'Psychology',
122
+ category: 'LSM'
123
+ },
124
+ 'VET-SCI': {
125
+ label: 'Veterinary Science',
126
+ category: 'LSM'
127
+ },
128
+ CHEM: {
129
+ label: 'Chemistry',
130
+ category: 'NS'
131
+ },
132
+ 'EAR-MAR-SCI': {
133
+ label: 'Earth and Marine Sciences',
134
+ category: 'NS'
135
+ },
136
+ 'ENV-SCI': {
137
+ label: 'Environmental Sciences',
138
+ category: 'NS'
139
+ },
140
+ GEO: {
141
+ label: 'Geography',
142
+ category: 'NS'
143
+ },
144
+ GEOL: {
145
+ label: 'Geology',
146
+ category: 'NS'
147
+ },
148
+ GEOPH: {
149
+ label: 'Geophysics',
150
+ category: 'NS'
151
+ },
152
+ 'MAT-SCI': {
153
+ label: 'Materials Sciences',
154
+ category: 'NS'
155
+ },
156
+ MATH: {
157
+ label: 'Mathematics',
158
+ category: 'NS'
159
+ },
160
+ 'PHYS-ASTRO': {
161
+ label: 'Physics and Astronomy',
162
+ category: 'NS'
163
+ },
164
+ 'ACC-FIN': {
165
+ label: 'Accounting and Finance',
166
+ category: 'SSM'
167
+ },
168
+ ANTH: {
169
+ label: 'Anthropology',
170
+ category: 'SSM'
171
+ },
172
+ 'BUS-MGMT': {
173
+ label: 'Business and Management Studies',
174
+ category: 'SSM'
175
+ },
176
+ 'COMM-MEDIA': {
177
+ label: 'Communication and Media Studies',
178
+ category: 'SSM'
179
+ },
180
+ 'DEV-STUD': {
181
+ label: 'Development Studies',
182
+ category: 'SSM'
183
+ },
184
+ ECON: {
185
+ label: 'Economics and Econometrics',
186
+ category: 'SSM'
187
+ },
188
+ 'EDU-TRAIN': {
189
+ label: 'Education and Training',
190
+ category: 'SSM'
191
+ },
192
+ 'HOSP-MGMT': {
193
+ label: 'Hospitality and Leisure Management',
194
+ category: 'SSM'
195
+ },
196
+ LAW: {
197
+ label: 'Law and Legal Studies',
198
+ category: 'SSM'
199
+ },
200
+ 'LIB-INFO': {
201
+ label: 'Library and Information Management',
202
+ category: 'SSM'
203
+ },
204
+ MKT: {
205
+ label: 'Marketing',
206
+ category: 'SSM'
207
+ },
208
+ POL: {
209
+ label: 'Politics',
210
+ category: 'SSM'
211
+ },
212
+ 'SOC-POL': {
213
+ label: 'Social Policy and Administration',
214
+ category: 'SSM'
215
+ },
216
+ SOC: {
217
+ label: 'Sociology',
218
+ category: 'SSM'
219
+ },
220
+ SPORT: {
221
+ label: 'Sports-Related Subjects',
222
+ category: 'SSM'
223
+ },
224
+ 'STAT-OR': {
225
+ label: 'Statistics and Operational Research',
226
+ category: 'SSM'
227
+ }
228
+ };
229
+ var SemesterType;
230
+ (function (SemesterType) {
231
+ SemesterType["SummerSemester"] = "SS";
232
+ SemesterType["WinterSemester"] = "WS";
233
+ SemesterType["Rolling"] = "Rolling";
234
+ })(SemesterType = exports.SemesterType || (exports.SemesterType = {}));
235
+ var Category;
236
+ (function (Category) {
237
+ Category["TU9"] = "TU9";
238
+ Category["U15"] = "U15";
239
+ Category["EUROTECH"] = "EUROTECH";
240
+ Category["GERMAN_ELITE"] = "GERMAN_ELITE";
241
+ Category["TOP50"] = "TOP50";
242
+ Category["TIME"] = "TIME";
243
+ Category["TOP100"] = "TOP100";
244
+ Category["TOP150"] = "TOP150";
245
+ Category["TOP250"] = "TOP250";
246
+ Category["TOP500"] = "TOP500";
247
+ })(Category || (Category = {}));
248
+ exports.DIFFICULTY = {
249
+ EASY: 'EASY',
250
+ HARD: 'HARD'
251
+ };
252
+ exports.SCHOOL_TAGS = (_a = {},
253
+ _a[Category.U15] = {
254
+ label: 'U15',
255
+ category: 'U15'
256
+ },
257
+ _a[Category.TU9] = {
258
+ label: 'TU9 German Universities of Technology',
259
+ category: 'TU9'
260
+ },
261
+ _a[Category.EUROTECH] = {
262
+ label: 'EuroTech Universities Alliance',
263
+ category: 'EUROTECH'
264
+ },
265
+ _a[Category.GERMAN_ELITE] = {
266
+ label: 'German Excellence Initiative',
267
+ category: 'GERMAN_ELITE'
268
+ },
269
+ _a[Category.TIME] = {
270
+ label: 'Top International Managers in Engineering',
271
+ category: 'TIME'
272
+ },
273
+ _a[Category.TOP50] = {
274
+ label: 'QS Top 50 Universities',
275
+ category: 'TOP50'
276
+ },
277
+ _a[Category.TOP100] = {
278
+ label: 'QS Top 100 Universities',
279
+ category: 'TOP100'
280
+ },
281
+ _a[Category.TOP150] = {
282
+ label: 'QS Top 150 Universities',
283
+ category: 'TOP150'
284
+ },
285
+ _a[Category.TOP250] = {
286
+ label: 'QS Top 250 Universities',
287
+ category: 'TOP150'
288
+ },
289
+ _a[Category.TOP500] = {
290
+ label: 'QS Top 500 Universities',
291
+ category: 'TOP500'
292
+ },
293
+ _a);
294
+ var SchoolType;
295
+ (function (SchoolType) {
296
+ SchoolType["University"] = "University";
297
+ SchoolType["University_of_Applied_Sciences"] = "University_of_Applied_Sciences";
298
+ })(SchoolType = exports.SchoolType || (exports.SchoolType = {}));
299
+ exports.SCHOOL_TYPES = [
300
+ SchoolType.University,
301
+ SchoolType.University_of_Applied_Sciences
302
+ ];
303
+ var SCHOOL_TAG_KEYS = Object.keys(exports.SCHOOL_TAGS);
304
+ exports.PROGRAM_SUBJECT_KEYS = Object.keys(exports.PROGRAM_SUBJECTS);
305
+ exports.DIFFICULTY_KEYS = Object.keys(exports.DIFFICULTY);
10
306
  exports.programModule = {
11
307
  isArchiv: Boolean,
12
308
  school: {
@@ -230,7 +526,7 @@ exports.programModule = {
230
526
  },
231
527
  schoolType: {
232
528
  type: String,
233
- enum: core_1.SCHOOL_TYPES
529
+ enum: exports.SCHOOL_TYPES
234
530
  },
235
531
  isEssayConsultantNeeded: {
236
532
  type: Boolean,
@@ -3,19 +3,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.editorSchema = exports.agentSchema = exports.managerSchema = exports.externalSchema = exports.studentSchema = exports.userSchema = exports.attributeSchema = exports.options = exports.ManagerType = exports.DocumentStatusType = void 0;
6
7
  var mongoose_1 = require("mongoose");
7
8
  var validator_1 = __importDefault(require("validator"));
8
- var core_1 = require("@taiger-common/core");
9
9
  var users_1 = require("../constants/users");
10
10
  var Program_1 = require("./Program");
11
- var ManagerType = {
11
+ // --- Interfaces for frontend/backend type reference ---
12
+ var DocumentStatusType;
13
+ (function (DocumentStatusType) {
14
+ DocumentStatusType["Uploaded"] = "uploaded";
15
+ DocumentStatusType["Missing"] = "missing";
16
+ DocumentStatusType["Accepted"] = "accepted";
17
+ DocumentStatusType["Rejected"] = "rejected";
18
+ DocumentStatusType["NotNeeded"] = "notneeded";
19
+ })(DocumentStatusType = exports.DocumentStatusType || (exports.DocumentStatusType = {}));
20
+ exports.ManagerType = {
12
21
  Agent: 'Agent',
13
22
  Editor: 'Editor',
14
23
  AgentAndEditor: 'AgentAndEditor',
15
24
  None: 'None'
16
25
  };
17
- var options = { discriminatorKey: 'role', timestamps: true };
18
- var attributeSchema = new mongoose_1.Schema({
26
+ exports.options = { discriminatorKey: 'role', timestamps: true };
27
+ exports.attributeSchema = new mongoose_1.Schema({
19
28
  value: {
20
29
  type: Number,
21
30
  required: true
@@ -25,7 +34,7 @@ var attributeSchema = new mongoose_1.Schema({
25
34
  required: true
26
35
  }
27
36
  });
28
- var userSchema = new mongoose_1.Schema({
37
+ exports.userSchema = new mongoose_1.Schema({
29
38
  role: {
30
39
  type: String,
31
40
  enum: Object.values(users_1.Role),
@@ -119,8 +128,8 @@ var userSchema = new mongoose_1.Schema({
119
128
  },
120
129
  status: {
121
130
  type: String,
122
- enum: Object.values(core_1.DocumentStatusType),
123
- default: core_1.DocumentStatusType.Missing
131
+ enum: Object.values(DocumentStatusType),
132
+ default: DocumentStatusType.Missing
124
133
  },
125
134
  file_category: {
126
135
  type: String,
@@ -140,8 +149,8 @@ var userSchema = new mongoose_1.Schema({
140
149
  },
141
150
  status: {
142
151
  type: String,
143
- enum: Object.values(core_1.DocumentStatusType),
144
- default: core_1.DocumentStatusType.Missing
152
+ enum: Object.values(DocumentStatusType),
153
+ default: DocumentStatusType.Missing
145
154
  },
146
155
  file_category: {
147
156
  type: String,
@@ -368,8 +377,8 @@ var userSchema = new mongoose_1.Schema({
368
377
  }
369
378
  },
370
379
  lastLoginAt: Date
371
- }, options);
372
- var studentSchema = new mongoose_1.Schema({
380
+ }, exports.options);
381
+ exports.studentSchema = new mongoose_1.Schema({
373
382
  agents: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Agent' }],
374
383
  editors: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Editor' }],
375
384
  needEditor: { type: Boolean, default: false },
@@ -379,7 +388,7 @@ var studentSchema = new mongoose_1.Schema({
379
388
  },
380
389
  attributes: [
381
390
  {
382
- type: attributeSchema,
391
+ type: exports.attributeSchema,
383
392
  required: true
384
393
  }
385
394
  ],
@@ -391,8 +400,8 @@ var studentSchema = new mongoose_1.Schema({
391
400
  },
392
401
  status: {
393
402
  type: String,
394
- enum: Object.values(core_1.DocumentStatusType),
395
- default: core_1.DocumentStatusType.Missing
403
+ enum: Object.values(DocumentStatusType),
404
+ default: DocumentStatusType.Missing
396
405
  },
397
406
  required: {
398
407
  type: Boolean,
@@ -425,8 +434,8 @@ var studentSchema = new mongoose_1.Schema({
425
434
  createdAt: Date
426
435
  }
427
436
  ]
428
- }, options);
429
- var externalSchema = new mongoose_1.Schema({
437
+ }, exports.options);
438
+ exports.externalSchema = new mongoose_1.Schema({
430
439
  attribute: {
431
440
  can_update_program_list: {
432
441
  type: Boolean,
@@ -441,14 +450,14 @@ var externalSchema = new mongoose_1.Schema({
441
450
  default: false
442
451
  }
443
452
  }
444
- }, options);
445
- var managerSchema = new mongoose_1.Schema({
453
+ }, exports.options);
454
+ exports.managerSchema = new mongoose_1.Schema({
446
455
  agents: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Agent' }],
447
456
  editors: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Editor' }],
448
457
  manager_type: {
449
458
  type: String,
450
- enum: Object.values(ManagerType),
451
- default: ManagerType.None
459
+ enum: Object.values(exports.ManagerType),
460
+ default: exports.ManagerType.None
452
461
  },
453
462
  manager_notification: {
454
463
  isRead_new_base_docs_uploaded: [
@@ -486,7 +495,7 @@ var managerSchema = new mongoose_1.Schema({
486
495
  default: false
487
496
  }
488
497
  }
489
- }, options);
498
+ }, exports.options);
490
499
  var officehours = {
491
500
  Monday: {
492
501
  active: { type: Boolean, default: false },
@@ -517,7 +526,7 @@ var officehours = {
517
526
  time_slots: [{ type: Object }]
518
527
  }
519
528
  };
520
- var agentSchema = new mongoose_1.Schema({
529
+ exports.agentSchema = new mongoose_1.Schema({
521
530
  timezone: { type: String, default: '' },
522
531
  officehours: officehours,
523
532
  selfIntroduction: {
@@ -554,8 +563,8 @@ var agentSchema = new mongoose_1.Schema({
554
563
  default: false
555
564
  }
556
565
  }
557
- }, options);
558
- var editorSchema = new mongoose_1.Schema({
566
+ }, exports.options);
567
+ exports.editorSchema = new mongoose_1.Schema({
559
568
  timezone: { type: String, default: '' },
560
569
  officehours: officehours,
561
570
  editor_notification: {
@@ -598,13 +607,4 @@ var editorSchema = new mongoose_1.Schema({
598
607
  default: false
599
608
  }
600
609
  }
601
- }, options);
602
- module.exports = {
603
- attributeSchema: attributeSchema,
604
- userSchema: userSchema,
605
- studentSchema: studentSchema,
606
- agentSchema: agentSchema,
607
- externalSchema: externalSchema,
608
- editorSchema: editorSchema,
609
- managerSchema: managerSchema
610
- };
610
+ }, exports.options);