@driveup/schema 0.1.0
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 +174 -0
- package/lib/catalog/addon/addon.entity.d.ts +109 -0
- package/lib/catalog/addon/addon.entity.js +260 -0
- package/lib/catalog/addon/addon.entity.js.map +1 -0
- package/lib/catalog/addon/country.entity.d.ts +112 -0
- package/lib/catalog/addon/country.entity.js +246 -0
- package/lib/catalog/addon/country.entity.js.map +1 -0
- package/lib/catalog/driving/category.entity.d.ts +122 -0
- package/lib/catalog/driving/category.entity.js +217 -0
- package/lib/catalog/driving/category.entity.js.map +1 -0
- package/lib/catalog/driving/vehicle.entity.d.ts +49 -0
- package/lib/catalog/driving/vehicle.entity.js +97 -0
- package/lib/catalog/driving/vehicle.entity.js.map +1 -0
- package/lib/catalog/priceplan/priceplan.entity.d.ts +123 -0
- package/lib/catalog/priceplan/priceplan.entity.js +288 -0
- package/lib/catalog/priceplan/priceplan.entity.js.map +1 -0
- package/lib/catalog/product/country.entity.d.ts +109 -0
- package/lib/catalog/product/country.entity.js +233 -0
- package/lib/catalog/product/country.entity.js.map +1 -0
- package/lib/catalog/product/priceplan.entity.d.ts +113 -0
- package/lib/catalog/product/priceplan.entity.js +251 -0
- package/lib/catalog/product/priceplan.entity.js.map +1 -0
- package/lib/catalog/product/product.entity.d.ts +104 -0
- package/lib/catalog/product/product.entity.js +262 -0
- package/lib/catalog/product/product.entity.js.map +1 -0
- package/lib/catalog/program/program.entity.d.ts +107 -0
- package/lib/catalog/program/program.entity.js +247 -0
- package/lib/catalog/program/program.entity.js.map +1 -0
- package/lib/catalog/seed/assets/asset.entity.d.ts +68 -0
- package/lib/catalog/seed/assets/asset.entity.js +163 -0
- package/lib/catalog/seed/assets/asset.entity.js.map +1 -0
- package/lib/catalog/seed/courses/course.entity.d.ts +98 -0
- package/lib/catalog/seed/courses/course.entity.js +216 -0
- package/lib/catalog/seed/courses/course.entity.js.map +1 -0
- package/lib/catalog/seed/courses/lesson.entity.d.ts +90 -0
- package/lib/catalog/seed/courses/lesson.entity.js +214 -0
- package/lib/catalog/seed/courses/lesson.entity.js.map +1 -0
- package/lib/catalog/seed/courses/topic.entity.d.ts +77 -0
- package/lib/catalog/seed/courses/topic.entity.js +185 -0
- package/lib/catalog/seed/courses/topic.entity.js.map +1 -0
- package/lib/catalog/seed/expense/category.entity.d.ts +61 -0
- package/lib/catalog/seed/expense/category.entity.js +153 -0
- package/lib/catalog/seed/expense/category.entity.js.map +1 -0
- package/lib/index.d.ts +67 -0
- package/lib/index.js +89 -0
- package/lib/index.js.map +1 -0
- package/lib/profile/agent/agent.entity.d.ts +95 -0
- package/lib/profile/agent/agent.entity.js +223 -0
- package/lib/profile/agent/agent.entity.js.map +1 -0
- package/lib/profile/agent/payout.entity.d.ts +70 -0
- package/lib/profile/agent/payout.entity.js +160 -0
- package/lib/profile/agent/payout.entity.js.map +1 -0
- package/lib/profile/agent/promotion.entity.d.ts +82 -0
- package/lib/profile/agent/promotion.entity.js +174 -0
- package/lib/profile/agent/promotion.entity.js.map +1 -0
- package/lib/profile/company/company.entity.d.ts +234 -0
- package/lib/profile/company/company.entity.js +558 -0
- package/lib/profile/company/company.entity.js.map +1 -0
- package/lib/profile/company/course/appointment.entity.d.ts +111 -0
- package/lib/profile/company/course/appointment.entity.js +240 -0
- package/lib/profile/company/course/appointment.entity.js.map +1 -0
- package/lib/profile/company/course/course.entity.d.ts +156 -0
- package/lib/profile/company/course/course.entity.js +365 -0
- package/lib/profile/company/course/course.entity.js.map +1 -0
- package/lib/profile/company/course/lesson.entity.d.ts +123 -0
- package/lib/profile/company/course/lesson.entity.js +288 -0
- package/lib/profile/company/course/lesson.entity.js.map +1 -0
- package/lib/profile/company/course/topic.entity.d.ts +55 -0
- package/lib/profile/company/course/topic.entity.js +147 -0
- package/lib/profile/company/course/topic.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/bill.entity.d.ts +145 -0
- package/lib/profile/company/finances/billing/bill.entity.js +338 -0
- package/lib/profile/company/finances/billing/bill.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/item.entity.d.ts +75 -0
- package/lib/profile/company/finances/billing/item.entity.js +219 -0
- package/lib/profile/company/finances/billing/item.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/transaction.entity.d.ts +44 -0
- package/lib/profile/company/finances/billing/transaction.entity.js +158 -0
- package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -0
- package/lib/profile/company/finances/expense/category.entity.d.ts +55 -0
- package/lib/profile/company/finances/expense/category.entity.js +117 -0
- package/lib/profile/company/finances/expense/category.entity.js.map +1 -0
- package/lib/profile/company/finances/expense/expense.entity.d.ts +48 -0
- package/lib/profile/company/finances/expense/expense.entity.js +171 -0
- package/lib/profile/company/finances/expense/expense.entity.js.map +1 -0
- package/lib/profile/company/finances/handover/handover.entity.d.ts +44 -0
- package/lib/profile/company/finances/handover/handover.entity.js +202 -0
- package/lib/profile/company/finances/handover/handover.entity.js.map +1 -0
- package/lib/profile/company/finances/invoice/invoice.entity.d.ts +65 -0
- package/lib/profile/company/finances/invoice/invoice.entity.js +296 -0
- package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -0
- package/lib/profile/company/finances/invoice/item.entity.d.ts +25 -0
- package/lib/profile/company/finances/invoice/item.entity.js +148 -0
- package/lib/profile/company/finances/invoice/item.entity.js.map +1 -0
- package/lib/profile/company/finances/payment/method.entity.d.ts +35 -0
- package/lib/profile/company/finances/payment/method.entity.js +143 -0
- package/lib/profile/company/finances/payment/method.entity.js.map +1 -0
- package/lib/profile/company/finances/peyment/method.entity.d.ts +35 -0
- package/lib/profile/company/finances/peyment/method.entity.js +143 -0
- package/lib/profile/company/finances/peyment/method.entity.js.map +1 -0
- package/lib/profile/company/finances/peyment-method/payment-method.d.ts +34 -0
- package/lib/profile/company/finances/peyment-method/payment-method.js +118 -0
- package/lib/profile/company/finances/peyment-method/payment-method.js.map +1 -0
- package/lib/profile/company/instructor/instructor.entity.d.ts +85 -0
- package/lib/profile/company/instructor/instructor.entity.js +254 -0
- package/lib/profile/company/instructor/instructor.entity.js.map +1 -0
- package/lib/profile/company/instructor/task.entity.d.ts +60 -0
- package/lib/profile/company/instructor/task.entity.js +133 -0
- package/lib/profile/company/instructor/task.entity.js.map +1 -0
- package/lib/profile/company/medical/examination.entity.d.ts +59 -0
- package/lib/profile/company/medical/examination.entity.js +175 -0
- package/lib/profile/company/medical/examination.entity.js.map +1 -0
- package/lib/profile/company/medical/product.entity.d.ts +99 -0
- package/lib/profile/company/medical/product.entity.js +270 -0
- package/lib/profile/company/medical/product.entity.js.map +1 -0
- package/lib/profile/company/metrics/company.metric.d.ts +21 -0
- package/lib/profile/company/metrics/company.metric.js +122 -0
- package/lib/profile/company/metrics/company.metric.js.map +1 -0
- package/lib/profile/company/product/addon.entity.d.ts +93 -0
- package/lib/profile/company/product/addon.entity.js +234 -0
- package/lib/profile/company/product/addon.entity.js.map +1 -0
- package/lib/profile/company/product/priceplan.entity.d.ts +57 -0
- package/lib/profile/company/product/priceplan.entity.js +167 -0
- package/lib/profile/company/product/priceplan.entity.js.map +1 -0
- package/lib/profile/company/product/product.entity.d.ts +171 -0
- package/lib/profile/company/product/product.entity.js +383 -0
- package/lib/profile/company/product/product.entity.js.map +1 -0
- package/lib/profile/company/product/vehicle.entity.d.ts +46 -0
- package/lib/profile/company/product/vehicle.entity.js +144 -0
- package/lib/profile/company/product/vehicle.entity.js.map +1 -0
- package/lib/profile/instructor/instructor.entity.d.ts +80 -0
- package/lib/profile/instructor/instructor.entity.js +186 -0
- package/lib/profile/instructor/instructor.entity.js.map +1 -0
- package/lib/profile/student/program/licence/licence.entity.d.ts +66 -0
- package/lib/profile/student/program/licence/licence.entity.js +187 -0
- package/lib/profile/student/program/licence/licence.entity.js.map +1 -0
- package/lib/profile/student/program/medical/certificate.entity.d.ts +84 -0
- package/lib/profile/student/program/medical/certificate.entity.js +244 -0
- package/lib/profile/student/program/medical/certificate.entity.js.map +1 -0
- package/lib/profile/student/program/medical/examination.model.d.ts +65 -0
- package/lib/profile/student/program/medical/examination.model.js +209 -0
- package/lib/profile/student/program/medical/examination.model.js.map +1 -0
- package/lib/profile/student/program/program.entity.d.ts +78 -0
- package/lib/profile/student/program/program.entity.js +225 -0
- package/lib/profile/student/program/program.entity.js.map +1 -0
- package/lib/profile/student/program/training/appointment.entity.d.ts +151 -0
- package/lib/profile/student/program/training/appointment.entity.js +441 -0
- package/lib/profile/student/program/training/appointment.entity.js.map +1 -0
- package/lib/profile/student/program/training/exam.entity.d.ts +41 -0
- package/lib/profile/student/program/training/exam.entity.js +141 -0
- package/lib/profile/student/program/training/exam.entity.js.map +1 -0
- package/lib/profile/student/program/training/lesson.entity.d.ts +84 -0
- package/lib/profile/student/program/training/lesson.entity.js +221 -0
- package/lib/profile/student/program/training/lesson.entity.js.map +1 -0
- package/lib/profile/student/program/training/request.entity.d.ts +56 -0
- package/lib/profile/student/program/training/request.entity.js +159 -0
- package/lib/profile/student/program/training/request.entity.js.map +1 -0
- package/lib/profile/student/program/training/topic.entity.d.ts +109 -0
- package/lib/profile/student/program/training/topic.entity.js +255 -0
- package/lib/profile/student/program/training/topic.entity.js.map +1 -0
- package/lib/profile/student/program/training/training.entity.d.ts +167 -0
- package/lib/profile/student/program/training/training.entity.js +501 -0
- package/lib/profile/student/program/training/training.entity.js.map +1 -0
- package/lib/profile/student/program/training/transaction.entity.d.ts +111 -0
- package/lib/profile/student/program/training/transaction.entity.js +266 -0
- package/lib/profile/student/program/training/transaction.entity.js.map +1 -0
- package/lib/profile/student/student.entity.d.ts +89 -0
- package/lib/profile/student/student.entity.js +183 -0
- package/lib/profile/student/student.entity.js.map +1 -0
- package/lib/system/campaign/campaign.entity.d.ts +68 -0
- package/lib/system/campaign/campaign.entity.js +150 -0
- package/lib/system/campaign/campaign.entity.js.map +1 -0
- package/lib/system/campaign/gifcode.entity.d.ts +14 -0
- package/lib/system/campaign/gifcode.entity.js +77 -0
- package/lib/system/campaign/gifcode.entity.js.map +1 -0
- package/lib/system/campaigne/campaign.entity.d.ts +69 -0
- package/lib/system/campaigne/campaign.entity.js +179 -0
- package/lib/system/campaigne/campaign.entity.js.map +1 -0
- package/lib/system/campaigne/gifcode.entity.d.ts +54 -0
- package/lib/system/campaigne/gifcode.entity.js +126 -0
- package/lib/system/campaigne/gifcode.entity.js.map +1 -0
- package/lib/system/country/country.entity.d.ts +121 -0
- package/lib/system/country/country.entity.js +284 -0
- package/lib/system/country/country.entity.js.map +1 -0
- package/lib/system/country/country.metric.d.ts +12 -0
- package/lib/system/country/country.metric.js +68 -0
- package/lib/system/country/country.metric.js.map +1 -0
- package/lib/system/currency/currency.entity.d.ts +46 -0
- package/lib/system/currency/currency.entity.js +112 -0
- package/lib/system/currency/currency.entity.js.map +1 -0
- package/lib/system/driving/category.entity.d.ts +146 -0
- package/lib/system/driving/category.entity.js +321 -0
- package/lib/system/driving/category.entity.js.map +1 -0
- package/lib/system/driving/vehicle.entity.d.ts +54 -0
- package/lib/system/driving/vehicle.entity.js +130 -0
- package/lib/system/driving/vehicle.entity.js.map +1 -0
- package/lib/system/event/business.entity.d.ts +75 -0
- package/lib/system/event/business.entity.js +170 -0
- package/lib/system/event/business.entity.js.map +1 -0
- package/lib/system/event/log.entity.d.ts +103 -0
- package/lib/system/event/log.entity.js +202 -0
- package/lib/system/event/log.entity.js.map +1 -0
- package/lib/system/policy/policy.entity.d.ts +90 -0
- package/lib/system/policy/policy.entity.js +226 -0
- package/lib/system/policy/policy.entity.js.map +1 -0
- package/lib/system/staff/staff.entity.d.ts +72 -0
- package/lib/system/staff/staff.entity.js +186 -0
- package/lib/system/staff/staff.entity.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/user/alert.entity.d.ts +95 -0
- package/lib/user/alert.entity.js +223 -0
- package/lib/user/alert.entity.js.map +1 -0
- package/lib/user/blocked.entity.d.ts +42 -0
- package/lib/user/blocked.entity.js +83 -0
- package/lib/user/blocked.entity.js.map +1 -0
- package/lib/user/device.entity.d.ts +72 -0
- package/lib/user/device.entity.js +182 -0
- package/lib/user/device.entity.js.map +1 -0
- package/lib/user/notification.entity.d.ts +87 -0
- package/lib/user/notification.entity.js +219 -0
- package/lib/user/notification.entity.js.map +1 -0
- package/lib/user/ticket.entity.d.ts +85 -0
- package/lib/user/ticket.entity.js +231 -0
- package/lib/user/ticket.entity.js.map +1 -0
- package/lib/user/user.entity.d.ts +235 -0
- package/lib/user/user.entity.js +573 -0
- package/lib/user/user.entity.js.map +1 -0
- package/lib/user/verification.entity.d.ts +75 -0
- package/lib/user/verification.entity.js +142 -0
- package/lib/user/verification.entity.js.map +1 -0
- package/lib/utils/activity.helper.d.ts +26 -0
- package/lib/utils/activity.helper.js +39 -0
- package/lib/utils/activity.helper.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +21 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/json-metrics.transform.d.ts +35 -0
- package/lib/utils/json-metrics.transform.js +83 -0
- package/lib/utils/json-metrics.transform.js.map +1 -0
- package/lib/utils/numeric.transform.d.ts +38 -0
- package/lib/utils/numeric.transform.js +74 -0
- package/lib/utils/numeric.transform.js.map +1 -0
- package/lib/utils/trackable.entity.d.ts +82 -0
- package/lib/utils/trackable.entity.js +100 -0
- package/lib/utils/trackable.entity.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Activity, Customer, MedicalCertificate, Note, ProductType } from '@driveup/common';
|
|
2
|
+
import { DrivingCategoryEntity } from '../../../../system/driving/category.entity';
|
|
3
|
+
import { StudentEntity } from '../../student.entity';
|
|
4
|
+
import { StudentProgramEntity } from '../program.entity';
|
|
5
|
+
import { StudentMedicalExaminationEntity } from './examination.model';
|
|
6
|
+
import { TrackableEntity } from '../../../../utils';
|
|
7
|
+
export declare class StudentMedicalCertificateEntity extends TrackableEntity<MedicalCertificate> {
|
|
8
|
+
/**
|
|
9
|
+
* Reference to the student who owns this medical certificate
|
|
10
|
+
*/
|
|
11
|
+
studentId: number;
|
|
12
|
+
/**
|
|
13
|
+
* Student examination appointment
|
|
14
|
+
* This relations can be also null
|
|
15
|
+
* The student can upload a medical certificate without linking it to a examination
|
|
16
|
+
*/
|
|
17
|
+
examinationId: number;
|
|
18
|
+
/**
|
|
19
|
+
* Driveup driving category
|
|
20
|
+
* Can be null if the certificate isn't category specific
|
|
21
|
+
*/
|
|
22
|
+
categoryId: number;
|
|
23
|
+
/**
|
|
24
|
+
* Store product type allways to identify medical product
|
|
25
|
+
* in case if student manually uploads certificate
|
|
26
|
+
*/
|
|
27
|
+
productType: ProductType;
|
|
28
|
+
/**
|
|
29
|
+
* Certificat name
|
|
30
|
+
* Will be named from product level to keep all product certificates consistent
|
|
31
|
+
*/
|
|
32
|
+
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* License or certificate number
|
|
35
|
+
*/
|
|
36
|
+
licenseNumber: string;
|
|
37
|
+
/**
|
|
38
|
+
* Date when the certificate was issued
|
|
39
|
+
*/
|
|
40
|
+
issuedOn: Date;
|
|
41
|
+
/**
|
|
42
|
+
* Date from which the certificate becomes valid
|
|
43
|
+
*/
|
|
44
|
+
validFrom: Date;
|
|
45
|
+
/**
|
|
46
|
+
* Date when the certificate expires
|
|
47
|
+
*/
|
|
48
|
+
validUntil: Date;
|
|
49
|
+
/**
|
|
50
|
+
* URL to the uploaded certificate document
|
|
51
|
+
*/
|
|
52
|
+
documentUrl: string;
|
|
53
|
+
/**
|
|
54
|
+
* if the certificate is not linked to an examination
|
|
55
|
+
* the student can provide the issuer information directly
|
|
56
|
+
*/
|
|
57
|
+
issuer: Customer;
|
|
58
|
+
/**
|
|
59
|
+
* Additional notes or comments about the certificate
|
|
60
|
+
*/
|
|
61
|
+
note: Note;
|
|
62
|
+
/**
|
|
63
|
+
* Student who owns the medical certificate
|
|
64
|
+
*/
|
|
65
|
+
student: Promise<StudentEntity>;
|
|
66
|
+
/**
|
|
67
|
+
* Examination linked to this medical certificate
|
|
68
|
+
*/
|
|
69
|
+
examination: Promise<StudentMedicalExaminationEntity>;
|
|
70
|
+
/**
|
|
71
|
+
* Driving category linked to this medical certificate.
|
|
72
|
+
* Optionally, if the certificate is category specific.
|
|
73
|
+
*/
|
|
74
|
+
category: Promise<DrivingCategoryEntity>;
|
|
75
|
+
/**
|
|
76
|
+
* Student programs linked to this medical certificate
|
|
77
|
+
* (pivot table relation)
|
|
78
|
+
*/
|
|
79
|
+
programs: Promise<StudentProgramEntity[]>;
|
|
80
|
+
constructor(props?: Partial<StudentMedicalCertificateEntity>);
|
|
81
|
+
toModel(): Promise<MedicalCertificate>;
|
|
82
|
+
toSummary(): MedicalCertificate;
|
|
83
|
+
getActivities(): Promise<Activity[]>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StudentMedicalCertificateEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const common_1 = require("@driveup/common");
|
|
15
|
+
const category_entity_1 = require("../../../../system/driving/category.entity");
|
|
16
|
+
const student_entity_1 = require("../../student.entity");
|
|
17
|
+
const program_entity_1 = require("../program.entity");
|
|
18
|
+
const examination_model_1 = require("./examination.model");
|
|
19
|
+
const utils_1 = require("../../../../utils");
|
|
20
|
+
let StudentMedicalCertificateEntity = class StudentMedicalCertificateEntity extends utils_1.TrackableEntity {
|
|
21
|
+
/**
|
|
22
|
+
* Reference to the student who owns this medical certificate
|
|
23
|
+
*/
|
|
24
|
+
studentId;
|
|
25
|
+
/**
|
|
26
|
+
* Student examination appointment
|
|
27
|
+
* This relations can be also null
|
|
28
|
+
* The student can upload a medical certificate without linking it to a examination
|
|
29
|
+
*/
|
|
30
|
+
examinationId;
|
|
31
|
+
/**
|
|
32
|
+
* Driveup driving category
|
|
33
|
+
* Can be null if the certificate isn't category specific
|
|
34
|
+
*/
|
|
35
|
+
categoryId;
|
|
36
|
+
/**
|
|
37
|
+
* Store product type allways to identify medical product
|
|
38
|
+
* in case if student manually uploads certificate
|
|
39
|
+
*/
|
|
40
|
+
productType;
|
|
41
|
+
/**
|
|
42
|
+
* Certificat name
|
|
43
|
+
* Will be named from product level to keep all product certificates consistent
|
|
44
|
+
*/
|
|
45
|
+
name;
|
|
46
|
+
/**
|
|
47
|
+
* License or certificate number
|
|
48
|
+
*/
|
|
49
|
+
licenseNumber;
|
|
50
|
+
/**
|
|
51
|
+
* Date when the certificate was issued
|
|
52
|
+
*/
|
|
53
|
+
issuedOn;
|
|
54
|
+
/**
|
|
55
|
+
* Date from which the certificate becomes valid
|
|
56
|
+
*/
|
|
57
|
+
validFrom;
|
|
58
|
+
/**
|
|
59
|
+
* Date when the certificate expires
|
|
60
|
+
*/
|
|
61
|
+
validUntil;
|
|
62
|
+
/**
|
|
63
|
+
* URL to the uploaded certificate document
|
|
64
|
+
*/
|
|
65
|
+
documentUrl;
|
|
66
|
+
/**
|
|
67
|
+
* if the certificate is not linked to an examination
|
|
68
|
+
* the student can provide the issuer information directly
|
|
69
|
+
*/
|
|
70
|
+
issuer;
|
|
71
|
+
/**
|
|
72
|
+
* Additional notes or comments about the certificate
|
|
73
|
+
*/
|
|
74
|
+
note;
|
|
75
|
+
/**
|
|
76
|
+
* Student who owns the medical certificate
|
|
77
|
+
*/
|
|
78
|
+
student;
|
|
79
|
+
/**
|
|
80
|
+
* Examination linked to this medical certificate
|
|
81
|
+
*/
|
|
82
|
+
examination;
|
|
83
|
+
/**
|
|
84
|
+
* Driving category linked to this medical certificate.
|
|
85
|
+
* Optionally, if the certificate is category specific.
|
|
86
|
+
*/
|
|
87
|
+
category;
|
|
88
|
+
/**
|
|
89
|
+
* Student programs linked to this medical certificate
|
|
90
|
+
* (pivot table relation)
|
|
91
|
+
*/
|
|
92
|
+
programs;
|
|
93
|
+
constructor(props) {
|
|
94
|
+
super();
|
|
95
|
+
Object.assign(this, props);
|
|
96
|
+
}
|
|
97
|
+
async toModel() {
|
|
98
|
+
const examination = this.examinationId ? await (await this.examination).toModel() : null;
|
|
99
|
+
const category = this.categoryId ? (await this.category).toModel() : null;
|
|
100
|
+
return new common_1.MedicalCertificate({
|
|
101
|
+
id: this.id,
|
|
102
|
+
category: category,
|
|
103
|
+
examination: examination,
|
|
104
|
+
issuer: this.issuer ? common_1.Customer.toInstance(this.issuer) : null,
|
|
105
|
+
issuedOn: this.issuedOn,
|
|
106
|
+
validFrom: this.validFrom,
|
|
107
|
+
validUntil: this.validUntil,
|
|
108
|
+
documentUrl: this.documentUrl,
|
|
109
|
+
note: this.note ? common_1.Note.toInstance(this.note) : null,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
toSummary() {
|
|
113
|
+
return new common_1.MedicalCertificate({
|
|
114
|
+
id: this.id,
|
|
115
|
+
issuer: this.issuer ? common_1.Customer.toInstance(this.issuer) : null,
|
|
116
|
+
issuedOn: this.issuedOn,
|
|
117
|
+
validFrom: this.validFrom,
|
|
118
|
+
validUntil: this.validUntil,
|
|
119
|
+
documentUrl: this.documentUrl
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async getActivities() {
|
|
123
|
+
const activities = [];
|
|
124
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
|
|
125
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
126
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
|
|
127
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
128
|
+
return activities.filter(a => a);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
exports.StudentMedicalCertificateEntity = StudentMedicalCertificateEntity;
|
|
132
|
+
__decorate([
|
|
133
|
+
(0, typeorm_1.Column)(),
|
|
134
|
+
__metadata("design:type", Number)
|
|
135
|
+
], StudentMedicalCertificateEntity.prototype, "studentId", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, typeorm_1.Column)({
|
|
138
|
+
nullable: true,
|
|
139
|
+
default: null
|
|
140
|
+
}),
|
|
141
|
+
__metadata("design:type", Number)
|
|
142
|
+
], StudentMedicalCertificateEntity.prototype, "examinationId", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, typeorm_1.Column)({
|
|
145
|
+
nullable: true,
|
|
146
|
+
default: null
|
|
147
|
+
}),
|
|
148
|
+
__metadata("design:type", Number)
|
|
149
|
+
], StudentMedicalCertificateEntity.prototype, "categoryId", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, typeorm_1.Column)({
|
|
152
|
+
type: 'enum',
|
|
153
|
+
enum: [
|
|
154
|
+
common_1.ProductType.MedicalEyeTest,
|
|
155
|
+
common_1.ProductType.MedicalHearingTest,
|
|
156
|
+
common_1.ProductType.MedicalGeneral,
|
|
157
|
+
common_1.ProductType.MedicalPsychological,
|
|
158
|
+
common_1.ProductType.MedicalOther,
|
|
159
|
+
],
|
|
160
|
+
default: common_1.ProductType.MedicalEyeTest,
|
|
161
|
+
nullable: false
|
|
162
|
+
}),
|
|
163
|
+
__metadata("design:type", String)
|
|
164
|
+
], StudentMedicalCertificateEntity.prototype, "productType", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, typeorm_1.Column)({
|
|
167
|
+
nullable: true,
|
|
168
|
+
default: null
|
|
169
|
+
}),
|
|
170
|
+
__metadata("design:type", String)
|
|
171
|
+
], StudentMedicalCertificateEntity.prototype, "name", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, typeorm_1.Column)({
|
|
174
|
+
nullable: true,
|
|
175
|
+
default: null
|
|
176
|
+
}),
|
|
177
|
+
__metadata("design:type", String)
|
|
178
|
+
], StudentMedicalCertificateEntity.prototype, "licenseNumber", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
(0, typeorm_1.Column)({
|
|
181
|
+
nullable: true,
|
|
182
|
+
default: null
|
|
183
|
+
}),
|
|
184
|
+
__metadata("design:type", Date)
|
|
185
|
+
], StudentMedicalCertificateEntity.prototype, "issuedOn", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
(0, typeorm_1.Column)({
|
|
188
|
+
nullable: true,
|
|
189
|
+
default: null
|
|
190
|
+
}),
|
|
191
|
+
__metadata("design:type", Date)
|
|
192
|
+
], StudentMedicalCertificateEntity.prototype, "validFrom", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, typeorm_1.Column)({
|
|
195
|
+
nullable: true,
|
|
196
|
+
default: null
|
|
197
|
+
}),
|
|
198
|
+
__metadata("design:type", Date)
|
|
199
|
+
], StudentMedicalCertificateEntity.prototype, "validUntil", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, typeorm_1.Column)({
|
|
202
|
+
nullable: true,
|
|
203
|
+
default: null
|
|
204
|
+
}),
|
|
205
|
+
__metadata("design:type", String)
|
|
206
|
+
], StudentMedicalCertificateEntity.prototype, "documentUrl", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
(0, typeorm_1.Column)({
|
|
209
|
+
type: 'simple-json',
|
|
210
|
+
nullable: true,
|
|
211
|
+
default: null
|
|
212
|
+
}),
|
|
213
|
+
__metadata("design:type", common_1.Customer)
|
|
214
|
+
], StudentMedicalCertificateEntity.prototype, "issuer", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
(0, typeorm_1.Column)({
|
|
217
|
+
type: 'simple-json',
|
|
218
|
+
nullable: true,
|
|
219
|
+
default: null
|
|
220
|
+
}),
|
|
221
|
+
__metadata("design:type", common_1.Note)
|
|
222
|
+
], StudentMedicalCertificateEntity.prototype, "note", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
(0, typeorm_1.ManyToOne)(() => student_entity_1.StudentEntity, student => student.medicalCertificates),
|
|
225
|
+
__metadata("design:type", Promise)
|
|
226
|
+
], StudentMedicalCertificateEntity.prototype, "student", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
(0, typeorm_1.OneToOne)(() => examination_model_1.StudentMedicalExaminationEntity, examination => examination.certificate),
|
|
229
|
+
(0, typeorm_1.JoinColumn)(),
|
|
230
|
+
__metadata("design:type", Promise)
|
|
231
|
+
], StudentMedicalCertificateEntity.prototype, "examination", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
(0, typeorm_1.ManyToOne)(() => category_entity_1.DrivingCategoryEntity, category => category.studentCertificates),
|
|
234
|
+
__metadata("design:type", Promise)
|
|
235
|
+
], StudentMedicalCertificateEntity.prototype, "category", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
(0, typeorm_1.ManyToMany)(() => program_entity_1.StudentProgramEntity, program => program.certificates),
|
|
238
|
+
__metadata("design:type", Promise)
|
|
239
|
+
], StudentMedicalCertificateEntity.prototype, "programs", void 0);
|
|
240
|
+
exports.StudentMedicalCertificateEntity = StudentMedicalCertificateEntity = __decorate([
|
|
241
|
+
(0, typeorm_1.Entity)('studentMedicalCertificates'),
|
|
242
|
+
__metadata("design:paramtypes", [Object])
|
|
243
|
+
], StudentMedicalCertificateEntity);
|
|
244
|
+
//# sourceMappingURL=certificate.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"certificate.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/medical/certificate.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAsF;AACtF,4CAA0G;AAC1G,gFAAmF;AACnF,yDAAqD;AACrD,sDAAyD;AACzD,2DAAsE;AACtE,6CAAgE;AAIzD,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,uBAAmC;IAEvF;;OAEG;IAEH,SAAS,CAAS;IAElB;;;;OAIG;IAKH,aAAa,CAAS;IAEtB;;;OAGG;IAKH,UAAU,CAAS;IAEnB;;;OAGG;IAaH,WAAW,CAAc;IAEzB;;;OAGG;IAKH,IAAI,CAAS;IAEb;;OAEG;IAKH,aAAa,CAAS;IAEtB;;OAEG;IAKH,QAAQ,CAAO;IAEf;;OAEG;IAKH,SAAS,CAAO;IAEhB;;OAEG;IAKH,UAAU,CAAO;IAEjB;;OAEG;IAKH,WAAW,CAAS;IAEpB;;;OAGG;IAMH,MAAM,CAAW;IAEjB;;OAEG;IAMH,IAAI,CAAO;IAEX;;OAEG;IAEH,OAAO,CAAyB;IAEhC;;OAEG;IAGH,WAAW,CAA2C;IAEtD;;;OAGG;IAEH,QAAQ,CAAiC;IAEzC;;;OAGG;IAEH,QAAQ,CAAkC;IAE1C,YAAY,KAAgD;QAC3D,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACzF,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,C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
import { Address, Note, StatusType } from '@driveup/common';
|
|
3
|
+
import { StudentEntity } from '../../student.entity';
|
|
4
|
+
import { StudentMedicalCertificateEntity } from './certificate.entity';
|
|
5
|
+
import { CompanyMedicalExaminationEntity } from '../../../company/medical/examination.entity';
|
|
6
|
+
import { TrackableEntity } from '../../../../utils';
|
|
7
|
+
export declare class StudentMedicalExaminationEntity extends TrackableEntity<Appointment> {
|
|
8
|
+
/**
|
|
9
|
+
* Reference to the student taking this medical examination
|
|
10
|
+
*/
|
|
11
|
+
studentId: number;
|
|
12
|
+
/**
|
|
13
|
+
* Company medical examination
|
|
14
|
+
*/
|
|
15
|
+
examinationId: number;
|
|
16
|
+
/**
|
|
17
|
+
* Current status of the medical examination (Pending, Passed, or Failed)
|
|
18
|
+
* @default StatusType.Pending
|
|
19
|
+
*/
|
|
20
|
+
status: StatusType;
|
|
21
|
+
/**
|
|
22
|
+
* Title of the medical examination
|
|
23
|
+
*/
|
|
24
|
+
title: string;
|
|
25
|
+
/**
|
|
26
|
+
* Detailed description of the medical examination
|
|
27
|
+
*/
|
|
28
|
+
description: string;
|
|
29
|
+
/**
|
|
30
|
+
* Date of the examination
|
|
31
|
+
*/
|
|
32
|
+
startDate: Date;
|
|
33
|
+
/**
|
|
34
|
+
* Duration of the examination in minutes
|
|
35
|
+
*/
|
|
36
|
+
endDate: Date;
|
|
37
|
+
/**
|
|
38
|
+
* Name of the doctor conducting the examination
|
|
39
|
+
*/
|
|
40
|
+
doctorName: string;
|
|
41
|
+
/**
|
|
42
|
+
* Physical location where the examination takes place
|
|
43
|
+
*/
|
|
44
|
+
location: Address;
|
|
45
|
+
/**
|
|
46
|
+
* Additional notes or comments about the examination
|
|
47
|
+
*/
|
|
48
|
+
note: Note;
|
|
49
|
+
/**
|
|
50
|
+
* Student relation
|
|
51
|
+
*/
|
|
52
|
+
student: Promise<StudentEntity>;
|
|
53
|
+
/**
|
|
54
|
+
* Company medical examination relation
|
|
55
|
+
*/
|
|
56
|
+
examination: Promise<CompanyMedicalExaminationEntity>;
|
|
57
|
+
/**
|
|
58
|
+
* Certificate issued for this examination
|
|
59
|
+
*/
|
|
60
|
+
certificate: Promise<StudentMedicalCertificateEntity>;
|
|
61
|
+
constructor(props?: Partial<StudentMedicalExaminationEntity>);
|
|
62
|
+
toModel(): Promise<Appointment>;
|
|
63
|
+
toSummary(): Promise<Appointment>;
|
|
64
|
+
getActivities(): Promise<Activity[]>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var StudentMedicalExaminationEntity_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.StudentMedicalExaminationEntity = void 0;
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const common_1 = require("@driveup/common");
|
|
16
|
+
const common_2 = require("@driveup/common");
|
|
17
|
+
const student_entity_1 = require("../../student.entity");
|
|
18
|
+
const certificate_entity_1 = require("./certificate.entity");
|
|
19
|
+
const examination_entity_1 = require("../../../company/medical/examination.entity");
|
|
20
|
+
const product_entity_1 = require("../../../company/product/product.entity");
|
|
21
|
+
const product_entity_2 = require("../../../company/medical/product.entity");
|
|
22
|
+
const product_entity_3 = require("../../../../catalog/product/product.entity");
|
|
23
|
+
const utils_1 = require("../../../../utils");
|
|
24
|
+
let StudentMedicalExaminationEntity = StudentMedicalExaminationEntity_1 = class StudentMedicalExaminationEntity extends utils_1.TrackableEntity {
|
|
25
|
+
/**
|
|
26
|
+
* Reference to the student taking this medical examination
|
|
27
|
+
*/
|
|
28
|
+
studentId;
|
|
29
|
+
/**
|
|
30
|
+
* Company medical examination
|
|
31
|
+
*/
|
|
32
|
+
examinationId;
|
|
33
|
+
/**
|
|
34
|
+
* Current status of the medical examination (Pending, Passed, or Failed)
|
|
35
|
+
* @default StatusType.Pending
|
|
36
|
+
*/
|
|
37
|
+
status;
|
|
38
|
+
/**
|
|
39
|
+
* Title of the medical examination
|
|
40
|
+
*/
|
|
41
|
+
title;
|
|
42
|
+
/**
|
|
43
|
+
* Detailed description of the medical examination
|
|
44
|
+
*/
|
|
45
|
+
description;
|
|
46
|
+
/**
|
|
47
|
+
* Date of the examination
|
|
48
|
+
*/
|
|
49
|
+
startDate;
|
|
50
|
+
/**
|
|
51
|
+
* Duration of the examination in minutes
|
|
52
|
+
*/
|
|
53
|
+
endDate;
|
|
54
|
+
/**
|
|
55
|
+
* Name of the doctor conducting the examination
|
|
56
|
+
*/
|
|
57
|
+
doctorName;
|
|
58
|
+
/**
|
|
59
|
+
* Physical location where the examination takes place
|
|
60
|
+
*/
|
|
61
|
+
location;
|
|
62
|
+
/**
|
|
63
|
+
* Additional notes or comments about the examination
|
|
64
|
+
*/
|
|
65
|
+
note;
|
|
66
|
+
/**
|
|
67
|
+
* Student relation
|
|
68
|
+
*/
|
|
69
|
+
student;
|
|
70
|
+
/**
|
|
71
|
+
* Company medical examination relation
|
|
72
|
+
*/
|
|
73
|
+
examination;
|
|
74
|
+
/**
|
|
75
|
+
* Certificate issued for this examination
|
|
76
|
+
*/
|
|
77
|
+
certificate;
|
|
78
|
+
constructor(props) {
|
|
79
|
+
super();
|
|
80
|
+
Object.assign(this, props);
|
|
81
|
+
}
|
|
82
|
+
async toModel() {
|
|
83
|
+
// get company medical product
|
|
84
|
+
const companyMedicalProduct = await product_entity_2.CompanyMedicalProductEntity.createQueryBuilder('cmp')
|
|
85
|
+
.innerJoin('cmp.examinations', 'cme')
|
|
86
|
+
.innerJoin(StudentMedicalExaminationEntity_1, 'sme', 'sme.examinationId = cme.id')
|
|
87
|
+
.where('sme.id = :id', { id: this.id })
|
|
88
|
+
.getOne();
|
|
89
|
+
// get driveup product
|
|
90
|
+
const product = await product_entity_3.ProductEntity.createQueryBuilder('p')
|
|
91
|
+
.innerJoin(product_entity_1.CompanyProductEntity, 'cp', 'cp.productId = p.id')
|
|
92
|
+
.innerJoin(product_entity_2.CompanyMedicalProductEntity, 'cmp', 'cmp.productId = cp.id')
|
|
93
|
+
.where('cmp.id = :id', { id: companyMedicalProduct.id })
|
|
94
|
+
.getOne();
|
|
95
|
+
return new common_1.Appointment({
|
|
96
|
+
id: this.id,
|
|
97
|
+
type: common_1.AppointmentType.Medical,
|
|
98
|
+
product: product.type,
|
|
99
|
+
status: this.status,
|
|
100
|
+
title: this.title,
|
|
101
|
+
subtitle: this.description,
|
|
102
|
+
startDate: this.startDate,
|
|
103
|
+
endDate: this.endDate,
|
|
104
|
+
color: product.color,
|
|
105
|
+
location: this.location ? common_2.Address.toInstance(this.location) : null,
|
|
106
|
+
note: this.note ? common_2.Note.toInstance(this.note) : null,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async toSummary() {
|
|
110
|
+
return new common_1.Appointment({
|
|
111
|
+
id: this.id,
|
|
112
|
+
type: common_1.AppointmentType.Medical,
|
|
113
|
+
status: this.status,
|
|
114
|
+
title: this.title,
|
|
115
|
+
subtitle: this.description,
|
|
116
|
+
startDate: this.startDate,
|
|
117
|
+
endDate: this.endDate,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async getActivities() {
|
|
121
|
+
const activities = [];
|
|
122
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
|
|
123
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
124
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
|
|
125
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
126
|
+
return activities.filter(a => a);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
exports.StudentMedicalExaminationEntity = StudentMedicalExaminationEntity;
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.Column)(),
|
|
132
|
+
__metadata("design:type", Number)
|
|
133
|
+
], StudentMedicalExaminationEntity.prototype, "studentId", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, typeorm_1.Column)(),
|
|
136
|
+
__metadata("design:type", Number)
|
|
137
|
+
], StudentMedicalExaminationEntity.prototype, "examinationId", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.Column)({
|
|
140
|
+
type: 'enum',
|
|
141
|
+
enum: [
|
|
142
|
+
common_2.StatusType.Pending,
|
|
143
|
+
common_2.StatusType.Passed,
|
|
144
|
+
common_2.StatusType.Failed
|
|
145
|
+
],
|
|
146
|
+
default: common_2.StatusType.Pending,
|
|
147
|
+
nullable: false
|
|
148
|
+
}),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], StudentMedicalExaminationEntity.prototype, "status", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, typeorm_1.Column)(),
|
|
153
|
+
__metadata("design:type", String)
|
|
154
|
+
], StudentMedicalExaminationEntity.prototype, "title", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
(0, typeorm_1.Column)({
|
|
157
|
+
nullable: true,
|
|
158
|
+
default: null
|
|
159
|
+
}),
|
|
160
|
+
__metadata("design:type", String)
|
|
161
|
+
], StudentMedicalExaminationEntity.prototype, "description", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.Column)(),
|
|
164
|
+
__metadata("design:type", Date)
|
|
165
|
+
], StudentMedicalExaminationEntity.prototype, "startDate", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, typeorm_1.Column)(),
|
|
168
|
+
__metadata("design:type", Date)
|
|
169
|
+
], StudentMedicalExaminationEntity.prototype, "endDate", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, typeorm_1.Column)({
|
|
172
|
+
nullable: true,
|
|
173
|
+
default: null
|
|
174
|
+
}),
|
|
175
|
+
__metadata("design:type", String)
|
|
176
|
+
], StudentMedicalExaminationEntity.prototype, "doctorName", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
(0, typeorm_1.Column)({
|
|
179
|
+
type: 'simple-json',
|
|
180
|
+
nullable: true,
|
|
181
|
+
default: null
|
|
182
|
+
}),
|
|
183
|
+
__metadata("design:type", common_2.Address)
|
|
184
|
+
], StudentMedicalExaminationEntity.prototype, "location", void 0);
|
|
185
|
+
__decorate([
|
|
186
|
+
(0, typeorm_1.Column)({
|
|
187
|
+
type: 'simple-json',
|
|
188
|
+
nullable: true,
|
|
189
|
+
default: null
|
|
190
|
+
}),
|
|
191
|
+
__metadata("design:type", common_2.Note)
|
|
192
|
+
], StudentMedicalExaminationEntity.prototype, "note", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, typeorm_1.ManyToOne)(() => student_entity_1.StudentEntity, student => student.medicalExaminations),
|
|
195
|
+
__metadata("design:type", Promise)
|
|
196
|
+
], StudentMedicalExaminationEntity.prototype, "student", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
(0, typeorm_1.ManyToOne)(() => examination_entity_1.CompanyMedicalExaminationEntity, examination => examination.students),
|
|
199
|
+
__metadata("design:type", Promise)
|
|
200
|
+
], StudentMedicalExaminationEntity.prototype, "examination", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
(0, typeorm_1.OneToOne)(() => certificate_entity_1.StudentMedicalCertificateEntity, certificate => certificate.examination),
|
|
203
|
+
__metadata("design:type", Promise)
|
|
204
|
+
], StudentMedicalExaminationEntity.prototype, "certificate", void 0);
|
|
205
|
+
exports.StudentMedicalExaminationEntity = StudentMedicalExaminationEntity = StudentMedicalExaminationEntity_1 = __decorate([
|
|
206
|
+
(0, typeorm_1.Entity)('studentMedicalExaminations'),
|
|
207
|
+
__metadata("design:paramtypes", [Object])
|
|
208
|
+
], StudentMedicalExaminationEntity);
|
|
209
|
+
//# sourceMappingURL=examination.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examination.model.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/medical/examination.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA8D;AAC9D,4CAAuF;AACvF,4CAA4D;AAC5D,yDAAqD;AACrD,6DAAuE;AACvE,oFAA8F;AAC9F,4EAA+E;AAC/E,4EAAsF;AACtF,+EAA2E;AAC3E,6CAAgE;AAGzD,IAAM,+BAA+B,uCAArC,MAAM,+BAAgC,SAAQ,uBAA4B;IAEhF;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,aAAa,CAAS;IAEtB;;;OAGG;IAWH,MAAM,CAAa;IAEnB;;OAEG;IAEH,KAAK,CAAS;IAEd;;OAEG;IAKH,WAAW,CAAS;IAEpB;;OAEG;IAEH,SAAS,CAAO;IAEhB;;OAEG;IAEH,OAAO,CAAO;IAEd;;OAEG;IAKH,UAAU,CAAS;IAEnB;;OAEG;IAMH,QAAQ,CAAU;IAElB;;OAEG;IAMH,IAAI,CAAO;IAEX;;OAEG;IAEH,OAAO,CAAyB;IAEhC;;OAEG;IAEH,WAAW,CAA2C;IAEtD;;OAEG;IAEH,WAAW,CAA2C;IAEtD,YAAY,KAAgD;QAC3D,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO;QAEZ,8B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