@taiger-common/model 1.0.13 → 1.0.15

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 (53) hide show
  1. package/dist/cjs/model/Internaldoc.js +14 -0
  2. package/dist/cjs/model/Interval.js +39 -0
  3. package/dist/cjs/model/Interview.js +40 -0
  4. package/dist/cjs/model/InterviewSurveyResponse.js +24 -0
  5. package/dist/cjs/model/Keywordset.js +48 -0
  6. package/dist/cjs/model/Note.js +9 -0
  7. package/dist/cjs/model/Permission.js +48 -0
  8. package/dist/cjs/model/Program.js +290 -0
  9. package/dist/cjs/model/Programrequirement.js +118 -0
  10. package/dist/cjs/model/ResponseTime.js +27 -0
  11. package/dist/cjs/model/SurveyInput.js +56 -0
  12. package/dist/cjs/model/Template.js +19 -0
  13. package/dist/cjs/model/Tenant.js +9 -0
  14. package/dist/cjs/model/Ticket.js +55 -0
  15. package/dist/cjs/model/Token.js +20 -0
  16. package/dist/cjs/model/User.js +676 -0
  17. package/dist/cjs/model/index.js +17 -0
  18. package/dist/esm/model/Internaldoc.js +11 -0
  19. package/dist/esm/model/Interval.js +36 -0
  20. package/dist/esm/model/Interview.js +37 -0
  21. package/dist/esm/model/InterviewSurveyResponse.js +21 -0
  22. package/dist/esm/model/Keywordset.js +45 -0
  23. package/dist/esm/model/Note.js +6 -0
  24. package/dist/esm/model/Permission.js +45 -0
  25. package/dist/esm/model/Program.js +287 -0
  26. package/dist/esm/model/Programrequirement.js +115 -0
  27. package/dist/esm/model/ResponseTime.js +24 -0
  28. package/dist/esm/model/SurveyInput.js +53 -0
  29. package/dist/esm/model/Template.js +16 -0
  30. package/dist/esm/model/Tenant.js +6 -0
  31. package/dist/esm/model/Ticket.js +52 -0
  32. package/dist/esm/model/Token.js +17 -0
  33. package/dist/esm/model/User.js +670 -0
  34. package/dist/esm/model/index.js +17 -0
  35. package/dist/types/model/Internaldoc.d.ts +58 -0
  36. package/dist/types/model/Interval.d.ts +58 -0
  37. package/dist/types/model/Interview.d.ts +84 -0
  38. package/dist/types/model/InterviewSurveyResponse.d.ts +93 -0
  39. package/dist/types/model/Keywordset.d.ts +75 -0
  40. package/dist/types/model/Note.d.ts +43 -0
  41. package/dist/types/model/Permission.d.ts +81 -0
  42. package/dist/types/model/Program.d.ts +453 -0
  43. package/dist/types/model/Programrequirement.d.ts +168 -0
  44. package/dist/types/model/ResponseTime.d.ts +49 -0
  45. package/dist/types/model/SurveyInput.d.ts +121 -0
  46. package/dist/types/model/Template.d.ts +46 -0
  47. package/dist/types/model/Tenant.d.ts +43 -0
  48. package/dist/types/model/Ticket.d.ts +69 -0
  49. package/dist/types/model/Token.d.ts +43 -0
  50. package/dist/types/model/User.d.ts +31 -0
  51. package/dist/types/model/index.d.ts +17 -0
  52. package/dist/umd/index.js +1 -1
  53. package/package.json +6 -1
