@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,240 @@
|
|
|
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.CompanyCourseAppointmentEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const common_1 = require("@driveup/common");
|
|
15
|
+
const lesson_entity_1 = require("./lesson.entity");
|
|
16
|
+
const appointment_entity_1 = require("../../student/program/training/appointment.entity");
|
|
17
|
+
const instructor_entity_1 = require("../instructor/instructor.entity");
|
|
18
|
+
const utils_1 = require("../../../utils");
|
|
19
|
+
/**
|
|
20
|
+
* Represents a series of training appointment offers managed by the company.
|
|
21
|
+
*
|
|
22
|
+
* This entity defines appointment templates that serve as available time slots
|
|
23
|
+
* for student training sessions. Companies manage these appointments to organize
|
|
24
|
+
* their course training schedules, which students can then book.
|
|
25
|
+
*
|
|
26
|
+
* Supports both single and recurring appointments with flexible scheduling options
|
|
27
|
+
* including:
|
|
28
|
+
* - Weekly repetitions on specific weekdays
|
|
29
|
+
* - Custom date ranges for recurring appointments
|
|
30
|
+
* - Exception handling for skipped dates
|
|
31
|
+
* - Per-date overrides for time, instructor, and duration
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This is a company-managed entity that creates the foundation for student
|
|
35
|
+
* training bookings. Each appointment definition can generate multiple actual
|
|
36
|
+
* student appointments based on its repetition settings.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link CompanyCourseLessonEntity} for the associated course lesson
|
|
39
|
+
* @see {@link StudentTrainingEntity} for student bookings
|
|
40
|
+
*/
|
|
41
|
+
let CompanyCourseAppointmentEntity = class CompanyCourseAppointmentEntity extends utils_1.TrackableEntity {
|
|
42
|
+
/**
|
|
43
|
+
* Company course lesson
|
|
44
|
+
*/
|
|
45
|
+
lessonId;
|
|
46
|
+
/**
|
|
47
|
+
* In-charge instructor for the appointment
|
|
48
|
+
* For driving courses, can be empty
|
|
49
|
+
*/
|
|
50
|
+
instructorId;
|
|
51
|
+
/**
|
|
52
|
+
* Represents the lesson start date for single appointments by student trainings.
|
|
53
|
+
* @remarks By recurring appoitmnets this field represents start of sierie
|
|
54
|
+
*/
|
|
55
|
+
startDate;
|
|
56
|
+
/**
|
|
57
|
+
* Represents the lesson end date for single appointments by student trainings.
|
|
58
|
+
* @remarks By recurring appoitmnets this field represents end of sierie (repeat until this date)
|
|
59
|
+
*/
|
|
60
|
+
endDate;
|
|
61
|
+
/**
|
|
62
|
+
* Duration of the appointment in minutes
|
|
63
|
+
* By fix courses this value is inherited from lesson
|
|
64
|
+
*/
|
|
65
|
+
duration;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates if the appointment is recurring
|
|
68
|
+
*/
|
|
69
|
+
repetition;
|
|
70
|
+
/**
|
|
71
|
+
* Weekdays on which the appointment recurs
|
|
72
|
+
*/
|
|
73
|
+
weekdays;
|
|
74
|
+
/**
|
|
75
|
+
* Skipped dates for this recurring appointment
|
|
76
|
+
*/
|
|
77
|
+
skippedDates;
|
|
78
|
+
/**
|
|
79
|
+
* Changed dates for this recurring appointment
|
|
80
|
+
*/
|
|
81
|
+
updates;
|
|
82
|
+
/**
|
|
83
|
+
* Different instructors for specific dates
|
|
84
|
+
*/
|
|
85
|
+
instructors;
|
|
86
|
+
/**
|
|
87
|
+
* Different durations for specific dates
|
|
88
|
+
*/
|
|
89
|
+
durations;
|
|
90
|
+
/**
|
|
91
|
+
* Course lesson
|
|
92
|
+
*/
|
|
93
|
+
lesson;
|
|
94
|
+
/**
|
|
95
|
+
* Company instructor relation
|
|
96
|
+
*/
|
|
97
|
+
instructor;
|
|
98
|
+
/**
|
|
99
|
+
* Student training appointments relation
|
|
100
|
+
*/
|
|
101
|
+
studentAppointments;
|
|
102
|
+
/**
|
|
103
|
+
* Creates a new CompanyCourseAppointmentEntity instance
|
|
104
|
+
* @param props - Partial properties to initialize the entity with
|
|
105
|
+
*/
|
|
106
|
+
constructor(props) {
|
|
107
|
+
super();
|
|
108
|
+
Object.assign(this, props);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Converts the entity to a RecurringAppointment model instance
|
|
112
|
+
* @returns Promise resolving to RecurringAppointment model with lesson, instructor, and scheduling details
|
|
113
|
+
*/
|
|
114
|
+
async toModel() {
|
|
115
|
+
const lesson = this.lessonId ? (await this.lesson).toSummary() : null;
|
|
116
|
+
const instructor = this.instructorId ? await (await this.instructor).toSummary() : null;
|
|
117
|
+
return new common_1.RecurringAppointment({
|
|
118
|
+
id: this.id,
|
|
119
|
+
lesson: lesson,
|
|
120
|
+
instructor: instructor,
|
|
121
|
+
startDate: this.startDate,
|
|
122
|
+
endDate: this.endDate,
|
|
123
|
+
duration: this.duration,
|
|
124
|
+
repetition: this.repetition,
|
|
125
|
+
weekdays: this.weekdays,
|
|
126
|
+
skippedDates: this.skippedDates,
|
|
127
|
+
updates: this.updates,
|
|
128
|
+
instructors: this.instructors,
|
|
129
|
+
durations: this.durations
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Returns a summary representation of the appointment
|
|
134
|
+
* @returns Promise resolving to RecurringAppointment model (same as toModel())
|
|
135
|
+
*/
|
|
136
|
+
async toSummary() {
|
|
137
|
+
return await this.toModel();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Retrieves all tracked activities for this appointment
|
|
141
|
+
* Includes creation and update timestamps and associated users
|
|
142
|
+
* @returns Promise resolving to array of Activity objects filtered to exclude null values
|
|
143
|
+
*/
|
|
144
|
+
async getActivities() {
|
|
145
|
+
const activities = [];
|
|
146
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
|
|
147
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
148
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
|
|
149
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
150
|
+
return activities.filter(a => a);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
exports.CompanyCourseAppointmentEntity = CompanyCourseAppointmentEntity;
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, typeorm_1.Column)(),
|
|
156
|
+
__metadata("design:type", Number)
|
|
157
|
+
], CompanyCourseAppointmentEntity.prototype, "lessonId", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, typeorm_1.Column)({
|
|
160
|
+
nullable: true,
|
|
161
|
+
default: null
|
|
162
|
+
}),
|
|
163
|
+
__metadata("design:type", Number)
|
|
164
|
+
], CompanyCourseAppointmentEntity.prototype, "instructorId", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, typeorm_1.Column)(),
|
|
167
|
+
__metadata("design:type", Date)
|
|
168
|
+
], CompanyCourseAppointmentEntity.prototype, "startDate", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, typeorm_1.Column)({
|
|
171
|
+
nullable: true,
|
|
172
|
+
default: null
|
|
173
|
+
}),
|
|
174
|
+
__metadata("design:type", Date)
|
|
175
|
+
], CompanyCourseAppointmentEntity.prototype, "endDate", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
(0, typeorm_1.Column)({ default: 60 }),
|
|
178
|
+
__metadata("design:type", Number)
|
|
179
|
+
], CompanyCourseAppointmentEntity.prototype, "duration", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, typeorm_1.Column)({ default: false }),
|
|
182
|
+
__metadata("design:type", Boolean)
|
|
183
|
+
], CompanyCourseAppointmentEntity.prototype, "repetition", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, typeorm_1.Column)({
|
|
186
|
+
type: 'simple-json',
|
|
187
|
+
nullable: true,
|
|
188
|
+
default: null
|
|
189
|
+
}),
|
|
190
|
+
__metadata("design:type", Array)
|
|
191
|
+
], CompanyCourseAppointmentEntity.prototype, "weekdays", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, typeorm_1.Column)({
|
|
194
|
+
type: 'simple-json',
|
|
195
|
+
nullable: true,
|
|
196
|
+
default: null
|
|
197
|
+
}),
|
|
198
|
+
__metadata("design:type", Array)
|
|
199
|
+
], CompanyCourseAppointmentEntity.prototype, "skippedDates", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, typeorm_1.Column)({
|
|
202
|
+
type: 'simple-json',
|
|
203
|
+
nullable: true,
|
|
204
|
+
default: null
|
|
205
|
+
}),
|
|
206
|
+
__metadata("design:type", Array)
|
|
207
|
+
], CompanyCourseAppointmentEntity.prototype, "updates", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, typeorm_1.Column)({
|
|
210
|
+
type: 'simple-json',
|
|
211
|
+
nullable: true,
|
|
212
|
+
default: null
|
|
213
|
+
}),
|
|
214
|
+
__metadata("design:type", Array)
|
|
215
|
+
], CompanyCourseAppointmentEntity.prototype, "instructors", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
(0, typeorm_1.Column)({
|
|
218
|
+
type: 'simple-json',
|
|
219
|
+
nullable: true,
|
|
220
|
+
default: null
|
|
221
|
+
}),
|
|
222
|
+
__metadata("design:type", Array)
|
|
223
|
+
], CompanyCourseAppointmentEntity.prototype, "durations", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
(0, typeorm_1.ManyToOne)(() => lesson_entity_1.CompanyCourseLessonEntity, lesson => lesson.appointments),
|
|
226
|
+
__metadata("design:type", Promise)
|
|
227
|
+
], CompanyCourseAppointmentEntity.prototype, "lesson", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
(0, typeorm_1.ManyToOne)(() => instructor_entity_1.CompanyInstructorEntity, lesson => lesson.companyCourseAppointments),
|
|
230
|
+
__metadata("design:type", Promise)
|
|
231
|
+
], CompanyCourseAppointmentEntity.prototype, "instructor", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
(0, typeorm_1.OneToMany)(() => appointment_entity_1.StudentTrainingAppointmentEntity, appointment => appointment.definition),
|
|
234
|
+
__metadata("design:type", Promise)
|
|
235
|
+
], CompanyCourseAppointmentEntity.prototype, "studentAppointments", void 0);
|
|
236
|
+
exports.CompanyCourseAppointmentEntity = CompanyCourseAppointmentEntity = __decorate([
|
|
237
|
+
(0, typeorm_1.Entity)('companyCourseAppointments'),
|
|
238
|
+
__metadata("design:paramtypes", [Object])
|
|
239
|
+
], CompanyCourseAppointmentEntity);
|
|
240
|
+
//# sourceMappingURL=appointment.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appointment.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/course/appointment.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4CAAwF;AAExF,mDAA4D;AAC5D,0FAAqG;AACrG,uEAA0E;AAC1E,0CAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,uBAAqC;IAExF;;OAEG;IAEH,QAAQ,CAAS;IAEjB;;;OAGG;IAKH,YAAY,CAAS;IAErB;;;OAGG;IAEH,SAAS,CAAO;IAEhB;;;OAGG;IAKH,OAAO,CAAO;IAEd;;;OAGG;IAEH,QAAQ,CAAS;IAEjB;;OAEG;IAEH,UAAU,CAAU;IAEpB;;OAEG;IAMH,QAAQ,CAAY;IAEpB;;OAEG;IAMH,YAAY,CAAS;IAErB;;OAEG;IAMH,OAAO,CAAgB;IAEvB;;OAEG;IAMH,WAAW,CAAoB;IAE/B;;OAEG;IAMH,SAAS,CAAkB;IAE3B;;OAEG;IAEH,MAAM,CAAqC;IAE3C;;OAEG;IAEH,UAAU,CAAmC;IAE7C;;OAEG;IAEH,mBAAmB,CAA8C;IAEjE;;;OAGG;IACH,YAAY,KAA+C;QAC1D,KAAK,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AAUvB;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;mEAC6B;AAU/B;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;iEACyB;AAM3B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,yCAAyB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;;8DAC/B;AAM3C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAAuB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC;;kEACxC;AAM7C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qDAAgC,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC;;2EACxB;yCAlHrD,8BAA8B;IAD1C,IAAA,gBAAM,EAAC,2BAA2B,CAAC;;GACvB,8BAA8B,CAyK1C"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { StatusType, Course, Address } from '@driveup/common';
|
|
2
|
+
import { AddonUsage, Activity } from '@driveup/common';
|
|
3
|
+
import { CompanyProductEntity } from '../product/product.entity';
|
|
4
|
+
import { DrivingCategoryEntity } from '../../../system/driving/category.entity';
|
|
5
|
+
import { CompanyCourseLessonEntity } from './lesson.entity';
|
|
6
|
+
import { CompanyInstructorEntity } from '../instructor/instructor.entity';
|
|
7
|
+
import { StudentTrainingEntity } from '../../student/program/training/training.entity';
|
|
8
|
+
import { StudentTrainingRequestEntity } from '../../student/program/training/request.entity';
|
|
9
|
+
import { CompanyBillItemEntity } from '../finances/billing/item.entity';
|
|
10
|
+
import { TrackableEntity } from '../../../utils';
|
|
11
|
+
/**
|
|
12
|
+
* Represents a company-managed training course.
|
|
13
|
+
* Courses define training programs that can be offered to students,
|
|
14
|
+
* including theory classes, practical driving lessons, and specialized trainings.
|
|
15
|
+
* Each course has lessons, appointments, pricing, and capacity settings.
|
|
16
|
+
*
|
|
17
|
+
* Supports both fixed schedule courses (with predefined times) and flexible courses
|
|
18
|
+
* (where students book individual appointments).
|
|
19
|
+
*
|
|
20
|
+
* @extends TrackableEntity
|
|
21
|
+
*/
|
|
22
|
+
export declare class CompanyCourseEntity extends TrackableEntity<Course> {
|
|
23
|
+
/**
|
|
24
|
+
* Company product
|
|
25
|
+
* Medical and Licence product must be excluded.
|
|
26
|
+
* This two products will be offered via dedicated entities.
|
|
27
|
+
*/
|
|
28
|
+
productId: number;
|
|
29
|
+
/**
|
|
30
|
+
* Driveup driving catregory
|
|
31
|
+
*/
|
|
32
|
+
categoryId: number;
|
|
33
|
+
/**
|
|
34
|
+
* In-charge innstructor for the course
|
|
35
|
+
*/
|
|
36
|
+
instructorId: number;
|
|
37
|
+
/**
|
|
38
|
+
* Allow booking only if the course is published
|
|
39
|
+
*/
|
|
40
|
+
status: StatusType;
|
|
41
|
+
/******************* Content *******************/
|
|
42
|
+
/**
|
|
43
|
+
* Course name
|
|
44
|
+
* (e.g. First Aid, Category B, etc..)
|
|
45
|
+
*/
|
|
46
|
+
title: string;
|
|
47
|
+
/**
|
|
48
|
+
* Company course description
|
|
49
|
+
*/
|
|
50
|
+
description: string;
|
|
51
|
+
/**
|
|
52
|
+
* Promotion image URL for search engine visibility
|
|
53
|
+
*/
|
|
54
|
+
imageUrl: string;
|
|
55
|
+
/******************* Finances ******************/
|
|
56
|
+
/**
|
|
57
|
+
* Course price for trainings
|
|
58
|
+
*/
|
|
59
|
+
price: number;
|
|
60
|
+
/**
|
|
61
|
+
* Administration fee for the course
|
|
62
|
+
*/
|
|
63
|
+
administrationFee: number;
|
|
64
|
+
/******************* Settings *******************/
|
|
65
|
+
/**
|
|
66
|
+
* Maximum number of students for each appointment
|
|
67
|
+
* Used only by course tranings
|
|
68
|
+
*/
|
|
69
|
+
maxStudents: number;
|
|
70
|
+
/**
|
|
71
|
+
* Indicate if the training is fixed schedule or flexible
|
|
72
|
+
*/
|
|
73
|
+
isFixed: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Course location
|
|
76
|
+
*/
|
|
77
|
+
location: Address;
|
|
78
|
+
/**
|
|
79
|
+
* Activate addons for this course
|
|
80
|
+
*/
|
|
81
|
+
addons: AddonUsage[];
|
|
82
|
+
/******************* Tracks *******************/
|
|
83
|
+
/**
|
|
84
|
+
* ID of the user who published the course
|
|
85
|
+
*/
|
|
86
|
+
publishedBy: number;
|
|
87
|
+
/**
|
|
88
|
+
* Timestamp when the course was published
|
|
89
|
+
*/
|
|
90
|
+
publishedOn: Date;
|
|
91
|
+
/**
|
|
92
|
+
* ID of the user who ended the course
|
|
93
|
+
*/
|
|
94
|
+
endedBy: number;
|
|
95
|
+
/**
|
|
96
|
+
* Timestamp when the course was ended
|
|
97
|
+
*/
|
|
98
|
+
endedOn: Date;
|
|
99
|
+
/**
|
|
100
|
+
* Company product
|
|
101
|
+
* E.g. Theory Study, Driving Lessons, First Aid, etc..
|
|
102
|
+
*/
|
|
103
|
+
product: Promise<CompanyProductEntity>;
|
|
104
|
+
/**
|
|
105
|
+
* Course driving category
|
|
106
|
+
* Some courses may require specific driving category.
|
|
107
|
+
* E.g. Theory Study and Driving Category B
|
|
108
|
+
*/
|
|
109
|
+
category: Promise<DrivingCategoryEntity>;
|
|
110
|
+
/**
|
|
111
|
+
* Course in-charge instructor
|
|
112
|
+
*/
|
|
113
|
+
instructor: Promise<CompanyInstructorEntity>;
|
|
114
|
+
/**
|
|
115
|
+
* Course lessons
|
|
116
|
+
*/
|
|
117
|
+
lessons: Promise<CompanyCourseLessonEntity[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Student tranings related to this course
|
|
120
|
+
*/
|
|
121
|
+
students: Promise<StudentTrainingEntity[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Student requestes related to this course
|
|
124
|
+
*/
|
|
125
|
+
studentRequestes: Promise<StudentTrainingRequestEntity[]>;
|
|
126
|
+
/**
|
|
127
|
+
* Bill items related to this course
|
|
128
|
+
*/
|
|
129
|
+
billItems: Promise<CompanyBillItemEntity[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Creates a new CompanyCourseEntity instance
|
|
132
|
+
* @param props - Partial properties to initialize the entity with
|
|
133
|
+
*/
|
|
134
|
+
constructor(props?: Partial<CompanyCourseEntity>);
|
|
135
|
+
/**
|
|
136
|
+
* Converts the entity to a Course model instance
|
|
137
|
+
* @returns Promise resolving to Course model with category, instructor, and all course details
|
|
138
|
+
*/
|
|
139
|
+
toModel(): Promise<Course>;
|
|
140
|
+
/**
|
|
141
|
+
* Returns a summary representation of the course with essential information
|
|
142
|
+
* @returns Promise resolving to Course model with basic details (id, instructor, status, title, image, price)
|
|
143
|
+
*/
|
|
144
|
+
toSummary(): Promise<Course>;
|
|
145
|
+
/**
|
|
146
|
+
* Converts the entity to a Course model instance including all associated lessons
|
|
147
|
+
* @returns Promise resolving to Course model with complete lesson information
|
|
148
|
+
*/
|
|
149
|
+
toModelWithLessons(): Promise<Course>;
|
|
150
|
+
/**
|
|
151
|
+
* Retrieves all tracked activities for this course
|
|
152
|
+
* Includes creation, update, publication, and ending timestamps with associated users
|
|
153
|
+
* @returns Promise resolving to array of Activity objects filtered to exclude null values
|
|
154
|
+
*/
|
|
155
|
+
getActivities(): Promise<Activity[]>;
|
|
156
|
+
}
|