@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,365 @@
|
|
|
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.CompanyCourseEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const common_1 = require("@driveup/common");
|
|
15
|
+
const common_2 = require("@driveup/common");
|
|
16
|
+
const product_entity_1 = require("../product/product.entity");
|
|
17
|
+
const category_entity_1 = require("../../../system/driving/category.entity");
|
|
18
|
+
const lesson_entity_1 = require("./lesson.entity");
|
|
19
|
+
const instructor_entity_1 = require("../instructor/instructor.entity");
|
|
20
|
+
const training_entity_1 = require("../../student/program/training/training.entity");
|
|
21
|
+
const request_entity_1 = require("../../student/program/training/request.entity");
|
|
22
|
+
const item_entity_1 = require("../finances/billing/item.entity");
|
|
23
|
+
const utils_1 = require("../../../utils");
|
|
24
|
+
/**
|
|
25
|
+
* Represents a company-managed training course.
|
|
26
|
+
* Courses define training programs that can be offered to students,
|
|
27
|
+
* including theory classes, practical driving lessons, and specialized trainings.
|
|
28
|
+
* Each course has lessons, appointments, pricing, and capacity settings.
|
|
29
|
+
*
|
|
30
|
+
* Supports both fixed schedule courses (with predefined times) and flexible courses
|
|
31
|
+
* (where students book individual appointments).
|
|
32
|
+
*
|
|
33
|
+
* @extends TrackableEntity
|
|
34
|
+
*/
|
|
35
|
+
let CompanyCourseEntity = class CompanyCourseEntity extends utils_1.TrackableEntity {
|
|
36
|
+
/**
|
|
37
|
+
* Company product
|
|
38
|
+
* Medical and Licence product must be excluded.
|
|
39
|
+
* This two products will be offered via dedicated entities.
|
|
40
|
+
*/
|
|
41
|
+
productId;
|
|
42
|
+
/**
|
|
43
|
+
* Driveup driving catregory
|
|
44
|
+
*/
|
|
45
|
+
categoryId;
|
|
46
|
+
/**
|
|
47
|
+
* In-charge innstructor for the course
|
|
48
|
+
*/
|
|
49
|
+
instructorId;
|
|
50
|
+
/**
|
|
51
|
+
* Allow booking only if the course is published
|
|
52
|
+
*/
|
|
53
|
+
status;
|
|
54
|
+
/******************* Content *******************/
|
|
55
|
+
/**
|
|
56
|
+
* Course name
|
|
57
|
+
* (e.g. First Aid, Category B, etc..)
|
|
58
|
+
*/
|
|
59
|
+
title;
|
|
60
|
+
/**
|
|
61
|
+
* Company course description
|
|
62
|
+
*/
|
|
63
|
+
description;
|
|
64
|
+
/**
|
|
65
|
+
* Promotion image URL for search engine visibility
|
|
66
|
+
*/
|
|
67
|
+
imageUrl;
|
|
68
|
+
/******************* Finances ******************/
|
|
69
|
+
/**
|
|
70
|
+
* Course price for trainings
|
|
71
|
+
*/
|
|
72
|
+
price;
|
|
73
|
+
/**
|
|
74
|
+
* Administration fee for the course
|
|
75
|
+
*/
|
|
76
|
+
administrationFee;
|
|
77
|
+
/******************* Settings *******************/
|
|
78
|
+
/**
|
|
79
|
+
* Maximum number of students for each appointment
|
|
80
|
+
* Used only by course tranings
|
|
81
|
+
*/
|
|
82
|
+
maxStudents;
|
|
83
|
+
/**
|
|
84
|
+
* Indicate if the training is fixed schedule or flexible
|
|
85
|
+
*/
|
|
86
|
+
isFixed;
|
|
87
|
+
/**
|
|
88
|
+
* Course location
|
|
89
|
+
*/
|
|
90
|
+
location;
|
|
91
|
+
/**
|
|
92
|
+
* Activate addons for this course
|
|
93
|
+
*/
|
|
94
|
+
addons;
|
|
95
|
+
/******************* Tracks *******************/
|
|
96
|
+
/**
|
|
97
|
+
* ID of the user who published the course
|
|
98
|
+
*/
|
|
99
|
+
publishedBy;
|
|
100
|
+
/**
|
|
101
|
+
* Timestamp when the course was published
|
|
102
|
+
*/
|
|
103
|
+
publishedOn;
|
|
104
|
+
/**
|
|
105
|
+
* ID of the user who ended the course
|
|
106
|
+
*/
|
|
107
|
+
endedBy;
|
|
108
|
+
/**
|
|
109
|
+
* Timestamp when the course was ended
|
|
110
|
+
*/
|
|
111
|
+
endedOn;
|
|
112
|
+
/**
|
|
113
|
+
* Company product
|
|
114
|
+
* E.g. Theory Study, Driving Lessons, First Aid, etc..
|
|
115
|
+
*/
|
|
116
|
+
product;
|
|
117
|
+
/**
|
|
118
|
+
* Course driving category
|
|
119
|
+
* Some courses may require specific driving category.
|
|
120
|
+
* E.g. Theory Study and Driving Category B
|
|
121
|
+
*/
|
|
122
|
+
category;
|
|
123
|
+
/**
|
|
124
|
+
* Course in-charge instructor
|
|
125
|
+
*/
|
|
126
|
+
instructor;
|
|
127
|
+
/**
|
|
128
|
+
* Course lessons
|
|
129
|
+
*/
|
|
130
|
+
lessons;
|
|
131
|
+
/**
|
|
132
|
+
* Student tranings related to this course
|
|
133
|
+
*/
|
|
134
|
+
students;
|
|
135
|
+
/**
|
|
136
|
+
* Student requestes related to this course
|
|
137
|
+
*/
|
|
138
|
+
studentRequestes;
|
|
139
|
+
/**
|
|
140
|
+
* Bill items related to this course
|
|
141
|
+
*/
|
|
142
|
+
billItems;
|
|
143
|
+
/**
|
|
144
|
+
* Creates a new CompanyCourseEntity instance
|
|
145
|
+
* @param props - Partial properties to initialize the entity with
|
|
146
|
+
*/
|
|
147
|
+
constructor(props) {
|
|
148
|
+
super();
|
|
149
|
+
Object.assign(this, props);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Converts the entity to a Course model instance
|
|
153
|
+
* @returns Promise resolving to Course model with category, instructor, and all course details
|
|
154
|
+
*/
|
|
155
|
+
async toModel() {
|
|
156
|
+
const category = this.categoryId ? (await this.category).toModel() : null;
|
|
157
|
+
const instructor = this.instructorId ? await (await this.instructor).toModel() : null;
|
|
158
|
+
return new common_1.Course({
|
|
159
|
+
id: this.id,
|
|
160
|
+
category: category,
|
|
161
|
+
instructor: instructor,
|
|
162
|
+
status: this.status,
|
|
163
|
+
title: this.title,
|
|
164
|
+
description: this.description,
|
|
165
|
+
imageUrl: this.imageUrl,
|
|
166
|
+
price: this.price,
|
|
167
|
+
administrationFee: this.administrationFee,
|
|
168
|
+
maxStudents: this.maxStudents,
|
|
169
|
+
isFixed: this.isFixed,
|
|
170
|
+
location: this.location ? common_1.Address.toInstance(this.location) : null,
|
|
171
|
+
addons: this.addons ? this.addons.map(common_2.AddonUsage.toInstance) : null
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Returns a summary representation of the course with essential information
|
|
176
|
+
* @returns Promise resolving to Course model with basic details (id, instructor, status, title, image, price)
|
|
177
|
+
*/
|
|
178
|
+
async toSummary() {
|
|
179
|
+
const instructor = this.instructorId ? await (await this.instructor).toModel() : null;
|
|
180
|
+
return new common_1.Course({
|
|
181
|
+
id: this.id,
|
|
182
|
+
instructor: instructor,
|
|
183
|
+
status: this.status,
|
|
184
|
+
title: this.title,
|
|
185
|
+
imageUrl: this.imageUrl,
|
|
186
|
+
price: this.price
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Converts the entity to a Course model instance including all associated lessons
|
|
191
|
+
* @returns Promise resolving to Course model with complete lesson information
|
|
192
|
+
*/
|
|
193
|
+
async toModelWithLessons() {
|
|
194
|
+
const course = await this.toModel();
|
|
195
|
+
const lessons = await this.lessons;
|
|
196
|
+
course.lessons = await Promise.all(lessons.map(async (l) => await l.toModel()));
|
|
197
|
+
return course;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Retrieves all tracked activities for this course
|
|
201
|
+
* Includes creation, update, publication, and ending timestamps with associated users
|
|
202
|
+
* @returns Promise resolving to array of Activity objects filtered to exclude null values
|
|
203
|
+
*/
|
|
204
|
+
async getActivities() {
|
|
205
|
+
const activities = [];
|
|
206
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy));
|
|
207
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
|
|
208
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy));
|
|
209
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
|
|
210
|
+
activities.push(await (0, utils_1.toActivity)(this.publishedBy, common_2.ActivityType.publishedBy));
|
|
211
|
+
activities.push(await (0, utils_1.toActivity)(this.publishedOn, common_2.ActivityType.publishedOn));
|
|
212
|
+
activities.push(await (0, utils_1.toActivity)(this.endedBy, common_2.ActivityType.endedBy));
|
|
213
|
+
activities.push(await (0, utils_1.toActivity)(this.endedOn, common_2.ActivityType.endedOn));
|
|
214
|
+
return activities.filter(a => a);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
exports.CompanyCourseEntity = CompanyCourseEntity;
|
|
218
|
+
__decorate([
|
|
219
|
+
(0, typeorm_1.Column)(),
|
|
220
|
+
__metadata("design:type", Number)
|
|
221
|
+
], CompanyCourseEntity.prototype, "productId", void 0);
|
|
222
|
+
__decorate([
|
|
223
|
+
(0, typeorm_1.Column)({
|
|
224
|
+
nullable: true,
|
|
225
|
+
default: null
|
|
226
|
+
}),
|
|
227
|
+
__metadata("design:type", Number)
|
|
228
|
+
], CompanyCourseEntity.prototype, "categoryId", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
(0, typeorm_1.Column)({
|
|
231
|
+
nullable: true,
|
|
232
|
+
default: null
|
|
233
|
+
}),
|
|
234
|
+
__metadata("design:type", Number)
|
|
235
|
+
], CompanyCourseEntity.prototype, "instructorId", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
(0, typeorm_1.Column)({
|
|
238
|
+
type: 'enum',
|
|
239
|
+
enum: [
|
|
240
|
+
common_1.StatusType.Draft,
|
|
241
|
+
common_1.StatusType.Published,
|
|
242
|
+
common_1.StatusType.Ended
|
|
243
|
+
],
|
|
244
|
+
default: common_1.StatusType.Draft,
|
|
245
|
+
nullable: false
|
|
246
|
+
}),
|
|
247
|
+
__metadata("design:type", String)
|
|
248
|
+
], CompanyCourseEntity.prototype, "status", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
(0, typeorm_1.Column)(),
|
|
251
|
+
__metadata("design:type", String)
|
|
252
|
+
], CompanyCourseEntity.prototype, "title", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
(0, typeorm_1.Column)({
|
|
255
|
+
nullable: true,
|
|
256
|
+
default: null
|
|
257
|
+
}),
|
|
258
|
+
__metadata("design:type", String)
|
|
259
|
+
], CompanyCourseEntity.prototype, "description", void 0);
|
|
260
|
+
__decorate([
|
|
261
|
+
(0, typeorm_1.Column)({
|
|
262
|
+
nullable: true,
|
|
263
|
+
default: null
|
|
264
|
+
}),
|
|
265
|
+
__metadata("design:type", String)
|
|
266
|
+
], CompanyCourseEntity.prototype, "imageUrl", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
(0, typeorm_1.Column)({
|
|
269
|
+
type: 'decimal',
|
|
270
|
+
precision: 8,
|
|
271
|
+
scale: 2,
|
|
272
|
+
nullable: true,
|
|
273
|
+
default: null
|
|
274
|
+
}),
|
|
275
|
+
__metadata("design:type", Number)
|
|
276
|
+
], CompanyCourseEntity.prototype, "price", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
(0, typeorm_1.Column)({
|
|
279
|
+
type: 'decimal',
|
|
280
|
+
precision: 8,
|
|
281
|
+
scale: 2,
|
|
282
|
+
nullable: true,
|
|
283
|
+
default: null
|
|
284
|
+
}),
|
|
285
|
+
__metadata("design:type", Number)
|
|
286
|
+
], CompanyCourseEntity.prototype, "administrationFee", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
(0, typeorm_1.Column)({
|
|
289
|
+
nullable: false,
|
|
290
|
+
default: 1
|
|
291
|
+
}),
|
|
292
|
+
__metadata("design:type", Number)
|
|
293
|
+
], CompanyCourseEntity.prototype, "maxStudents", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
(0, typeorm_1.Column)({
|
|
296
|
+
nullable: false,
|
|
297
|
+
default: false
|
|
298
|
+
}),
|
|
299
|
+
__metadata("design:type", Boolean)
|
|
300
|
+
], CompanyCourseEntity.prototype, "isFixed", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
(0, typeorm_1.Column)({
|
|
303
|
+
type: 'simple-json',
|
|
304
|
+
nullable: true,
|
|
305
|
+
default: null
|
|
306
|
+
}),
|
|
307
|
+
__metadata("design:type", common_1.Address)
|
|
308
|
+
], CompanyCourseEntity.prototype, "location", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
(0, typeorm_1.Column)({
|
|
311
|
+
type: 'simple-json',
|
|
312
|
+
nullable: true,
|
|
313
|
+
default: null
|
|
314
|
+
}),
|
|
315
|
+
__metadata("design:type", Array)
|
|
316
|
+
], CompanyCourseEntity.prototype, "addons", void 0);
|
|
317
|
+
__decorate([
|
|
318
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
319
|
+
__metadata("design:type", Number)
|
|
320
|
+
], CompanyCourseEntity.prototype, "publishedBy", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
323
|
+
__metadata("design:type", Date)
|
|
324
|
+
], CompanyCourseEntity.prototype, "publishedOn", void 0);
|
|
325
|
+
__decorate([
|
|
326
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
327
|
+
__metadata("design:type", Number)
|
|
328
|
+
], CompanyCourseEntity.prototype, "endedBy", void 0);
|
|
329
|
+
__decorate([
|
|
330
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
331
|
+
__metadata("design:type", Date)
|
|
332
|
+
], CompanyCourseEntity.prototype, "endedOn", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
(0, typeorm_1.ManyToOne)(() => product_entity_1.CompanyProductEntity, product => product.courses),
|
|
335
|
+
__metadata("design:type", Promise)
|
|
336
|
+
], CompanyCourseEntity.prototype, "product", void 0);
|
|
337
|
+
__decorate([
|
|
338
|
+
(0, typeorm_1.ManyToOne)(() => category_entity_1.DrivingCategoryEntity, category => category.companyCourses),
|
|
339
|
+
__metadata("design:type", Promise)
|
|
340
|
+
], CompanyCourseEntity.prototype, "category", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
(0, typeorm_1.ManyToOne)(() => instructor_entity_1.CompanyInstructorEntity, instructor => instructor.companyCourses),
|
|
343
|
+
__metadata("design:type", Promise)
|
|
344
|
+
], CompanyCourseEntity.prototype, "instructor", void 0);
|
|
345
|
+
__decorate([
|
|
346
|
+
(0, typeorm_1.OneToMany)(() => lesson_entity_1.CompanyCourseLessonEntity, student => student.course),
|
|
347
|
+
__metadata("design:type", Promise)
|
|
348
|
+
], CompanyCourseEntity.prototype, "lessons", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
(0, typeorm_1.OneToMany)(() => training_entity_1.StudentTrainingEntity, student => student.course),
|
|
351
|
+
__metadata("design:type", Promise)
|
|
352
|
+
], CompanyCourseEntity.prototype, "students", void 0);
|
|
353
|
+
__decorate([
|
|
354
|
+
(0, typeorm_1.OneToMany)(() => request_entity_1.StudentTrainingRequestEntity, request => request.course),
|
|
355
|
+
__metadata("design:type", Promise)
|
|
356
|
+
], CompanyCourseEntity.prototype, "studentRequestes", void 0);
|
|
357
|
+
__decorate([
|
|
358
|
+
(0, typeorm_1.OneToMany)(() => item_entity_1.CompanyBillItemEntity, billItem => billItem.course),
|
|
359
|
+
__metadata("design:type", Promise)
|
|
360
|
+
], CompanyCourseEntity.prototype, "billItems", void 0);
|
|
361
|
+
exports.CompanyCourseEntity = CompanyCourseEntity = __decorate([
|
|
362
|
+
(0, typeorm_1.Entity)('companyCourses'),
|
|
363
|
+
__metadata("design:paramtypes", [Object])
|
|
364
|
+
], CompanyCourseEntity);
|
|
365
|
+
//# sourceMappingURL=course.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"course.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/course/course.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4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AC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;oDAC3B;AAQvC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;;qDACnC;AAMzC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAAuB,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;;uDACrC;AAM7C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,yCAAyB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;;oDACxB;AAM9C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;;qDACvB;AAM3C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,6CAA4B,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;;6DACf;AAM1D;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,mCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;;sDACxB;8BA9MhC,mBAAmB;IAD/B,IAAA,gBAAM,EAAC,gBAAgB,CAAC;;GACZ,mBAAmB,CA6R/B"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Address, Activity, Lesson, Picture } from '@driveup/common';
|
|
2
|
+
import { CompanyCourseEntity } from './course.entity';
|
|
3
|
+
import { CompanyCourseTopicEntity } from './topic.entity';
|
|
4
|
+
import { CompanyCourseAppointmentEntity } from './appointment.entity';
|
|
5
|
+
import { CompanyInstructorEntity } from '../instructor/instructor.entity';
|
|
6
|
+
import { StudentTrainingLessonEntity } from '../../student/program/training/lesson.entity';
|
|
7
|
+
import { TrackableEntity } from '../../../utils';
|
|
8
|
+
/**
|
|
9
|
+
* Company Course Lesson Entity
|
|
10
|
+
*
|
|
11
|
+
* Represents course lesson which can be interpreted differently depending on course type:
|
|
12
|
+
*
|
|
13
|
+
* - Theory Courses: Lessons are classic lesson subdivisions within standard lessons
|
|
14
|
+
* - Driving Courses: Lessons represent driving learning phases
|
|
15
|
+
* (e.g., Basic Vehicle Control, Simple Traffic Situations, Complex Traffic Situations, Special Manoeuvres, Driving on Motorway, Safety & Eco Driving)
|
|
16
|
+
* and topics are the specific session topics within those phases
|
|
17
|
+
*/
|
|
18
|
+
export declare class CompanyCourseLessonEntity extends TrackableEntity<Lesson> {
|
|
19
|
+
/**
|
|
20
|
+
* Company course
|
|
21
|
+
*/
|
|
22
|
+
courseId: number;
|
|
23
|
+
/**
|
|
24
|
+
* In-charge instructor for the course lesson
|
|
25
|
+
* Flexible lessons can have their own instructor
|
|
26
|
+
*/
|
|
27
|
+
instructorId: number;
|
|
28
|
+
/****************** Content ******************/
|
|
29
|
+
/**
|
|
30
|
+
* Lesson number or sequence identifier
|
|
31
|
+
*/
|
|
32
|
+
number: number;
|
|
33
|
+
/**
|
|
34
|
+
* Lesson title
|
|
35
|
+
*/
|
|
36
|
+
title: string;
|
|
37
|
+
/**
|
|
38
|
+
* Lesson description
|
|
39
|
+
*/
|
|
40
|
+
description: string;
|
|
41
|
+
/**
|
|
42
|
+
* Lesson header image (upcoming)
|
|
43
|
+
*/
|
|
44
|
+
imageUrl: string;
|
|
45
|
+
/**
|
|
46
|
+
* Lesson gallery images (upcoming)
|
|
47
|
+
*/
|
|
48
|
+
gallery: Picture[];
|
|
49
|
+
/**
|
|
50
|
+
* Lesson sort order within the course
|
|
51
|
+
*/
|
|
52
|
+
sort: number;
|
|
53
|
+
/****************** Calendar ******************/
|
|
54
|
+
/**
|
|
55
|
+
* Lesson start date
|
|
56
|
+
* Only used in fixed trainings
|
|
57
|
+
*/
|
|
58
|
+
startDate: Date;
|
|
59
|
+
/**
|
|
60
|
+
* Lesson end date
|
|
61
|
+
* Only used in fixed trainings
|
|
62
|
+
*/
|
|
63
|
+
endDate: Date;
|
|
64
|
+
/**
|
|
65
|
+
* Lesson duration in minutes
|
|
66
|
+
* Important for flexible courses
|
|
67
|
+
*/
|
|
68
|
+
duration: number;
|
|
69
|
+
/**
|
|
70
|
+
* Location where the lesson takes place
|
|
71
|
+
*/
|
|
72
|
+
location: Address;
|
|
73
|
+
/***************** Tracks *****************/
|
|
74
|
+
/**
|
|
75
|
+
* Timestamp when the lesson was canceled
|
|
76
|
+
*/
|
|
77
|
+
canceledOn: Date;
|
|
78
|
+
/**
|
|
79
|
+
* ID of the user who canceled the lesson
|
|
80
|
+
*/
|
|
81
|
+
canceledBy: number;
|
|
82
|
+
/**
|
|
83
|
+
* Course relation
|
|
84
|
+
*/
|
|
85
|
+
course: Promise<CompanyCourseEntity>;
|
|
86
|
+
/**
|
|
87
|
+
* Lesson in-charge instructor
|
|
88
|
+
*/
|
|
89
|
+
instructor: Promise<CompanyInstructorEntity>;
|
|
90
|
+
/**
|
|
91
|
+
* Company lesson topics
|
|
92
|
+
*/
|
|
93
|
+
topics: Promise<CompanyCourseTopicEntity[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Company lesson appointments
|
|
96
|
+
*/
|
|
97
|
+
appointments: Promise<CompanyCourseAppointmentEntity[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Student training lessons based on this lesson
|
|
100
|
+
*/
|
|
101
|
+
studentLessons: Promise<StudentTrainingLessonEntity[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Creates a new CompanyCourseLessonEntity instance
|
|
104
|
+
* @param props - Partial properties to initialize the entity with
|
|
105
|
+
*/
|
|
106
|
+
constructor(props?: Partial<CompanyCourseLessonEntity>);
|
|
107
|
+
/**
|
|
108
|
+
* Converts the entity to a Lesson model instance
|
|
109
|
+
* @returns Promise resolving to Lesson model with all lesson details including instructor, location, and gallery
|
|
110
|
+
*/
|
|
111
|
+
toModel(): Promise<Lesson>;
|
|
112
|
+
/**
|
|
113
|
+
* Returns a summary representation of the lesson with essential information
|
|
114
|
+
* @returns Lesson model with basic details (id, title, number, dates, duration)
|
|
115
|
+
*/
|
|
116
|
+
toSummary(): Lesson;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves all tracked activities for this lesson
|
|
119
|
+
* Includes creation, update, and cancellation timestamps with associated users
|
|
120
|
+
* @returns Promise resolving to array of Activity objects filtered to exclude null values
|
|
121
|
+
*/
|
|
122
|
+
getActivities(): Promise<Activity[]>;
|
|
123
|
+
}
|