@@ -0,0 +1,670 @@
1
+ import { model, Schema } from 'mongoose';
2
+ import isEmail from 'validator/lib/isEmail';
3
+ import { Role, DocumentStatusType } from '@taiger-common/core';
4
+ import { PROGRAM_SUBJECT_KEYS } from './Program';
5
+ var ManagerType = {
6
+ Agent: 'Agent',
7
+ Editor: 'Editor',
8
+ AgentAndEditor: 'AgentAndEditor',
9
+ None: 'None'
10
+ };
11
+ var options = { discriminatorKey: 'role', timestamps: true };
12
+ var attributeSchema = new Schema({
13
+ value: {
14
+ type: Number,
15
+ required: true
16
+ },
17
+ name: {
18
+ type: String,
19
+ required: true
20
+ }
21
+ });
22
+ var UserSchema = new Schema({
23
+ firstname: {
24
+ type: String,
25
+ trim: true
26
+ },
27
+ firstname_chinese: {
28
+ type: String,
29
+ trim: true
30
+ },
31
+ lastname: {
32
+ type: String,
33
+ trim: true
34
+ },
35
+ lastname_chinese: {
36
+ type: String,
37
+ trim: true
38
+ },
39
+ email: {
40
+ type: String,
41
+ unique: true,
42
+ lowercase: true,
43
+ validate: [isEmail, 'Invalid email address']
44
+ },
45
+ password: {
46
+ type: String,
47
+ select: false,
48
+ trim: true,
49
+ minlength: [8, 'Password must contain at least 8 characters']
50
+ },
51
+ archiv: { type: Boolean, default: false },
52
+ birthday: {
53
+ type: String,
54
+ default: ''
55
+ },
56
+ linkedIn: String,
57
+ lineId: String,
58
+ isAccountActivated: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ notification: {
63
+ isRead_survey_not_complete: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ isRead_uni_assist_task_assigned: {
68
+ type: Boolean,
69
+ default: false
70
+ },
71
+ isRead_new_agent_assigned: {
72
+ type: Boolean,
73
+ default: true
74
+ },
75
+ isRead_new_editor_assigned: {
76
+ type: Boolean,
77
+ default: true
78
+ },
79
+ isRead_new_cvmlrl_tasks_created: {
80
+ type: Boolean,
81
+ default: true
82
+ },
83
+ isRead_new_cvmlrl_messsage: {
84
+ type: Boolean,
85
+ default: true
86
+ },
87
+ isRead_base_documents_missing: {
88
+ type: Boolean,
89
+ default: false
90
+ },
91
+ isRead_base_documents_rejected: {
92
+ type: Boolean,
93
+ default: true
94
+ },
95
+ isRead_new_programs_assigned: {
96
+ type: Boolean,
97
+ default: false
98
+ }
99
+ },
100
+ taigerai: {
101
+ input: {
102
+ name: {
103
+ type: String,
104
+ default: ''
105
+ },
106
+ status: {
107
+ type: String,
108
+ enum: Object.values(DocumentStatusType),
109
+ default: DocumentStatusType.Missing
110
+ },
111
+ file_category: {
112
+ type: String,
113
+ default: 'Others'
114
+ },
115
+ path: {
116
+ type: String,
117
+ default: ''
118
+ },
119
+ // TODO: updateBy
120
+ updatedAt: Date
121
+ },
122
+ output: {
123
+ name: {
124
+ type: String,
125
+ default: ''
126
+ },
127
+ status: {
128
+ type: String,
129
+ enum: Object.values(DocumentStatusType),
130
+ default: DocumentStatusType.Missing
131
+ },
132
+ file_category: {
133
+ type: String,
134
+ default: 'Others'
135
+ },
136
+ path: {
137
+ type: String,
138
+ default: ''
139
+ },
140
+ // TODO: updateBy
141
+ updatedAt: Date
142
+ },
143
+ feedback: {
144
+ message: {
145
+ type: String,
146
+ default: ''
147
+ },
148
+ // TODO: updateBy
149
+ updatedAt: Date
150
+ }
151
+ },
152
+ application_preference: {
153
+ expected_application_date: {
154
+ type: String,
155
+ default: ''
156
+ },
157
+ expected_application_semester: {
158
+ type: String,
159
+ default: ''
160
+ },
161
+ target_program_language: {
162
+ type: String,
163
+ default: ''
164
+ },
165
+ // To be deprecated -> read only in frontend
166
+ target_application_field: {
167
+ type: String,
168
+ default: ''
169
+ },
170
+ targetApplicationSubjects: [
171
+ {
172
+ type: String,
173
+ enum: PROGRAM_SUBJECT_KEYS
174
+ }
175
+ ],
176
+ target_degree: {
177
+ type: String,
178
+ default: ''
179
+ },
180
+ considered_privat_universities: {
181
+ type: String,
182
+ default: '-'
183
+ },
184
+ special_wished: {
185
+ type: String,
186
+ default: ''
187
+ },
188
+ application_outside_germany: {
189
+ type: String,
190
+ default: '-'
191
+ },
192
+ updatedAt: Date
193
+ },
194
+ academic_background: {
195
+ university: {
196
+ high_school_isGraduated: {
197
+ type: String,
198
+ default: ''
199
+ },
200
+ attended_high_school: {
201
+ type: String,
202
+ default: ''
203
+ },
204
+ high_school_graduated_year: {
205
+ type: String,
206
+ default: ''
207
+ },
208
+ attended_university: {
209
+ type: String,
210
+ default: ''
211
+ },
212
+ attended_university_program: {
213
+ type: String,
214
+ default: ''
215
+ },
216
+ isGraduated: {
217
+ type: String,
218
+ default: '-'
219
+ },
220
+ expected_grad_date: {
221
+ type: String,
222
+ default: ''
223
+ },
224
+ Highest_GPA_Uni: {
225
+ type: Number
226
+ },
227
+ Passing_GPA_Uni: {
228
+ type: Number
229
+ },
230
+ My_GPA_Uni: {
231
+ type: Number
232
+ },
233
+ Has_Exchange_Experience: {
234
+ type: String,
235
+ default: '-'
236
+ },
237
+ isSecondGraduated: {
238
+ type: String,
239
+ default: '-'
240
+ },
241
+ expectedSecondDegreeGradDate: {
242
+ type: String,
243
+ default: ''
244
+ },
245
+ attendedSecondDegreeUniversity: {
246
+ type: String,
247
+ default: ''
248
+ },
249
+ attendedSecondDegreeProgram: {
250
+ type: String,
251
+ default: ''
252
+ },
253
+ highestSecondDegreeGPA: {
254
+ type: Number
255
+ },
256
+ passingSecondDegreeGPA: {
257
+ type: Number
258
+ },
259
+ mySecondDegreeGPA: {
260
+ type: Number
261
+ },
262
+ Has_Internship_Experience: {
263
+ type: String,
264
+ default: '-'
265
+ },
266
+ Has_Working_Experience: {
267
+ type: String,
268
+ default: '-'
269
+ },
270
+ updatedAt: Date
271
+ },
272
+ language: {
273
+ english_isPassed: {
274
+ type: String,
275
+ default: '-'
276
+ },
277
+ english_certificate: {
278
+ type: String,
279
+ default: ''
280
+ },
281
+ english_score: {
282
+ type: String,
283
+ default: ''
284
+ },
285
+ english_score_reading: {
286
+ type: String,
287
+ default: ''
288
+ },
289
+ english_score_listening: {
290
+ type: String,
291
+ default: ''
292
+ },
293
+ english_score_writing: {
294
+ type: String,
295
+ default: ''
296
+ },
297
+ english_score_speaking: {
298
+ type: String,
299
+ default: ''
300
+ },
301
+ english_test_date: {
302
+ type: String,
303
+ default: ''
304
+ },
305
+ german_isPassed: {
306
+ type: String,
307
+ default: '-'
308
+ },
309
+ german_certificate: {
310
+ type: String,
311
+ default: ''
312
+ },
313
+ german_score: {
314
+ type: String,
315
+ default: ''
316
+ },
317
+ german_test_date: {
318
+ type: String,
319
+ default: ''
320
+ },
321
+ gre_isPassed: {
322
+ type: String,
323
+ default: '-'
324
+ },
325
+ gre_certificate: {
326
+ type: String,
327
+ default: ''
328
+ },
329
+ gre_score: {
330
+ type: String,
331
+ default: ''
332
+ },
333
+ gre_test_date: {
334
+ type: String,
335
+ default: ''
336
+ },
337
+ gmat_isPassed: {
338
+ type: String,
339
+ default: '-'
340
+ },
341
+ gmat_certificate: {
342
+ type: String,
343
+ default: ''
344
+ },
345
+ gmat_score: {
346
+ type: String,
347
+ default: ''
348
+ },
349
+ gmat_test_date: {
350
+ type: String,
351
+ default: ''
352
+ },
353
+ updatedAt: Date
354
+ }
355
+ },
356
+ lastLoginAt: Date
357
+ }, options);
358
+ var User = model('User', UserSchema);
359
+ var Guest = User.discriminator('Guest', new Schema({}, options), Role.Guest);
360
+ var applicationSchema = new Schema({
361
+ programId: { type: Schema.Types.ObjectId, ref: 'Program' },
362
+ uni_assist: {
363
+ status: {
364
+ type: String,
365
+ default: 'notstarted'
366
+ },
367
+ vpd_file_path: {
368
+ type: String,
369
+ default: ''
370
+ },
371
+ vpd_paid_confirmation_file_path: {
372
+ type: String,
373
+ default: ''
374
+ },
375
+ vpd_paid_confirmation_file_status: {
376
+ type: String,
377
+ default: ''
378
+ },
379
+ isPaid: {
380
+ type: Boolean,
381
+ default: false
382
+ },
383
+ updatedAt: Date
384
+ },
385
+ portal_credentials: {
386
+ application_portal_a: {
387
+ account: { type: String, select: false, trim: true },
388
+ password: { type: String, select: false, trim: true }
389
+ },
390
+ application_portal_b: {
391
+ account: { type: String, select: false, trim: true },
392
+ password: { type: String, select: false, trim: true }
393
+ }
394
+ },
395
+ doc_modification_thread: [
396
+ {
397
+ isFinalVersion: {
398
+ type: Boolean,
399
+ default: false
400
+ },
401
+ latest_message_left_by_id: {
402
+ type: String,
403
+ default: ''
404
+ },
405
+ doc_thread_id: { type: Schema.Types.ObjectId, ref: 'Documentthread' },
406
+ updatedAt: Date,
407
+ createdAt: Date
408
+ }
409
+ ],
410
+ reject_reason: {
411
+ type: String,
412
+ default: ''
413
+ },
414
+ admission_letter: {
415
+ status: {
416
+ type: String,
417
+ default: 'notstarted'
418
+ },
419
+ admission_file_path: {
420
+ type: String,
421
+ default: ''
422
+ },
423
+ comments: { type: String, default: '' },
424
+ updatedAt: Date
425
+ },
426
+ finalEnrolment: { type: Boolean, default: false },
427
+ decided: { type: String, default: '-' },
428
+ closed: { type: String, default: '-' },
429
+ admission: { type: String, default: '-' }
430
+ });
431
+ var Student = User.discriminator('Student', new Schema({
432
+ agents: [{ type: Schema.Types.ObjectId, ref: 'Agent' }],
433
+ editors: [{ type: Schema.Types.ObjectId, ref: 'Editor' }],
434
+ needEditor: { type: Boolean, default: false },
435
+ applications: [applicationSchema],
436
+ applying_program_count: {
437
+ type: Number,
438
+ default: 0
439
+ },
440
+ attributes: [
441
+ {
442
+ type: attributeSchema,
443
+ required: true
444
+ }
445
+ ],
446
+ profile: [
447
+ {
448
+ name: {
449
+ type: String,
450
+ required: true
451
+ },
452
+ status: {
453
+ type: String,
454
+ enum: Object.values(DocumentStatusType),
455
+ default: DocumentStatusType.Missing
456
+ },
457
+ required: {
458
+ type: Boolean,
459
+ required: true
460
+ },
461
+ path: {
462
+ type: String,
463
+ default: ''
464
+ },
465
+ feedback: {
466
+ type: String,
467
+ default: ''
468
+ },
469
+ // TODO: updateBy
470
+ updatedAt: Date
471
+ }
472
+ ],
473
+ generaldocs_threads: [
474
+ {
475
+ isFinalVersion: {
476
+ type: Boolean,
477
+ default: false
478
+ },
479
+ latest_message_left_by_id: {
480
+ type: String,
481
+ default: ''
482
+ },
483
+ doc_thread_id: { type: Schema.Types.ObjectId, ref: 'Documentthread' },
484
+ updatedAt: Date,
485
+ createdAt: Date
486
+ }
487
+ ]
488
+ }, options), Role.Student);
489
+ var External = User.discriminator('External', new Schema({
490
+ attribute: {
491
+ can_update_program_list: {
492
+ type: Boolean,
493
+ default: false
494
+ },
495
+ can_update_course_analysis: {
496
+ type: Boolean,
497
+ default: false
498
+ },
499
+ can_add_articles: {
500
+ type: Boolean,
501
+ default: false
502
+ }
503
+ }
504
+ }, options), Role.External);
505
+ var Manager = User.discriminator('Manager', new Schema({
506
+ agents: [{ type: Schema.Types.ObjectId, ref: 'Agent' }],
507
+ editors: [{ type: Schema.Types.ObjectId, ref: 'Editor' }],
508
+ manager_type: {
509
+ type: String,
510
+ enum: Object.values(ManagerType),
511
+ default: ManagerType.None
512
+ },
513
+ manager_notification: {
514
+ isRead_new_base_docs_uploaded: [
515
+ {
516
+ student_id: {
517
+ type: String,
518
+ default: ''
519
+ }
520
+ }
521
+ ],
522
+ isRead_new_programs_assigned: {
523
+ type: Boolean,
524
+ default: false
525
+ }
526
+ },
527
+ attribute: {
528
+ can_write_ml: {
529
+ type: Boolean,
530
+ default: false
531
+ },
532
+ can_write_rl: {
533
+ type: Boolean,
534
+ default: false
535
+ },
536
+ can_write_cv: {
537
+ type: Boolean,
538
+ default: false
539
+ },
540
+ can_write_essay: {
541
+ type: Boolean,
542
+ default: false
543
+ },
544
+ can_do_interview: {
545
+ type: Boolean,
546
+ default: false
547
+ }
548
+ }
549
+ }, options), Role.Manager);
550
+ var Agent = User.discriminator('Agent', new Schema({
551
+ timezone: { type: String, default: '' },
552
+ officehours: {
553
+ Monday: {
554
+ active: { type: Boolean, default: false },
555
+ time_slots: [{ type: Object }]
556
+ },
557
+ Tuesday: {
558
+ active: { type: Boolean, default: false },
559
+ time_slots: [{ type: Object }]
560
+ },
561
+ Wednesday: {
562
+ active: { type: Boolean, default: false },
563
+ time_slots: [{ type: Object }]
564
+ },
565
+ Thursday: {
566
+ active: { type: Boolean, default: false },
567
+ time_slots: [{ type: Object }]
568
+ },
569
+ Friday: {
570
+ active: { type: Boolean, default: false },
571
+ time_slots: [{ type: Object }]
572
+ },
573
+ Saturday: {
574
+ active: { type: Boolean, default: false },
575
+ time_slots: [{ type: Object }]
576
+ },
577
+ Sunday: {
578
+ active: { type: Boolean, default: false },
579
+ time_slots: [{ type: Object }]
580
+ }
581
+ },
582
+ selfIntroduction: {
583
+ type: String,
584
+ default: ''
585
+ },
586
+ agent_notification: {
587
+ isRead_new_base_docs_uploaded: [
588
+ {
589
+ student_id: {
590
+ type: String,
591
+ default: ''
592
+ },
593
+ student_firstname: {
594
+ type: String,
595
+ default: ''
596
+ },
597
+ student_lastname: {
598
+ type: String,
599
+ default: ''
600
+ }
601
+ }
602
+ ],
603
+ isRead_new_survey_updated: {
604
+ type: Boolean,
605
+ default: true
606
+ },
607
+ isRead_applications_status_changed: {
608
+ type: Boolean,
609
+ default: true
610
+ },
611
+ isRead_new_programs_assigned: {
612
+ type: Boolean,
613
+ default: false
614
+ }
615
+ }
616
+ }, options), Role.Agent);
617
+ var Editor = User.discriminator('Editor', new Schema({
618
+ editor_notification: {
619
+ isRead_survey_not_complete: {
620
+ type: Boolean,
621
+ default: false
622
+ },
623
+ isRead_base_documents_missing: {
624
+ type: Boolean,
625
+ default: false
626
+ },
627
+ isRead_base_documents_rejected: {
628
+ type: Boolean,
629
+ default: false
630
+ },
631
+ isRead_new_programs_assigned: {
632
+ type: Boolean,
633
+ default: false
634
+ }
635
+ },
636
+ attribute: {
637
+ can_write_ml: {
638
+ type: Boolean,
639
+ default: false
640
+ },
641
+ can_write_rl: {
642
+ type: Boolean,
643
+ default: false
644
+ },
645
+ can_write_cv: {
646
+ type: Boolean,
647
+ default: false
648
+ },
649
+ can_write_essay: {
650
+ type: Boolean,
651
+ default: false
652
+ },
653
+ can_do_interview: {
654
+ type: Boolean,
655
+ default: false
656
+ }
657
+ }
658
+ }, options), Role.Editor);
659
+ export var Admin = User.discriminator('Admin', new Schema({}, options), Role.Admin);
660
+ module.exports = {
661
+ User: User,
662
+ UserSchema: UserSchema,
663
+ Guest: Guest,
664
+ Student: Student,
665
+ Agent: Agent,
666
+ External: External,
667
+ Editor: Editor,
668
+ Manager: Manager,
669
+ Admin: Admin
670
+ };
@@ -8,3 +8,20 @@ export * from './Docspage';
8
8
  export * from './Documentation';
9
9
  export * from './Documentthread';
10
10
  export * from './Event';
11
+ export * from './Internaldoc';
12
+ export * from './Interval';
13
+ export * from './Event';
14
+ export * from './Interview';
15
+ export * from './InterviewSurveyResponse';
16
+ export * from './Keywordset';
17
+ export * from './Note';
18
+ export * from './Permission';
19
+ export * from './Program';
20
+ export * from './Programrequirement';
21
+ export * from './ResponseTime';
22
+ export * from './SurveyInput';
23
+ export * from './Template';
24
+ export * from './Tenant';
25
+ export * from './Ticket';
26
+ export * from './Token';
27
+ export * from './User';