@driveup/schema 0.2.3 → 0.2.5
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/lib/catalog/addon/addon.entity.js +4 -8
- package/lib/catalog/addon/addon.entity.js.map +1 -1
- package/lib/catalog/addon/country.entity.d.ts +2 -2
- package/lib/catalog/addon/country.entity.js +6 -10
- package/lib/catalog/addon/country.entity.js.map +1 -1
- package/lib/catalog/priceplan/priceplan.entity.js +2 -4
- package/lib/catalog/priceplan/priceplan.entity.js.map +1 -1
- package/lib/catalog/product/country.entity.js +4 -8
- package/lib/catalog/product/country.entity.js.map +1 -1
- package/lib/catalog/product/priceplan.entity.js +4 -8
- package/lib/catalog/product/priceplan.entity.js.map +1 -1
- package/lib/catalog/product/product.entity.js +4 -8
- package/lib/catalog/product/product.entity.js.map +1 -1
- package/lib/catalog/program/program.entity.js +4 -8
- package/lib/catalog/program/program.entity.js.map +1 -1
- package/lib/catalog/seed/assets/asset.entity.js +2 -4
- package/lib/catalog/seed/assets/asset.entity.js.map +1 -1
- package/lib/catalog/seed/courses/course.entity.js +2 -4
- package/lib/catalog/seed/courses/course.entity.js.map +1 -1
- package/lib/catalog/seed/courses/lesson.entity.js +2 -4
- package/lib/catalog/seed/courses/lesson.entity.js.map +1 -1
- package/lib/catalog/seed/courses/topic.entity.js +2 -4
- package/lib/catalog/seed/courses/topic.entity.js.map +1 -1
- package/lib/catalog/seed/expense/category.entity.js +2 -4
- package/lib/catalog/seed/expense/category.entity.js.map +1 -1
- package/lib/profile/agent/agent.entity.d.ts +2 -4
- package/lib/profile/agent/agent.entity.js +8 -12
- package/lib/profile/agent/agent.entity.js.map +1 -1
- package/lib/profile/agent/payout.entity.js +2 -4
- package/lib/profile/agent/payout.entity.js.map +1 -1
- package/lib/profile/agent/promotion.entity.js +2 -4
- package/lib/profile/agent/promotion.entity.js.map +1 -1
- package/lib/profile/company/company.entity.d.ts +5 -3
- package/lib/profile/company/company.entity.js +17 -12
- package/lib/profile/company/company.entity.js.map +1 -1
- package/lib/profile/company/course/appointment.entity.d.ts +96 -6
- package/lib/profile/company/course/appointment.entity.js +336 -29
- package/lib/profile/company/course/appointment.entity.js.map +1 -1
- package/lib/profile/company/course/course.entity.d.ts +5 -3
- package/lib/profile/company/course/course.entity.js +21 -28
- package/lib/profile/company/course/course.entity.js.map +1 -1
- package/lib/profile/company/course/lesson.entity.d.ts +11 -3
- package/lib/profile/company/course/lesson.entity.js +41 -10
- package/lib/profile/company/course/lesson.entity.js.map +1 -1
- package/lib/profile/company/course/topic.entity.d.ts +7 -0
- package/lib/profile/company/course/topic.entity.js +35 -6
- package/lib/profile/company/course/topic.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/bill.entity.js +2 -4
- package/lib/profile/company/finances/billing/bill.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/item.entity.d.ts +2 -2
- package/lib/profile/company/finances/billing/item.entity.js +3 -5
- package/lib/profile/company/finances/billing/item.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/transaction.entity.js +3 -3
- package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -1
- package/lib/profile/company/finances/expense/category.entity.js +2 -4
- package/lib/profile/company/finances/expense/category.entity.js.map +1 -1
- package/lib/profile/company/finances/expense/expense.entity.js +4 -8
- package/lib/profile/company/finances/expense/expense.entity.js.map +1 -1
- package/lib/profile/company/finances/handover/handover.entity.js +1 -2
- package/lib/profile/company/finances/handover/handover.entity.js.map +1 -1
- package/lib/profile/company/finances/invoice/invoice.entity.js +5 -10
- package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -1
- package/lib/profile/company/finances/invoice/item.entity.js +2 -4
- package/lib/profile/company/finances/invoice/item.entity.js.map +1 -1
- package/lib/profile/company/finances/payment/method.entity.js +2 -4
- package/lib/profile/company/finances/payment/method.entity.js.map +1 -1
- package/lib/profile/company/instructor/activity.entity.d.ts +11 -1
- package/lib/profile/company/instructor/activity.entity.js +14 -0
- package/lib/profile/company/instructor/activity.entity.js.map +1 -1
- package/lib/profile/company/instructor/instructor.entity.d.ts +6 -7
- package/lib/profile/company/instructor/instructor.entity.js +26 -20
- package/lib/profile/company/instructor/instructor.entity.js.map +1 -1
- package/lib/profile/company/instructor/task.entity.js +2 -4
- package/lib/profile/company/instructor/task.entity.js.map +1 -1
- package/lib/profile/company/medical/examination.entity.js +2 -4
- package/lib/profile/company/medical/examination.entity.js.map +1 -1
- package/lib/profile/company/medical/product.entity.js +2 -4
- package/lib/profile/company/medical/product.entity.js.map +1 -1
- package/lib/profile/company/product/addon.entity.d.ts +7 -8
- package/lib/profile/company/product/addon.entity.js +41 -38
- package/lib/profile/company/product/addon.entity.js.map +1 -1
- package/lib/profile/company/product/priceplan.entity.js +2 -4
- package/lib/profile/company/product/priceplan.entity.js.map +1 -1
- package/lib/profile/company/product/product.entity.d.ts +9 -3
- package/lib/profile/company/product/product.entity.js +29 -13
- package/lib/profile/company/product/product.entity.js.map +1 -1
- package/lib/profile/company/product/vehicle.entity.js +2 -4
- package/lib/profile/company/product/vehicle.entity.js.map +1 -1
- package/lib/profile/instructor/instructor.entity.d.ts +2 -4
- package/lib/profile/instructor/instructor.entity.js +8 -12
- package/lib/profile/instructor/instructor.entity.js.map +1 -1
- package/lib/profile/student/program/licence/licence.entity.js +2 -4
- package/lib/profile/student/program/licence/licence.entity.js.map +1 -1
- package/lib/profile/student/program/medical/certificate.entity.js +2 -4
- package/lib/profile/student/program/medical/certificate.entity.js.map +1 -1
- package/lib/profile/student/program/medical/examination.entity.js +2 -4
- package/lib/profile/student/program/medical/examination.entity.js.map +1 -1
- package/lib/profile/student/program/program.entity.js +6 -5
- package/lib/profile/student/program/program.entity.js.map +1 -1
- package/lib/profile/student/program/training/appointment.entity.d.ts +12 -8
- package/lib/profile/student/program/training/appointment.entity.js +21 -9
- package/lib/profile/student/program/training/appointment.entity.js.map +1 -1
- package/lib/profile/student/program/training/exam.entity.js +2 -4
- package/lib/profile/student/program/training/exam.entity.js.map +1 -1
- package/lib/profile/student/program/training/lesson.entity.js +2 -4
- package/lib/profile/student/program/training/lesson.entity.js.map +1 -1
- package/lib/profile/student/program/training/request.entity.js +4 -8
- package/lib/profile/student/program/training/request.entity.js.map +1 -1
- package/lib/profile/student/program/training/topic.entity.js +3 -6
- package/lib/profile/student/program/training/topic.entity.js.map +1 -1
- package/lib/profile/student/program/training/training.entity.d.ts +13 -1
- package/lib/profile/student/program/training/training.entity.js +27 -14
- package/lib/profile/student/program/training/training.entity.js.map +1 -1
- package/lib/profile/student/program/training/transaction.entity.js +2 -4
- package/lib/profile/student/program/training/transaction.entity.js.map +1 -1
- package/lib/profile/student/student.entity.d.ts +15 -4
- package/lib/profile/student/student.entity.js +44 -12
- package/lib/profile/student/student.entity.js.map +1 -1
- package/lib/system/campaign/campaign.entity.js +2 -4
- package/lib/system/campaign/campaign.entity.js.map +1 -1
- package/lib/system/campaign/gifcode.entity.d.ts +1 -1
- package/lib/system/campaign/gifcode.entity.js +4 -6
- package/lib/system/campaign/gifcode.entity.js.map +1 -1
- package/lib/system/country/country.entity.js +4 -8
- package/lib/system/country/country.entity.js.map +1 -1
- package/lib/system/currency/currency.entity.js +2 -4
- package/lib/system/currency/currency.entity.js.map +1 -1
- package/lib/system/driving/category.entity.js +4 -8
- package/lib/system/driving/category.entity.js.map +1 -1
- package/lib/system/driving/vehicle.entity.js +2 -4
- package/lib/system/driving/vehicle.entity.js.map +1 -1
- package/lib/system/event/event.entity.js +3 -4
- package/lib/system/event/event.entity.js.map +1 -1
- package/lib/system/event/log.entity.d.ts +12 -12
- package/lib/system/event/log.entity.js +12 -12
- package/lib/system/event/log.entity.js.map +1 -1
- package/lib/system/policy/policy.entity.js +4 -8
- package/lib/system/policy/policy.entity.js.map +1 -1
- package/lib/system/staff/staff.entity.js +2 -4
- package/lib/system/staff/staff.entity.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/user/alert.entity.js +4 -5
- package/lib/user/alert.entity.js.map +1 -1
- package/lib/user/blocked.entity.js +1 -4
- package/lib/user/blocked.entity.js.map +1 -1
- package/lib/user/device.entity.js +2 -4
- package/lib/user/device.entity.js.map +1 -1
- package/lib/user/notification.entity.js +2 -4
- package/lib/user/notification.entity.js.map +1 -1
- package/lib/user/ticket.entity.js +4 -8
- package/lib/user/ticket.entity.js.map +1 -1
- package/lib/user/user.entity.d.ts +0 -4
- package/lib/user/user.entity.js +2 -12
- package/lib/user/user.entity.js.map +1 -1
- package/lib/user/verification.entity.js +2 -4
- package/lib/user/verification.entity.js.map +1 -1
- package/lib/utils/activity.helper.d.ts +1 -1
- package/lib/utils/activity.helper.js +9 -9
- package/lib/utils/activity.helper.js.map +1 -1
- package/package.json +6 -6
- package/lib/profile/student/program/medical/examination.model.d.ts +0 -63
- package/lib/profile/student/program/medical/examination.model.js +0 -158
- package/lib/profile/student/program/medical/examination.model.js.map +0 -1
- package/lib/system/campaigne/campaign.entity.d.ts +0 -69
- package/lib/system/campaigne/campaign.entity.js +0 -153
- package/lib/system/campaigne/campaign.entity.js.map +0 -1
- package/lib/system/campaigne/gifcode.entity.d.ts +0 -54
- package/lib/system/campaigne/gifcode.entity.js +0 -102
- package/lib/system/campaigne/gifcode.entity.js.map +0 -1
- package/lib/system/event/business.entity.d.ts +0 -75
- package/lib/system/event/business.entity.js +0 -128
- package/lib/system/event/business.entity.js.map +0 -1
- package/lib/utils/index.d.ts +0 -4
- package/lib/utils/index.js +0 -21
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/json-metrics.transform.d.ts +0 -35
- package/lib/utils/json-metrics.transform.js +0 -83
- package/lib/utils/json-metrics.transform.js.map +0 -1
- package/lib/utils/trackable.entity.d.ts +0 -82
- package/lib/utils/trackable.entity.js +0 -69
- package/lib/utils/trackable.entity.js.map +0 -1
|
@@ -9,15 +9,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.CompanyCourseScheduleEntity = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const shared_1 = require("@driveup/shared");
|
|
15
14
|
const common_1 = require("@driveup/common");
|
|
16
15
|
const lesson_entity_1 = require("./lesson.entity");
|
|
17
16
|
const appointment_entity_1 = require("../../student/program/training/appointment.entity");
|
|
18
17
|
const instructor_entity_1 = require("../instructor/instructor.entity");
|
|
19
18
|
const trackable_1 = require("../../../utils/trackable");
|
|
20
19
|
const activity_helper_1 = require("../../../utils/activity.helper");
|
|
20
|
+
const shared_1 = require("@driveup/shared");
|
|
21
|
+
const luxon_1 = require("luxon");
|
|
21
22
|
/**
|
|
22
23
|
* Represents a series of training appointment offers managed by the company.
|
|
23
24
|
*
|
|
@@ -40,9 +41,9 @@ const activity_helper_1 = require("../../../utils/activity.helper");
|
|
|
40
41
|
* @see {@link CompanyCourseLessonEntity} for the associated course lesson
|
|
41
42
|
* @see {@link StudentTrainingEntity} for student bookings
|
|
42
43
|
*/
|
|
43
|
-
let
|
|
44
|
+
let CompanyCourseScheduleEntity = class CompanyCourseScheduleEntity extends trackable_1.TrackableEntity {
|
|
44
45
|
/**
|
|
45
|
-
* Creates a new
|
|
46
|
+
* Creates a new CompanyCourseScheduleEntity instance
|
|
46
47
|
* @param props - Partial properties to initialize the entity with
|
|
47
48
|
*/
|
|
48
49
|
constructor(props) {
|
|
@@ -85,44 +86,350 @@ let CompanyCourseAppointmentEntity = class CompanyCourseAppointmentEntity extend
|
|
|
85
86
|
*/
|
|
86
87
|
async getActivities() {
|
|
87
88
|
const activities = [];
|
|
88
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, shared_1.ActivityType.
|
|
89
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.
|
|
90
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.updatedBy, shared_1.ActivityType.updatedBy));
|
|
91
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.updatedOn, shared_1.ActivityType.updatedOn));
|
|
89
|
+
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_1.ActivityType.created));
|
|
90
|
+
activities.push(await (0, activity_helper_1.toActivity)(this.updatedBy, this.updatedOn, shared_1.ActivityType.updated));
|
|
92
91
|
return activities.filter(a => a);
|
|
93
92
|
}
|
|
93
|
+
async getCompany() {
|
|
94
|
+
const lesson = await this.lesson;
|
|
95
|
+
return lesson.getCompany();
|
|
96
|
+
}
|
|
97
|
+
async getCourse() {
|
|
98
|
+
const lesson = await this.lesson;
|
|
99
|
+
return lesson.getCourse();
|
|
100
|
+
}
|
|
101
|
+
async getInstructor() {
|
|
102
|
+
return await this.instructor;
|
|
103
|
+
}
|
|
104
|
+
async getInstructorByDate(date) {
|
|
105
|
+
const d = this.instructors?.find(i => i.date === date);
|
|
106
|
+
return d?.id ? await instructor_entity_1.CompanyInstructorEntity.findOneBy({ id: d.id }) : null;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Load all appointments of the definition within the given period
|
|
110
|
+
* @description currently only works for flexible course schedules, and will return an empty array if the related course is fixed. but can and must be extended in the future to return the entire appointment list of the schedule, even if the appointment is fixed, or for another product type entirely.
|
|
111
|
+
* @param period Period
|
|
112
|
+
* @param instructorIds number[] - instructorId to filter by (return only appointments related to this instructor id)
|
|
113
|
+
* @param searchPhrase string - optional search phrase to filter appointments by (course title / part title / registered student name)
|
|
114
|
+
* @returns All appointments of the definition within the given period, filtered by instructorId if provided
|
|
115
|
+
*/
|
|
116
|
+
async getAppointments(period, instructorIds, searchPhrase) {
|
|
117
|
+
// check if course if flexible
|
|
118
|
+
const lesson = await lesson_entity_1.CompanyCourseLessonEntity.findOneBy({ id: this.lessonId });
|
|
119
|
+
const course = await lesson.course;
|
|
120
|
+
if (course.isFixed)
|
|
121
|
+
return [];
|
|
122
|
+
// step 0 : prepare local variables
|
|
123
|
+
period.startDate = new Date(period.startDate);
|
|
124
|
+
period.endDate = new Date(period.endDate);
|
|
125
|
+
const appointments = [];
|
|
126
|
+
// step 1 : get first appointment date
|
|
127
|
+
// if there is no match for given period, first appointment is not found
|
|
128
|
+
// if not found, return empty array (not appointments)
|
|
129
|
+
let current = this.getFirstAppointmentDateInPeriod(period);
|
|
130
|
+
if (!current)
|
|
131
|
+
return [];
|
|
132
|
+
if (current.toJSDate() > period.endDate ||
|
|
133
|
+
(this.endDate && current.toJSDate() > this.endDate))
|
|
134
|
+
return [];
|
|
135
|
+
// step 2 : from the first appointment and forward
|
|
136
|
+
// 1 -> set appointment information (and check for filtered instructor)
|
|
137
|
+
// 2 -> check if there is a filter by course title / part title / student name required and apply if so
|
|
138
|
+
// 3 -> push to the appointments array
|
|
139
|
+
// 4 -> find the next appointment date "inside the given period"
|
|
140
|
+
// repeat the process
|
|
141
|
+
let appointment = await this.getAppointmentInformation(current, instructorIds);
|
|
142
|
+
if (appointment) {
|
|
143
|
+
if (searchPhrase) {
|
|
144
|
+
const isMatch = lesson.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
|
|
145
|
+
course.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
|
|
146
|
+
(await this.isStudentRegistered(appointment, searchPhrase));
|
|
147
|
+
if (isMatch) {
|
|
148
|
+
appointments.push(appointment);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
appointments.push(appointment);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
current = this.getNextAppointmentDate(current);
|
|
156
|
+
if (!current) {
|
|
157
|
+
return appointments;
|
|
158
|
+
}
|
|
159
|
+
while (current.toJSDate() <= period.endDate &&
|
|
160
|
+
(!this.endDate || current.toJSDate() <= this.endDate)) {
|
|
161
|
+
appointment = await this.getAppointmentInformation(current, instructorIds);
|
|
162
|
+
if (appointment) {
|
|
163
|
+
if (searchPhrase) {
|
|
164
|
+
const isMatch = lesson.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
|
|
165
|
+
course.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
|
|
166
|
+
(await this.isStudentRegistered(appointment, searchPhrase));
|
|
167
|
+
if (isMatch) {
|
|
168
|
+
appointments.push(appointment);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
appointments.push(appointment);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
current = this.getNextAppointmentDate(current);
|
|
176
|
+
}
|
|
177
|
+
// step 3 : when no more appointments are found inside the given period
|
|
178
|
+
// return the found appointments
|
|
179
|
+
return appointments;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
*
|
|
183
|
+
* @param period Period
|
|
184
|
+
* @returns DateTime if a first appointment is found, null otherwise
|
|
185
|
+
*/
|
|
186
|
+
getFirstAppointmentDateInPeriod(period) {
|
|
187
|
+
// if this is a single appointment
|
|
188
|
+
// only check if the definition's start date is within the given period
|
|
189
|
+
if (!this.repetition) {
|
|
190
|
+
if (common_1.DateHelper.isBetween(this.startDate, period.startDate, period.endDate)) {
|
|
191
|
+
return luxon_1.DateTime.fromJSDate(this.startDate);
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
// check if given period contains some/all of the definition's start and end date
|
|
196
|
+
const periodMatches = common_1.DateHelper.isBetween(this.startDate, period.startDate, period.endDate) ||
|
|
197
|
+
(this.startDate <= period.endDate &&
|
|
198
|
+
(!this.endDate || this.endDate >= period.startDate));
|
|
199
|
+
if (!periodMatches)
|
|
200
|
+
return null;
|
|
201
|
+
const defStart = luxon_1.DateTime.fromJSDate(this.startDate);
|
|
202
|
+
// get the greater from period start date and definition start date
|
|
203
|
+
// to start counting days from that point forward
|
|
204
|
+
let date = period.startDate > this.startDate ? luxon_1.DateTime.fromJSDate(period.startDate) : defStart;
|
|
205
|
+
date = date.set({
|
|
206
|
+
hour: defStart.hour,
|
|
207
|
+
minute: defStart.minute,
|
|
208
|
+
second: defStart.second,
|
|
209
|
+
millisecond: defStart.millisecond
|
|
210
|
+
});
|
|
211
|
+
// weekdays: sorted array of WeekdayNumbers
|
|
212
|
+
const weekdays = this.weekdays
|
|
213
|
+
.map(i => common_1.DateHelper.getWeekdayNumber(i))
|
|
214
|
+
.sort((a, b) => a - b);
|
|
215
|
+
if (this.repetition && !weekdays?.length) {
|
|
216
|
+
// to avoid infinite loop, if the definition is repeated, but somehow no weekdays are assigned, return null
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
// find the first valid appointment date considering weekdays, updates, and skipped dates
|
|
220
|
+
while (!this.endDate || date.toJSDate() <= this.endDate) {
|
|
221
|
+
if (weekdays.includes(common_1.DateHelper.toWeekdayNumber(date.weekday))) {
|
|
222
|
+
const updatedDate = this.getUpdatedDate(date);
|
|
223
|
+
if (!this.isDateSkipped(updatedDate)) {
|
|
224
|
+
return updatedDate;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// move to the next day
|
|
228
|
+
date = date.plus({ days: 1 });
|
|
229
|
+
}
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @description Get detailed information about an appointment
|
|
234
|
+
* @param date - DateTime - is presumed to be related to an appointment in this definition
|
|
235
|
+
* @param filteredInstructorIds - number - optional - instrucotr id to filter the appointment by
|
|
236
|
+
* @returns Appointment - appointment information (id, start and end date, instructor information)
|
|
237
|
+
*/
|
|
238
|
+
async getAppointmentInformation(date, filteredInstructorIds) {
|
|
239
|
+
date = this.getUpdatedDate(date);
|
|
240
|
+
const isDeleted = this.isDateSkipped(date);
|
|
241
|
+
if (isDeleted)
|
|
242
|
+
return null;
|
|
243
|
+
const instructorId = this.getAppointmentInstructorId(date);
|
|
244
|
+
if (filteredInstructorIds?.length && !filteredInstructorIds.includes(instructorId))
|
|
245
|
+
return null;
|
|
246
|
+
const instructor = await this.getInstructorById(instructorId);
|
|
247
|
+
const duration = this.getAppointmentDuration(date);
|
|
248
|
+
const endDate = date.plus({ minutes: duration });
|
|
249
|
+
const appointment = new common_1.Appointment({
|
|
250
|
+
id: this.id,
|
|
251
|
+
startDate: date.toJSDate(),
|
|
252
|
+
endDate: endDate.toJSDate(),
|
|
253
|
+
instructor: instructor
|
|
254
|
+
});
|
|
255
|
+
return appointment;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* @description Only for repeted definitions (repetition = true)
|
|
259
|
+
* @description Finds the final date of the appointment, considering any date updates (updates in the startDate)
|
|
260
|
+
* @description If no date updates are found, the original date will be returned
|
|
261
|
+
* @param date DateTime - original date of the appointment (default return value, if no date updates are found)
|
|
262
|
+
* @returns DateTime - final date of the appointment
|
|
263
|
+
*/
|
|
264
|
+
getUpdatedDate(date) {
|
|
265
|
+
if (!this.updates?.length)
|
|
266
|
+
return date;
|
|
267
|
+
let updates = this.updates.map(i => {
|
|
268
|
+
return {
|
|
269
|
+
from: new Date(i.from),
|
|
270
|
+
to: new Date(i.to)
|
|
271
|
+
};
|
|
272
|
+
});
|
|
273
|
+
updates = updates.filter(i => i.from.getTime() === date.toJSDate().getTime());
|
|
274
|
+
if (!updates?.length) {
|
|
275
|
+
return date;
|
|
276
|
+
}
|
|
277
|
+
return common_1.DateHelper.toDateTimeInstance(common_1.ArrayHelper.getLastItem(updates).to);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* @description Only for repeted definitions (repetition = true)
|
|
281
|
+
* @description Checks wether or not the appointment related to the given date has been removed from schedule (pushed in the skippedDates array)
|
|
282
|
+
* @param date DateTime - date of the appointment
|
|
283
|
+
* @returns DateTime - true if the appointment is skipped, false otherwise
|
|
284
|
+
*/
|
|
285
|
+
isDateSkipped(date) {
|
|
286
|
+
if (!this.skippedDates?.length)
|
|
287
|
+
return false;
|
|
288
|
+
const exists = this.skippedDates.some(i => new Date(i).getTime() === date.toJSDate().getTime());
|
|
289
|
+
return exists;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @description Only for repeted definitions (repetition = true)
|
|
293
|
+
* @description Finds the final duration of the appointment, considering any duration updates
|
|
294
|
+
* @description If no duration updates are found, this.duration will be returned by default
|
|
295
|
+
* @param date DateTime - date of the appointment
|
|
296
|
+
* @returns number - duration of the appointment (in minutes)
|
|
297
|
+
*/
|
|
298
|
+
getAppointmentDuration(date) {
|
|
299
|
+
if (!this.durations?.length)
|
|
300
|
+
return this.duration;
|
|
301
|
+
const durations = this.durations.filter(i => new Date(i.date).getTime() === date.toJSDate().getTime());
|
|
302
|
+
if (!durations?.length)
|
|
303
|
+
return this.duration;
|
|
304
|
+
return common_1.ArrayHelper.getLastItem(durations).duration;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* @description Checks weather or not there is a student with a matching name registered in this schedule for the given appointment
|
|
308
|
+
* @description Currently only works for flexible course trainings (MVP logic), and will always return false for fixed course trainings
|
|
309
|
+
* Must be renamed and extended in the future to support fixed course trainings as well, but will remain as is for the sake of MVP Migration
|
|
310
|
+
* @param appointment Appointment - appointment to check for registered students
|
|
311
|
+
* @param studentName string - name of the student to check for registration
|
|
312
|
+
* @returns boolean - Weather or not there a student with the given name registered for the appointment
|
|
313
|
+
*/
|
|
314
|
+
async isStudentRegistered(appointment, studentName) {
|
|
315
|
+
const course = await this.getCourse();
|
|
316
|
+
return await appointment_entity_1.StudentTrainingAppointmentEntity
|
|
317
|
+
.createQueryBuilder('a')
|
|
318
|
+
.innerJoin('a.training', 't')
|
|
319
|
+
.innerJoin('t.course', 'c')
|
|
320
|
+
.where('c.id = :courseid', { courseId: course.id })
|
|
321
|
+
.andWhere('c.isFixed = :false', { false: false })
|
|
322
|
+
.andWhere('a.lessonId = :lessonId', { lessonId: this.lessonId })
|
|
323
|
+
.andWhere('a.scheduleId = :scheduleId', { scheduleId: this.id })
|
|
324
|
+
.andWhere('a.startDate = :startDate', { startDate: appointment.startDate })
|
|
325
|
+
.andWhere(`t.studentSnapshot ->> '$.name' like :studentname`, { studentname: `%${studentName}%` })
|
|
326
|
+
.getExists();
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* @description Doesn't check for the definition's endDate, or updates and skippedDates
|
|
330
|
+
* @returns the next appointment based on repetition logic and weekdays assigned
|
|
331
|
+
*/
|
|
332
|
+
getNextAppointmentDate(date) {
|
|
333
|
+
if (!this.weekdays?.length)
|
|
334
|
+
return null;
|
|
335
|
+
const startDate = common_1.DateHelper.toDateTimeInstance(this.startDate);
|
|
336
|
+
// after going to the next day, set the time to the startDate's time
|
|
337
|
+
// since the param date can be the last appointment's date, and the last appointment's time could've been updated
|
|
338
|
+
date = date.plus({ days: 1 }).set({
|
|
339
|
+
hour: startDate.hour,
|
|
340
|
+
minute: startDate.minute,
|
|
341
|
+
second: startDate.second,
|
|
342
|
+
millisecond: startDate.millisecond
|
|
343
|
+
});
|
|
344
|
+
// weekdays: sorted array of WeekdayNumbers
|
|
345
|
+
const weekdays = this.weekdays
|
|
346
|
+
.map(i => common_1.DateHelper.getWeekdayNumber(i))
|
|
347
|
+
.sort((a, b) => a - b);
|
|
348
|
+
while (!weekdays.includes(common_1.DateHelper.toWeekdayNumber(date.weekday))) {
|
|
349
|
+
date = date.plus({ days: 1 }).set({
|
|
350
|
+
hour: startDate.hour,
|
|
351
|
+
minute: startDate.minute,
|
|
352
|
+
second: startDate.second,
|
|
353
|
+
millisecond: startDate.millisecond
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
return date;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Get the instructor registered for the appointment (works for repeated and single appointments)
|
|
360
|
+
* @param date Date - the date of the appointment
|
|
361
|
+
* @returns Instructor - simple instructor model
|
|
362
|
+
*/
|
|
363
|
+
async getAppointmentInstructor(date) {
|
|
364
|
+
const instructorId = this.getAppointmentInstructorId(date);
|
|
365
|
+
return await this.getInstructorById(instructorId);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* @param date DateTime - is presumed to belong to an existing appointment
|
|
369
|
+
* @returns number - instructor id for the appointment of the given date
|
|
370
|
+
*/
|
|
371
|
+
getAppointmentInstructorId(date) {
|
|
372
|
+
if (!this.instructors?.length)
|
|
373
|
+
return this.instructorId;
|
|
374
|
+
const instructors = this.instructors.filter(i => new Date(i.date).getTime() === date.toJSDate().getTime());
|
|
375
|
+
if (!instructors?.length)
|
|
376
|
+
return this.instructorId;
|
|
377
|
+
return common_1.ArrayHelper.getLastItem(instructors).id;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Find instructor by id and map with simple information to User model
|
|
381
|
+
* @param id instructor id
|
|
382
|
+
* @returns Object - For the MVP it returns an object mapped like CompanyInstructorMapper.toSimple with the same interface. should be replaced with Person model in the future
|
|
383
|
+
*/
|
|
384
|
+
async getInstructorById(id) {
|
|
385
|
+
const companyInstructor = await instructor_entity_1.CompanyInstructorEntity.findOneBy({ id });
|
|
386
|
+
if (!companyInstructor)
|
|
387
|
+
return null;
|
|
388
|
+
const instructor = await companyInstructor.instructor;
|
|
389
|
+
const user = await instructor.user;
|
|
390
|
+
return {
|
|
391
|
+
id: companyInstructor.id,
|
|
392
|
+
name: instructor.name,
|
|
393
|
+
image: instructor.imageUrl,
|
|
394
|
+
phone: user.phone,
|
|
395
|
+
role: companyInstructor.role,
|
|
396
|
+
status: companyInstructor.status,
|
|
397
|
+
canReinstate: await companyInstructor.canReinstate(),
|
|
398
|
+
calendarLinks: companyInstructor.calendarLinks || []
|
|
399
|
+
};
|
|
400
|
+
}
|
|
94
401
|
};
|
|
95
|
-
exports.
|
|
402
|
+
exports.CompanyCourseScheduleEntity = CompanyCourseScheduleEntity;
|
|
96
403
|
__decorate([
|
|
97
404
|
(0, typeorm_1.Column)(),
|
|
98
405
|
__metadata("design:type", Number)
|
|
99
|
-
],
|
|
406
|
+
], CompanyCourseScheduleEntity.prototype, "lessonId", void 0);
|
|
100
407
|
__decorate([
|
|
101
408
|
(0, typeorm_1.Column)({
|
|
102
409
|
nullable: true,
|
|
103
410
|
default: null
|
|
104
411
|
}),
|
|
105
412
|
__metadata("design:type", Number)
|
|
106
|
-
],
|
|
413
|
+
], CompanyCourseScheduleEntity.prototype, "instructorId", void 0);
|
|
107
414
|
__decorate([
|
|
108
415
|
(0, typeorm_1.Column)(),
|
|
109
416
|
__metadata("design:type", Date)
|
|
110
|
-
],
|
|
417
|
+
], CompanyCourseScheduleEntity.prototype, "startDate", void 0);
|
|
111
418
|
__decorate([
|
|
112
419
|
(0, typeorm_1.Column)({
|
|
113
420
|
nullable: true,
|
|
114
421
|
default: null
|
|
115
422
|
}),
|
|
116
423
|
__metadata("design:type", Date)
|
|
117
|
-
],
|
|
424
|
+
], CompanyCourseScheduleEntity.prototype, "endDate", void 0);
|
|
118
425
|
__decorate([
|
|
119
426
|
(0, typeorm_1.Column)({ default: 60 }),
|
|
120
427
|
__metadata("design:type", Number)
|
|
121
|
-
],
|
|
428
|
+
], CompanyCourseScheduleEntity.prototype, "duration", void 0);
|
|
122
429
|
__decorate([
|
|
123
430
|
(0, typeorm_1.Column)({ default: false }),
|
|
124
431
|
__metadata("design:type", Boolean)
|
|
125
|
-
],
|
|
432
|
+
], CompanyCourseScheduleEntity.prototype, "repetition", void 0);
|
|
126
433
|
__decorate([
|
|
127
434
|
(0, typeorm_1.Column)({
|
|
128
435
|
type: 'simple-json',
|
|
@@ -130,7 +437,7 @@ __decorate([
|
|
|
130
437
|
default: null
|
|
131
438
|
}),
|
|
132
439
|
__metadata("design:type", Array)
|
|
133
|
-
],
|
|
440
|
+
], CompanyCourseScheduleEntity.prototype, "weekdays", void 0);
|
|
134
441
|
__decorate([
|
|
135
442
|
(0, typeorm_1.Column)({
|
|
136
443
|
type: 'simple-json',
|
|
@@ -138,7 +445,7 @@ __decorate([
|
|
|
138
445
|
default: null
|
|
139
446
|
}),
|
|
140
447
|
__metadata("design:type", Array)
|
|
141
|
-
],
|
|
448
|
+
], CompanyCourseScheduleEntity.prototype, "skippedDates", void 0);
|
|
142
449
|
__decorate([
|
|
143
450
|
(0, typeorm_1.Column)({
|
|
144
451
|
type: 'simple-json',
|
|
@@ -146,7 +453,7 @@ __decorate([
|
|
|
146
453
|
default: null
|
|
147
454
|
}),
|
|
148
455
|
__metadata("design:type", Array)
|
|
149
|
-
],
|
|
456
|
+
], CompanyCourseScheduleEntity.prototype, "updates", void 0);
|
|
150
457
|
__decorate([
|
|
151
458
|
(0, typeorm_1.Column)({
|
|
152
459
|
type: 'simple-json',
|
|
@@ -154,7 +461,7 @@ __decorate([
|
|
|
154
461
|
default: null
|
|
155
462
|
}),
|
|
156
463
|
__metadata("design:type", Array)
|
|
157
|
-
],
|
|
464
|
+
], CompanyCourseScheduleEntity.prototype, "instructors", void 0);
|
|
158
465
|
__decorate([
|
|
159
466
|
(0, typeorm_1.Column)({
|
|
160
467
|
type: 'simple-json',
|
|
@@ -162,21 +469,21 @@ __decorate([
|
|
|
162
469
|
default: null
|
|
163
470
|
}),
|
|
164
471
|
__metadata("design:type", Array)
|
|
165
|
-
],
|
|
472
|
+
], CompanyCourseScheduleEntity.prototype, "durations", void 0);
|
|
166
473
|
__decorate([
|
|
167
|
-
(0, typeorm_1.ManyToOne)(() => lesson_entity_1.CompanyCourseLessonEntity, lesson => lesson.
|
|
474
|
+
(0, typeorm_1.ManyToOne)(() => lesson_entity_1.CompanyCourseLessonEntity, lesson => lesson.schedule),
|
|
168
475
|
__metadata("design:type", Promise)
|
|
169
|
-
],
|
|
476
|
+
], CompanyCourseScheduleEntity.prototype, "lesson", void 0);
|
|
170
477
|
__decorate([
|
|
171
|
-
(0, typeorm_1.ManyToOne)(() => instructor_entity_1.CompanyInstructorEntity, lesson => lesson.
|
|
478
|
+
(0, typeorm_1.ManyToOne)(() => instructor_entity_1.CompanyInstructorEntity, lesson => lesson.companyCourseSchedule),
|
|
172
479
|
__metadata("design:type", Promise)
|
|
173
|
-
],
|
|
480
|
+
], CompanyCourseScheduleEntity.prototype, "instructor", void 0);
|
|
174
481
|
__decorate([
|
|
175
|
-
(0, typeorm_1.OneToMany)(() => appointment_entity_1.StudentTrainingAppointmentEntity, appointment => appointment.
|
|
482
|
+
(0, typeorm_1.OneToMany)(() => appointment_entity_1.StudentTrainingAppointmentEntity, appointment => appointment.schedule),
|
|
176
483
|
__metadata("design:type", Promise)
|
|
177
|
-
],
|
|
178
|
-
exports.
|
|
179
|
-
(0, typeorm_1.Entity)('
|
|
484
|
+
], CompanyCourseScheduleEntity.prototype, "studentSchedule", void 0);
|
|
485
|
+
exports.CompanyCourseScheduleEntity = CompanyCourseScheduleEntity = __decorate([
|
|
486
|
+
(0, typeorm_1.Entity)('companyCourseSchedules'),
|
|
180
487
|
__metadata("design:paramtypes", [Object])
|
|
181
|
-
],
|
|
488
|
+
], CompanyCourseScheduleEntity);
|
|
182
489
|
//# sourceMappingURL=appointment.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appointment.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/course/appointment.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4CAAqG;AACrG,4CAAiE;AACjE,mDAA4D;AAC5D,0FAAqG;AACrG,uEAA0E;AAC1E,wDAA2D;AAC3D,oEAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,2BAAqC;IAqHxF;;;OAGG;IACH,YAAY,KAA+C;QAC1D,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACtE,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAA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Y,CAAC;;8DAC/B;AAM3C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAAuB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC;;kEACxC;AAO7C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qDAAgC,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC;;2EACxB;yCAnHrD,8BAA8B;IAD1C,IAAA,gBAAM,EAAC,2BAA2B,CAAC;;GACvB,8BAA8B,CA0K1C"}
|
|
1
|
+
{"version":3,"file":"appointment.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/course/appointment.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4CAA+G;AAC/G,mDAA4D;AAC5D,0FAAqG;AACrG,uEAA0E;AAC1E,wDAA2D;AAC3D,oEAA4D;AAC5D,4CAAqG;AACrG,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,2BAAqC;IAqHrF;;;OAGG;IACH,YAAY,KAA4C;QACvD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACtE,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACxF,OAAO,IAAI,6BAAoB,CAAC;YAC/B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,MAAM,EA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B;IADvC,IAAA,gBAAM,EAAC,wBAAwB,CAAC;;GACpB,2BAA2B,CAghBvC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { StatusType
|
|
1
|
+
import { StatusType } from '@driveup/shared';
|
|
2
2
|
import { AddonUsage, Activity, Course, Address } from '@driveup/common';
|
|
3
|
+
import { CompanyEntity } from '../company.entity';
|
|
3
4
|
import { CompanyProductEntity } from '../product/product.entity';
|
|
4
5
|
import { DrivingCategoryEntity } from '../../../system/driving/category.entity';
|
|
5
6
|
import { CompanyCourseLessonEntity } from './lesson.entity';
|
|
@@ -43,8 +44,6 @@ export declare class CompanyCourseEntity extends TrackableEntity<Course> {
|
|
|
43
44
|
* For Others such as Preparation, Completion etc... , the status can be Draft, Published, or Ended
|
|
44
45
|
*/
|
|
45
46
|
status: StatusType;
|
|
46
|
-
catalogType: CatalogType;
|
|
47
|
-
productType: ProductType;
|
|
48
47
|
/******************* Content *******************/
|
|
49
48
|
/**
|
|
50
49
|
* Course name
|
|
@@ -167,4 +166,7 @@ export declare class CompanyCourseEntity extends TrackableEntity<Course> {
|
|
|
167
166
|
* @returns Promise resolving to array of Activity objects filtered to exclude null values
|
|
168
167
|
*/
|
|
169
168
|
getActivities(): Promise<Activity[]>;
|
|
169
|
+
getCompany(): Promise<CompanyEntity>;
|
|
170
|
+
getProduct(): Promise<CompanyProductEntity>;
|
|
171
|
+
getInstructor(): Promise<CompanyInstructorEntity>;
|
|
170
172
|
}
|
|
@@ -8,11 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var CompanyCourseEntity_1;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.CompanyCourseEntity = void 0;
|
|
13
14
|
const typeorm_1 = require("typeorm");
|
|
14
15
|
const shared_1 = require("@driveup/shared");
|
|
15
16
|
const common_1 = require("@driveup/common");
|
|
17
|
+
const company_entity_1 = require("../company.entity");
|
|
16
18
|
const product_entity_1 = require("../product/product.entity");
|
|
17
19
|
const category_entity_1 = require("../../../system/driving/category.entity");
|
|
18
20
|
const lesson_entity_1 = require("./lesson.entity");
|
|
@@ -33,7 +35,7 @@ const activity_helper_1 = require("../../../utils/activity.helper");
|
|
|
33
35
|
*
|
|
34
36
|
* @extends TrackableEntity<Course>
|
|
35
37
|
*/
|
|
36
|
-
let CompanyCourseEntity = class CompanyCourseEntity extends trackable_1.TrackableEntity {
|
|
38
|
+
let CompanyCourseEntity = CompanyCourseEntity_1 = class CompanyCourseEntity extends trackable_1.TrackableEntity {
|
|
37
39
|
/**
|
|
38
40
|
* Creates a new CompanyCourseEntity instance
|
|
39
41
|
* @param props - Partial properties to initialize the entity with
|
|
@@ -97,16 +99,25 @@ let CompanyCourseEntity = class CompanyCourseEntity extends trackable_1.Trackabl
|
|
|
97
99
|
*/
|
|
98
100
|
async getActivities() {
|
|
99
101
|
const activities = [];
|
|
100
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, shared_1.ActivityType.
|
|
101
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.
|
|
102
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.
|
|
103
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.
|
|
104
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.publishedBy, shared_1.ActivityType.publishedBy));
|
|
105
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.publishedOn, shared_1.ActivityType.publishedOn));
|
|
106
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.endedBy, shared_1.ActivityType.endedBy));
|
|
107
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.endedOn, shared_1.ActivityType.endedOn));
|
|
102
|
+
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_1.ActivityType.created));
|
|
103
|
+
activities.push(await (0, activity_helper_1.toActivity)(this.updatedBy, this.updatedOn, shared_1.ActivityType.updated));
|
|
104
|
+
activities.push(await (0, activity_helper_1.toActivity)(this.publishedBy, this.publishedOn, shared_1.ActivityType.published));
|
|
105
|
+
activities.push(await (0, activity_helper_1.toActivity)(this.endedBy, this.endedOn, shared_1.ActivityType.ended));
|
|
108
106
|
return activities.filter(a => a);
|
|
109
107
|
}
|
|
108
|
+
async getCompany() {
|
|
109
|
+
return await company_entity_1.CompanyEntity.createQueryBuilder('company')
|
|
110
|
+
.innerJoin(product_entity_1.CompanyProductEntity, 'product', 'product.companyId = company.id')
|
|
111
|
+
.innerJoin(CompanyCourseEntity_1, 'course', 'course.productId = product.id')
|
|
112
|
+
.where('course.id = :courseId', { courseId: this.id })
|
|
113
|
+
.getOne();
|
|
114
|
+
}
|
|
115
|
+
async getProduct() {
|
|
116
|
+
return await this.product;
|
|
117
|
+
}
|
|
118
|
+
async getInstructor() {
|
|
119
|
+
return await this.instructor;
|
|
120
|
+
}
|
|
110
121
|
};
|
|
111
122
|
exports.CompanyCourseEntity = CompanyCourseEntity;
|
|
112
123
|
__decorate([
|
|
@@ -142,24 +153,6 @@ __decorate([
|
|
|
142
153
|
}),
|
|
143
154
|
__metadata("design:type", String)
|
|
144
155
|
], CompanyCourseEntity.prototype, "status", void 0);
|
|
145
|
-
__decorate([
|
|
146
|
-
(0, typeorm_1.Column)({
|
|
147
|
-
type: 'enum',
|
|
148
|
-
enum: shared_1.CatalogType,
|
|
149
|
-
default: shared_1.CatalogType.Driving,
|
|
150
|
-
nullable: false
|
|
151
|
-
}),
|
|
152
|
-
__metadata("design:type", String)
|
|
153
|
-
], CompanyCourseEntity.prototype, "catalogType", void 0);
|
|
154
|
-
__decorate([
|
|
155
|
-
(0, typeorm_1.Column)({
|
|
156
|
-
type: 'enum',
|
|
157
|
-
enum: shared_1.ProductType,
|
|
158
|
-
default: shared_1.ProductType.DrivingCar,
|
|
159
|
-
nullable: false
|
|
160
|
-
}),
|
|
161
|
-
__metadata("design:type", String)
|
|
162
|
-
], CompanyCourseEntity.prototype, "productType", void 0);
|
|
163
156
|
__decorate([
|
|
164
157
|
(0, typeorm_1.Column)(),
|
|
165
158
|
__metadata("design:type", String)
|
|
@@ -279,7 +272,7 @@ __decorate([
|
|
|
279
272
|
(0, typeorm_1.OneToMany)(() => item_entity_1.CompanyBillItemEntity, billItem => billItem.course),
|
|
280
273
|
__metadata("design:type", Promise)
|
|
281
274
|
], CompanyCourseEntity.prototype, "billItems", void 0);
|
|
282
|
-
exports.CompanyCourseEntity = CompanyCourseEntity = __decorate([
|
|
275
|
+
exports.CompanyCourseEntity = CompanyCourseEntity = CompanyCourseEntity_1 = __decorate([
|
|
283
276
|
(0, typeorm_1.Entity)('companyCourses'),
|
|
284
277
|
__metadata("design:paramtypes", [Object])
|
|
285
278
|
], CompanyCourseEntity);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"course.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/course/course.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"course.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/course/course.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4CAAqF;AACrF,4CAAwE;AACxE,sDAAkD;AAClD,8DAAiE;AACjE,6EAAgF;AAChF,mDAA4D;AAC5D,uEAA0E;AAC1E,oFAAuF;AACvF,kFAA6F;AAC7F,iEAAwE;AACxE,wDAA2D;AAC3D,oEAA4D;AAE5D;;;;;;;;;;GAUG;AAEI,IAAM,mBAAmB,2BAAzB,MAAM,mBAAoB,SAAQ,2BAAuB;IAmO/D;;;OAGG;IACH,YAAY,KAAoC;QAC/C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG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