@driveup/schema 0.2.6 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/lib/catalog/addon/addon.entity.d.ts +3 -3
  2. package/lib/catalog/addon/addon.entity.js +7 -7
  3. package/lib/catalog/addon/addon.entity.js.map +1 -1
  4. package/lib/catalog/addon/country.entity.d.ts +4 -4
  5. package/lib/catalog/addon/country.entity.js +5 -6
  6. package/lib/catalog/addon/country.entity.js.map +1 -1
  7. package/lib/catalog/priceplan/priceplan.entity.d.ts +8 -3
  8. package/lib/catalog/priceplan/priceplan.entity.js +14 -7
  9. package/lib/catalog/priceplan/priceplan.entity.js.map +1 -1
  10. package/lib/catalog/product/country.entity.d.ts +6 -6
  11. package/lib/catalog/product/country.entity.js +9 -10
  12. package/lib/catalog/product/country.entity.js.map +1 -1
  13. package/lib/catalog/product/priceplan.entity.d.ts +9 -4
  14. package/lib/catalog/product/priceplan.entity.js +19 -9
  15. package/lib/catalog/product/priceplan.entity.js.map +1 -1
  16. package/lib/catalog/product/product.entity.d.ts +3 -3
  17. package/lib/catalog/product/product.entity.js +8 -8
  18. package/lib/catalog/product/product.entity.js.map +1 -1
  19. package/lib/catalog/program/program.entity.d.ts +2 -2
  20. package/lib/catalog/program/program.entity.js +7 -7
  21. package/lib/catalog/program/program.entity.js.map +1 -1
  22. package/lib/catalog/seed/assets/asset.entity.d.ts +2 -2
  23. package/lib/catalog/seed/assets/asset.entity.js +6 -6
  24. package/lib/catalog/seed/assets/asset.entity.js.map +1 -1
  25. package/lib/catalog/seed/courses/course.entity.d.ts +4 -4
  26. package/lib/catalog/seed/courses/course.entity.js +9 -9
  27. package/lib/catalog/seed/courses/course.entity.js.map +1 -1
  28. package/lib/catalog/seed/courses/lesson.entity.d.ts +3 -3
  29. package/lib/catalog/seed/courses/lesson.entity.js +7 -7
  30. package/lib/catalog/seed/courses/lesson.entity.js.map +1 -1
  31. package/lib/catalog/seed/courses/topic.entity.d.ts +3 -3
  32. package/lib/catalog/seed/courses/topic.entity.js +8 -8
  33. package/lib/catalog/seed/courses/topic.entity.js.map +1 -1
  34. package/lib/catalog/seed/expense/category.entity.d.ts +2 -2
  35. package/lib/catalog/seed/expense/category.entity.js +6 -6
  36. package/lib/catalog/seed/expense/category.entity.js.map +1 -1
  37. package/lib/index.d.ts +2 -2
  38. package/lib/index.js +2 -2
  39. package/lib/index.js.map +1 -1
  40. package/lib/profile/agent/agent.entity.d.ts +13 -4
  41. package/lib/profile/agent/agent.entity.js +46 -20
  42. package/lib/profile/agent/agent.entity.js.map +1 -1
  43. package/lib/profile/agent/asset.entity.d.ts +1 -1
  44. package/lib/profile/agent/asset.entity.js +2 -2
  45. package/lib/profile/agent/asset.entity.js.map +1 -1
  46. package/lib/profile/agent/payout.entity.d.ts +3 -3
  47. package/lib/profile/agent/payout.entity.js +6 -6
  48. package/lib/profile/agent/payout.entity.js.map +1 -1
  49. package/lib/profile/agent/promotion.entity.d.ts +3 -3
  50. package/lib/profile/agent/promotion.entity.js +6 -6
  51. package/lib/profile/agent/promotion.entity.js.map +1 -1
  52. package/lib/profile/company/company.entity.d.ts +80 -9
  53. package/lib/profile/company/company.entity.js +246 -36
  54. package/lib/profile/company/company.entity.js.map +1 -1
  55. package/lib/profile/company/course/appointment.entity.d.ts +73 -4
  56. package/lib/profile/company/course/appointment.entity.js +247 -0
  57. package/lib/profile/company/course/appointment.entity.js.map +1 -1
  58. package/lib/profile/company/course/course.entity.d.ts +41 -8
  59. package/lib/profile/company/course/course.entity.js +58 -12
  60. package/lib/profile/company/course/course.entity.js.map +1 -1
  61. package/lib/profile/company/course/lesson.entity.d.ts +30 -7
  62. package/lib/profile/company/course/lesson.entity.js +93 -12
  63. package/lib/profile/company/course/lesson.entity.js.map +1 -1
  64. package/lib/profile/company/course/schedule.entity.d.ts +276 -0
  65. package/lib/profile/company/course/schedule.entity.js +744 -0
  66. package/lib/profile/company/course/schedule.entity.js.map +1 -0
  67. package/lib/profile/company/course/topic.entity.d.ts +9 -4
  68. package/lib/profile/company/course/topic.entity.js +14 -7
  69. package/lib/profile/company/course/topic.entity.js.map +1 -1
  70. package/lib/profile/company/finances/billing/bill.entity.d.ts +9 -2
  71. package/lib/profile/company/finances/billing/bill.entity.js +38 -4
  72. package/lib/profile/company/finances/billing/bill.entity.js.map +1 -1
  73. package/lib/profile/company/finances/billing/item.entity.d.ts +8 -3
  74. package/lib/profile/company/finances/billing/item.entity.js +10 -6
  75. package/lib/profile/company/finances/billing/item.entity.js.map +1 -1
  76. package/lib/profile/company/finances/billing/transaction.entity.d.ts +7 -5
  77. package/lib/profile/company/finances/billing/transaction.entity.js +6 -6
  78. package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -1
  79. package/lib/profile/company/finances/expense/category.entity.d.ts +1 -1
  80. package/lib/profile/company/finances/expense/category.entity.js +4 -4
  81. package/lib/profile/company/finances/expense/category.entity.js.map +1 -1
  82. package/lib/profile/company/finances/expense/expense.entity.d.ts +6 -2
  83. package/lib/profile/company/finances/expense/expense.entity.js +32 -4
  84. package/lib/profile/company/finances/expense/expense.entity.js.map +1 -1
  85. package/lib/profile/company/finances/handover/handover.entity.d.ts +3 -3
  86. package/lib/profile/company/finances/handover/handover.entity.js +6 -6
  87. package/lib/profile/company/finances/handover/handover.entity.js.map +1 -1
  88. package/lib/profile/company/finances/invoice/invoice.entity.d.ts +8 -7
  89. package/lib/profile/company/finances/invoice/invoice.entity.js +15 -14
  90. package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -1
  91. package/lib/profile/company/finances/invoice/item.entity.d.ts +2 -2
  92. package/lib/profile/company/finances/invoice/item.entity.js +4 -4
  93. package/lib/profile/company/finances/invoice/item.entity.js.map +1 -1
  94. package/lib/profile/company/finances/payment/method.entity.d.ts +24 -4
  95. package/lib/profile/company/finances/payment/method.entity.js +40 -5
  96. package/lib/profile/company/finances/payment/method.entity.js.map +1 -1
  97. package/lib/profile/company/instructor/activity.entity.js.map +1 -1
  98. package/lib/profile/company/instructor/calendar-state.entity.js.map +1 -1
  99. package/lib/profile/company/instructor/instructor.entity.d.ts +34 -17
  100. package/lib/profile/company/instructor/instructor.entity.js +143 -25
  101. package/lib/profile/company/instructor/instructor.entity.js.map +1 -1
  102. package/lib/profile/company/instructor/task.entity.d.ts +2 -1
  103. package/lib/profile/company/instructor/task.entity.js +9 -4
  104. package/lib/profile/company/instructor/task.entity.js.map +1 -1
  105. package/lib/profile/company/medical/examination.entity.d.ts +4 -4
  106. package/lib/profile/company/medical/examination.entity.js +6 -6
  107. package/lib/profile/company/medical/examination.entity.js.map +1 -1
  108. package/lib/profile/company/medical/product.entity.d.ts +4 -5
  109. package/lib/profile/company/medical/product.entity.js +13 -14
  110. package/lib/profile/company/medical/product.entity.js.map +1 -1
  111. package/lib/profile/company/product/addon.entity.d.ts +3 -3
  112. package/lib/profile/company/product/addon.entity.js +6 -7
  113. package/lib/profile/company/product/addon.entity.js.map +1 -1
  114. package/lib/profile/company/product/priceplan.entity.d.ts +15 -13
  115. package/lib/profile/company/product/priceplan.entity.js +20 -16
  116. package/lib/profile/company/product/priceplan.entity.js.map +1 -1
  117. package/lib/profile/company/product/product.entity.d.ts +34 -8
  118. package/lib/profile/company/product/product.entity.js +70 -12
  119. package/lib/profile/company/product/product.entity.js.map +1 -1
  120. package/lib/profile/company/product/vehicle.entity.d.ts +2 -2
  121. package/lib/profile/company/product/vehicle.entity.js +4 -4
  122. package/lib/profile/company/product/vehicle.entity.js.map +1 -1
  123. package/lib/profile/instructor/instructor.entity.d.ts +6 -3
  124. package/lib/profile/instructor/instructor.entity.js +31 -9
  125. package/lib/profile/instructor/instructor.entity.js.map +1 -1
  126. package/lib/profile/student/program/licence/licence.entity.d.ts +13 -5
  127. package/lib/profile/student/program/licence/licence.entity.js +19 -8
  128. package/lib/profile/student/program/licence/licence.entity.js.map +1 -1
  129. package/lib/profile/student/program/medical/certificate.entity.d.ts +3 -3
  130. package/lib/profile/student/program/medical/certificate.entity.js +6 -6
  131. package/lib/profile/student/program/medical/certificate.entity.js.map +1 -1
  132. package/lib/profile/student/program/medical/examination.entity.d.ts +4 -4
  133. package/lib/profile/student/program/medical/examination.entity.js +14 -14
  134. package/lib/profile/student/program/medical/examination.entity.js.map +1 -1
  135. package/lib/profile/student/program/program.entity.d.ts +4 -4
  136. package/lib/profile/student/program/program.entity.js +8 -13
  137. package/lib/profile/student/program/program.entity.js.map +1 -1
  138. package/lib/profile/student/program/training/appointment.entity.d.ts +32 -9
  139. package/lib/profile/student/program/training/appointment.entity.js +144 -21
  140. package/lib/profile/student/program/training/appointment.entity.js.map +1 -1
  141. package/lib/profile/student/program/training/exam.entity.d.ts +9 -2
  142. package/lib/profile/student/program/training/exam.entity.js +28 -12
  143. package/lib/profile/student/program/training/exam.entity.js.map +1 -1
  144. package/lib/profile/student/program/training/lesson.entity.d.ts +8 -3
  145. package/lib/profile/student/program/training/lesson.entity.js +28 -6
  146. package/lib/profile/student/program/training/lesson.entity.js.map +1 -1
  147. package/lib/profile/student/program/training/request.entity.d.ts +6 -3
  148. package/lib/profile/student/program/training/request.entity.js +26 -5
  149. package/lib/profile/student/program/training/request.entity.js.map +1 -1
  150. package/lib/profile/student/program/training/topic.entity.d.ts +16 -4
  151. package/lib/profile/student/program/training/topic.entity.js +36 -9
  152. package/lib/profile/student/program/training/topic.entity.js.map +1 -1
  153. package/lib/profile/student/program/training/training.entity.d.ts +50 -6
  154. package/lib/profile/student/program/training/training.entity.js +217 -33
  155. package/lib/profile/student/program/training/training.entity.js.map +1 -1
  156. package/lib/profile/student/program/training/transaction.entity.d.ts +8 -3
  157. package/lib/profile/student/program/training/transaction.entity.js +43 -6
  158. package/lib/profile/student/program/training/transaction.entity.js.map +1 -1
  159. package/lib/profile/student/student.entity.d.ts +11 -6
  160. package/lib/profile/student/student.entity.js +59 -11
  161. package/lib/profile/student/student.entity.js.map +1 -1
  162. package/lib/system/campaign/campaign.entity.d.ts +4 -4
  163. package/lib/system/campaign/campaign.entity.js +10 -10
  164. package/lib/system/campaign/campaign.entity.js.map +1 -1
  165. package/lib/system/campaign/gifcode.entity.d.ts +4 -4
  166. package/lib/system/campaign/gifcode.entity.js +8 -8
  167. package/lib/system/campaign/gifcode.entity.js.map +1 -1
  168. package/lib/system/country/country.entity.d.ts +8 -6
  169. package/lib/system/country/country.entity.js +15 -9
  170. package/lib/system/country/country.entity.js.map +1 -1
  171. package/lib/system/currency/currency.entity.d.ts +1 -1
  172. package/lib/system/currency/currency.entity.js +4 -4
  173. package/lib/system/currency/currency.entity.js.map +1 -1
  174. package/lib/system/driving/category.entity.d.ts +7 -7
  175. package/lib/system/driving/category.entity.js +14 -14
  176. package/lib/system/driving/category.entity.js.map +1 -1
  177. package/lib/system/driving/vehicle.entity.d.ts +2 -2
  178. package/lib/system/driving/vehicle.entity.js +4 -4
  179. package/lib/system/driving/vehicle.entity.js.map +1 -1
  180. package/lib/system/event/event.entity.d.ts +2 -2
  181. package/lib/system/event/event.entity.js +4 -4
  182. package/lib/system/event/event.entity.js.map +1 -1
  183. package/lib/system/event/log.entity.d.ts +2 -2
  184. package/lib/system/event/log.entity.js +3 -3
  185. package/lib/system/event/log.entity.js.map +1 -1
  186. package/lib/system/ical/ical.entity.d.ts +63 -0
  187. package/lib/system/ical/ical.entity.js +70 -0
  188. package/lib/system/ical/ical.entity.js.map +1 -0
  189. package/lib/system/policy/policy.entity.d.ts +2 -2
  190. package/lib/system/policy/policy.entity.js +8 -8
  191. package/lib/system/policy/policy.entity.js.map +1 -1
  192. package/lib/system/staff/staff.entity.d.ts +1 -1
  193. package/lib/system/staff/staff.entity.js +5 -4
  194. package/lib/system/staff/staff.entity.js.map +1 -1
  195. package/lib/tsconfig.tsbuildinfo +1 -1
  196. package/lib/user/alert.entity.d.ts +4 -3
  197. package/lib/user/alert.entity.js +11 -4
  198. package/lib/user/alert.entity.js.map +1 -1
  199. package/lib/user/blocked.entity.js +2 -2
  200. package/lib/user/blocked.entity.js.map +1 -1
  201. package/lib/user/device.entity.d.ts +17 -2
  202. package/lib/user/device.entity.js +29 -3
  203. package/lib/user/device.entity.js.map +1 -1
  204. package/lib/user/notification.entity.d.ts +3 -3
  205. package/lib/user/notification.entity.js +8 -8
  206. package/lib/user/notification.entity.js.map +1 -1
  207. package/lib/user/ticket.entity.d.ts +8 -3
  208. package/lib/user/ticket.entity.js +16 -7
  209. package/lib/user/ticket.entity.js.map +1 -1
  210. package/lib/user/user.entity.d.ts +101 -89
  211. package/lib/user/user.entity.js +272 -270
  212. package/lib/user/user.entity.js.map +1 -1
  213. package/lib/user/verification.entity.js +2 -2
  214. package/lib/user/verification.entity.js.map +1 -1
  215. package/lib/utils/activity.helper.d.ts +2 -2
  216. package/lib/utils/activity.helper.js.map +1 -1
  217. package/lib/utils/trackable.d.ts +13 -2
  218. package/lib/utils/trackable.js +55 -0
  219. package/lib/utils/trackable.js.map +1 -1
  220. package/package.json +3 -3
@@ -0,0 +1,744 @@
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.CompanyCourseScheduleEntity = void 0;
13
+ const common_1 = require("@driveup/common");
14
+ const shared_1 = require("@driveup/shared");
15
+ const luxon_1 = require("luxon");
16
+ const typeorm_1 = require("typeorm");
17
+ const activity_helper_1 = require("../../../utils/activity.helper");
18
+ const trackable_1 = require("../../../utils/trackable");
19
+ const appointment_entity_1 = require("../../student/program/training/appointment.entity");
20
+ const instructor_entity_1 = require("../instructor/instructor.entity");
21
+ const lesson_entity_1 = require("./lesson.entity");
22
+ /**
23
+ * Represents a series of training appointment offers managed by the company.
24
+ *
25
+ * This entity defines appointment templates that serve as available time slots
26
+ * for student training sessions. Companies manage these appointments to organize
27
+ * their course training schedules, which students can then book.
28
+ *
29
+ * Supports both single and recurring appointments with flexible scheduling options
30
+ * including:
31
+ * - Weekly repetitions on specific weekdays
32
+ * - Custom date ranges for recurring appointments
33
+ * - Exception handling for skipped dates
34
+ * - Per-date overrides for time, instructor, and duration
35
+ *
36
+ * @remarks
37
+ * This is a company-managed entity that creates the foundation for student
38
+ * training bookings. Each appointment definition can generate multiple actual
39
+ * student appointments based on its repetition settings.
40
+ *
41
+ * @see {@link CompanyCourseLessonEntity} for the associated course lesson
42
+ * @see {@link StudentTrainingEntity} for student bookings
43
+ */
44
+ let CompanyCourseScheduleEntity = class CompanyCourseScheduleEntity extends trackable_1.TrackableEntity {
45
+ /**
46
+ * Creates a new CompanyCourseScheduleEntity instance
47
+ * @param props - Partial properties to initialize the entity with
48
+ */
49
+ constructor(props) {
50
+ super();
51
+ Object.assign(this, props);
52
+ }
53
+ /**
54
+ * Converts the entity to a RecurringAppointment model instance
55
+ * @returns Promise resolving to RecurringAppointment model with lesson, instructor, and scheduling details
56
+ */
57
+ async toModel() {
58
+ const lesson = this.lessonId ? (await this.lesson).toSummary() : null;
59
+ const instructor = this.instructorId ? await (await this.instructor).toSummary() : null;
60
+ return new common_1.RecurringAppointment({
61
+ id: this.id,
62
+ lesson: lesson,
63
+ instructor: instructor,
64
+ startDate: this.startDate,
65
+ endDate: this.endDate,
66
+ duration: this.duration,
67
+ repetition: this.repetition,
68
+ weekdays: this.weekdays,
69
+ skippedDates: this.skippedDates,
70
+ updates: this.updates,
71
+ instructors: this.instructors,
72
+ durations: this.durations
73
+ });
74
+ }
75
+ /**
76
+ * Returns a summary representation of the appointment
77
+ * @returns Promise resolving to RecurringAppointment model (same as toModel())
78
+ */
79
+ async toSummary() {
80
+ return await this.toModel();
81
+ }
82
+ /**
83
+ * Retrieves all tracked activities for this appointment
84
+ * Includes creation and update timestamps and associated users
85
+ * @returns Promise resolving to array of Activity objects filtered to exclude null values
86
+ */
87
+ async getActivities() {
88
+ const activities = [];
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));
91
+ return activities.filter(a => a);
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 getLesson() {
102
+ return await this.lesson;
103
+ }
104
+ async getInstructor() {
105
+ return await this.instructor;
106
+ }
107
+ async getInstructorByDate(date) {
108
+ const d = this.instructors?.find(i => i.date === date);
109
+ return d?.id ? await instructor_entity_1.CompanyInstructorEntity.findOneBy({ id: d.id }) : null;
110
+ }
111
+ /************************* Manage student appointments *************************/
112
+ /**
113
+ * Get list of related student training appointments, which's training is not terminated
114
+ * @param date Date - defaulted to this.startDate - Must be provided for flexible course appointments
115
+ * @returns StudentTrainingAppointmentEntity[]
116
+ */
117
+ async getStudentAppointments(date = this.startDate) {
118
+ const course = await (await this.lesson).course;
119
+ if (!course.isFixed && !date) {
120
+ return [];
121
+ }
122
+ return await appointment_entity_1.StudentTrainingAppointmentEntity.createQueryBuilder('ta') // training appointment
123
+ .innerJoin('ta.training', 't') // training
124
+ .where('ta.scheduleId = :id', { id: this.id })
125
+ .andWhere('ta.startDate = :date', { date: date })
126
+ .andWhere('t.status != :terminatedStatus', { terminatedStatus: shared_1.StatusType.Terminated })
127
+ .getMany();
128
+ }
129
+ /**
130
+ * Get total number of students who attended the appointment in the given date
131
+ * @param date Date - defaulted to this.startDate - Must be provided for flexible course appointments
132
+ */
133
+ async getTotalAttended(date = this.startDate) {
134
+ const course = await (await this.lesson).course;
135
+ if (!course.isFixed && !date) {
136
+ return null;
137
+ }
138
+ return await appointment_entity_1.StudentTrainingAppointmentEntity.countBy({
139
+ scheduleId: this.id,
140
+ startDate: date,
141
+ attended: true
142
+ });
143
+ }
144
+ /**
145
+ * Get total number of students who where absent in the appointment in the given date
146
+ * @param date Date - defaulted to this.startDate - Must be provided for flexible course appointments
147
+ */
148
+ async getTotalAbsent(date = this.startDate) {
149
+ const course = await (await this.lesson).course;
150
+ if (!course.isFixed && !date) {
151
+ return null;
152
+ }
153
+ return await appointment_entity_1.StudentTrainingAppointmentEntity.countBy({
154
+ scheduleId: this.id,
155
+ startDate: date,
156
+ attended: false
157
+ });
158
+ }
159
+ /**
160
+ * Get the count of taken seats for this appointment
161
+ * - Only applicable for preparation catalog type courses. Returns null for other catalog types.
162
+ * @param startDate Date - Optional - Only send for flexible courses to specify the desired appointment's startDate
163
+ * @returns number - count of registered student appointments for this appointment
164
+ */
165
+ async getTakenSeats(startDate) {
166
+ const course = await this.getCourse();
167
+ const product = await course.product;
168
+ if (product.catalogType !== shared_1.CatalogType.Preparation) {
169
+ return null;
170
+ }
171
+ const count = await appointment_entity_1.StudentTrainingAppointmentEntity.countBy({
172
+ scheduleId: this.id,
173
+ startDate: startDate ?? this.startDate
174
+ });
175
+ return count;
176
+ }
177
+ /**
178
+ * Get the count of present students for this appointment
179
+ * - Only applicable for preparation catalog type courses. Returns null for other catalog types.
180
+ * @param startDate Date - Optional - Only send for flexible courses to specify the desired appointment's startDate
181
+ * @returns number - count of attended student appointments for this appointment
182
+ */
183
+ async getTotalPresentStudents(startDate) {
184
+ const course = await this.getCourse();
185
+ const product = await course.product;
186
+ if (product.catalogType !== shared_1.CatalogType.Preparation) {
187
+ return null;
188
+ }
189
+ const count = await appointment_entity_1.StudentTrainingAppointmentEntity.countBy({
190
+ scheduleId: this.id,
191
+ startDate: startDate ?? this.startDate,
192
+ attended: true
193
+ });
194
+ return count;
195
+ }
196
+ /************************* Flexible courses *************************/
197
+ /**
198
+ * Finds if there is an appointment in the given date (checking all of the updates), and returning it if is found
199
+ * @param date Date - the date to check if belongs to an existing appointment
200
+ * @returns Appointment if an appointment is found in the given date, null otherwise
201
+ */
202
+ async getAppointment(date) {
203
+ // Note: other parts of the app depend on this method returning the instructor
204
+ // do not remove unless the dependencies are covered
205
+ // step 0 : prepare local variables
206
+ date = new Date(date);
207
+ let appointmentDate = luxon_1.DateTime.fromJSDate(date);
208
+ // step 1 : manage single appointment
209
+ if (!this.repetition) {
210
+ // if the start date matches the given date, return appointment information
211
+ // otherwise, appointment is not found
212
+ if (this.startDate.getTime() === date.getTime()) {
213
+ const instructor = await this.getAppointmentInstructor(appointmentDate);
214
+ const endDate = luxon_1.DateTime.fromJSDate(this.startDate)
215
+ .plus({ minutes: this.duration })
216
+ .toJSDate();
217
+ return new common_1.Appointment({
218
+ id: this.id,
219
+ startDate: this.startDate,
220
+ endDate,
221
+ instructor: instructor
222
+ });
223
+ }
224
+ return null;
225
+ }
226
+ // step 2 : make sure the date is inside the definition's time frame
227
+ if (date < this.startDate || (this.endDate && date > this.endDate)) {
228
+ return null;
229
+ }
230
+ // step 3 : check if the weekday of the given date, is one of the weekdays of the series
231
+ const weekdayMatches = this.weekdays.some(i => appointmentDate.weekday === common_1.DateHelper.getWeekdayNumber(i));
232
+ if (!weekdayMatches) {
233
+ return null;
234
+ }
235
+ // step 4 : check for updates in the time of the appointment
236
+ // if an update is made, then the given date doesn't point to an existing appointment
237
+ appointmentDate = this.getUpdatedDate(appointmentDate);
238
+ if (appointmentDate.toJSDate().getTime() !== date.getTime()) {
239
+ return null;
240
+ }
241
+ // step 5 : check if the appointment is deleted
242
+ const isDeleted = this.isDateSkipped(appointmentDate);
243
+ if (isDeleted) {
244
+ return null;
245
+ }
246
+ // step 6 : get the appointment instructor
247
+ const instructor = await this.getAppointmentInstructor(appointmentDate);
248
+ // step 7 : get the appointment duration and calculate the endDate
249
+ const appointmentDuration = this.getAppointmentDuration(appointmentDate);
250
+ const endDate = appointmentDate.plus({ minutes: appointmentDuration });
251
+ return new common_1.Appointment({
252
+ id: this.id,
253
+ startDate: appointmentDate.toJSDate(),
254
+ endDate: endDate.toJSDate(),
255
+ instructor: instructor
256
+ });
257
+ }
258
+ /**
259
+ * Load all appointments of the definition within the given period
260
+ * @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.
261
+ * @param period Period
262
+ * @param instructorIds number[] - instructorId to filter by (return only appointments related to this instructor id)
263
+ * @param searchPhrase string - optional search phrase to filter appointments by (course title / part title / registered student name)
264
+ * @returns All appointments of the definition within the given period, filtered by instructorId if provided
265
+ */
266
+ async getAppointments(period, instructorIds, searchPhrase) {
267
+ // check if course if flexible
268
+ const lesson = await lesson_entity_1.CompanyCourseLessonEntity.findOneBy({ id: this.lessonId });
269
+ const course = await lesson.course;
270
+ if (course.isFixed)
271
+ return [];
272
+ // step 0 : prepare local variables
273
+ period.startDate = new Date(period.startDate);
274
+ period.endDate = new Date(period.endDate);
275
+ const appointments = [];
276
+ // step 1 : get first appointment date
277
+ // if there is no match for given period, first appointment is not found
278
+ // if not found, return empty array (not appointments)
279
+ let current = this.getFirstAppointmentDateInPeriod(period);
280
+ if (!current)
281
+ return [];
282
+ if (current.toJSDate() > period.endDate ||
283
+ (this.endDate && current.toJSDate() > this.endDate))
284
+ return [];
285
+ // step 2 : from the first appointment and forward
286
+ // 1 -> set appointment information (and check for filtered instructor)
287
+ // 2 -> check if there is a filter by course title / part title / student name required and apply if so
288
+ // 3 -> push to the appointments array
289
+ // 4 -> find the next appointment date "inside the given period"
290
+ // repeat the process
291
+ let appointment = await this.getAppointmentInformation(current, instructorIds);
292
+ if (appointment) {
293
+ if (searchPhrase) {
294
+ const isMatch = lesson.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
295
+ course.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
296
+ (await this.isStudentRegistered(appointment, searchPhrase));
297
+ if (isMatch) {
298
+ appointments.push(appointment);
299
+ }
300
+ }
301
+ else {
302
+ appointments.push(appointment);
303
+ }
304
+ }
305
+ current = this.getNextAppointmentDate(current);
306
+ if (!current) {
307
+ return appointments;
308
+ }
309
+ while (current.toJSDate() <= period.endDate &&
310
+ (!this.endDate || current.toJSDate() <= this.endDate)) {
311
+ appointment = await this.getAppointmentInformation(current, instructorIds);
312
+ if (appointment) {
313
+ if (searchPhrase) {
314
+ const isMatch = lesson.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
315
+ course.title.toLowerCase().includes(searchPhrase.toLowerCase()) ||
316
+ (await this.isStudentRegistered(appointment, searchPhrase));
317
+ if (isMatch) {
318
+ appointments.push(appointment);
319
+ }
320
+ }
321
+ else {
322
+ appointments.push(appointment);
323
+ }
324
+ }
325
+ current = this.getNextAppointmentDate(current);
326
+ }
327
+ // step 3 : when no more appointments are found inside the given period
328
+ // return the found appointments
329
+ return appointments;
330
+ }
331
+ /**
332
+ * Check if there is one appointment with empty seats
333
+ *
334
+ * If the definition has no appointments in the given period, returns true.
335
+ * Since the functions is supposed to return wether any of the definition's appointments have empty seats
336
+ */
337
+ async hasAppointmentWithEmptySeats(period) {
338
+ // step 0 : prepare local variables
339
+ period.startDate = new Date(period.startDate);
340
+ period.endDate = new Date(period.endDate);
341
+ // step 1 : get first appointment date
342
+ // if there is no match for given period, first appointment is not found
343
+ // if not found, return empty array (not appointments)
344
+ let current = this.getFirstAppointmentDateInPeriod(period);
345
+ if (!current) {
346
+ return true;
347
+ }
348
+ if (current.toJSDate() > period.endDate ||
349
+ (this.endDate && current.toJSDate() > this.endDate)) {
350
+ return true;
351
+ }
352
+ // step 2 : from the first appointment and forward
353
+ // 1 -> set appointment information (and check for filtered instructor)
354
+ // 2 -> if appointment is found, and there are remaining seats, return true
355
+ // 3 -> find the next appointment date "inside the given period"
356
+ // repeat the process
357
+ let appointment = await this.getAppointmentInformation(current);
358
+ if (appointment) {
359
+ const remainingSeats = await this.getRemainingSeats(current.toJSDate());
360
+ if (remainingSeats > 0) {
361
+ return true;
362
+ }
363
+ }
364
+ current = this.getNextAppointmentDate(current);
365
+ if (!current) {
366
+ return false;
367
+ }
368
+ while (current.toJSDate() <= period.endDate &&
369
+ (!this.endDate || current.toJSDate() <= this.endDate)) {
370
+ appointment = await this.getAppointmentInformation(current);
371
+ if (appointment) {
372
+ const remainingSeats = await this.getRemainingSeats(current.toJSDate());
373
+ if (remainingSeats > 0) {
374
+ return true;
375
+ }
376
+ }
377
+ current = this.getNextAppointmentDate(current);
378
+ }
379
+ return false;
380
+ }
381
+ /**
382
+ *
383
+ * @param period Period
384
+ * @returns DateTime if a first appointment is found, null otherwise
385
+ */
386
+ getFirstAppointmentDateInPeriod(period) {
387
+ // if this is a single appointment
388
+ // only check if the definition's start date is within the given period
389
+ if (!this.repetition) {
390
+ if (common_1.DateHelper.isBetween(this.startDate, period.startDate, period.endDate)) {
391
+ return luxon_1.DateTime.fromJSDate(this.startDate);
392
+ }
393
+ return null;
394
+ }
395
+ // check if given period contains some/all of the definition's start and end date
396
+ const periodMatches = common_1.DateHelper.isBetween(this.startDate, period.startDate, period.endDate) ||
397
+ (this.startDate <= period.endDate &&
398
+ (!this.endDate || this.endDate >= period.startDate));
399
+ if (!periodMatches)
400
+ return null;
401
+ const defStart = luxon_1.DateTime.fromJSDate(this.startDate);
402
+ // get the greater from period start date and definition start date
403
+ // to start counting days from that point forward
404
+ let date = period.startDate > this.startDate ? luxon_1.DateTime.fromJSDate(period.startDate) : defStart;
405
+ date = date.set({
406
+ hour: defStart.hour,
407
+ minute: defStart.minute,
408
+ second: defStart.second,
409
+ millisecond: defStart.millisecond
410
+ });
411
+ // weekdays: sorted array of WeekdayNumbers
412
+ const weekdays = this.weekdays
413
+ .map(i => common_1.DateHelper.getWeekdayNumber(i))
414
+ .sort((a, b) => a - b);
415
+ if (this.repetition && !weekdays?.length) {
416
+ // to avoid infinite loop, if the definition is repeated, but somehow no weekdays are assigned, return null
417
+ return null;
418
+ }
419
+ // find the first valid appointment date considering weekdays, updates, and skipped dates
420
+ while (!this.endDate || date.toJSDate() <= this.endDate) {
421
+ if (weekdays.includes(common_1.DateHelper.toWeekdayNumber(date.weekday))) {
422
+ const updatedDate = this.getUpdatedDate(date);
423
+ if (!this.isDateSkipped(updatedDate)) {
424
+ return updatedDate;
425
+ }
426
+ }
427
+ // move to the next day
428
+ date = date.plus({ days: 1 });
429
+ }
430
+ return null;
431
+ }
432
+ /**
433
+ * @description Get detailed information about an appointment
434
+ * @param date - DateTime - is presumed to be related to an appointment in this definition
435
+ * @param filteredInstructorIds - number - optional - instrucotr id to filter the appointment by
436
+ * @returns Appointment - appointment information (id, start and end date, instructor information)
437
+ */
438
+ async getAppointmentInformation(date, filteredInstructorIds) {
439
+ date = this.getUpdatedDate(date);
440
+ const isDeleted = this.isDateSkipped(date);
441
+ if (isDeleted)
442
+ return null;
443
+ const instructorId = this.getAppointmentInstructorId(date);
444
+ if (filteredInstructorIds?.length && !filteredInstructorIds.includes(instructorId))
445
+ return null;
446
+ const instructor = await this.getInstructorById(instructorId);
447
+ const duration = this.getAppointmentDuration(date);
448
+ const endDate = date.plus({ minutes: duration });
449
+ const appointment = new common_1.Appointment({
450
+ id: this.id,
451
+ startDate: date.toJSDate(),
452
+ endDate: endDate.toJSDate(),
453
+ instructor: instructor
454
+ });
455
+ return appointment;
456
+ }
457
+ /**
458
+ * @description Only for repeted definitions (repetition = true)
459
+ * @description Finds the final date of the appointment, considering any date updates (updates in the startDate)
460
+ * @description If no date updates are found, the original date will be returned
461
+ * @param date DateTime - original date of the appointment (default return value, if no date updates are found)
462
+ * @returns DateTime - final date of the appointment
463
+ */
464
+ getUpdatedDate(date) {
465
+ if (!this.updates?.length)
466
+ return date;
467
+ let updates = this.updates.map(i => {
468
+ return {
469
+ from: new Date(i.from),
470
+ to: new Date(i.to)
471
+ };
472
+ });
473
+ updates = updates.filter(i => i.from.getTime() === date.toJSDate().getTime());
474
+ if (!updates?.length) {
475
+ return date;
476
+ }
477
+ return common_1.DateHelper.toDateTimeInstance(common_1.ArrayHelper.getLastItem(updates).to);
478
+ }
479
+ /**
480
+ * @description Only for repeted definitions (repetition = true)
481
+ * @description Checks wether or not the appointment related to the given date has been removed from schedule (pushed in the skippedDates array)
482
+ * @param date DateTime - date of the appointment
483
+ * @returns DateTime - true if the appointment is skipped, false otherwise
484
+ */
485
+ isDateSkipped(date) {
486
+ if (!this.skippedDates?.length)
487
+ return false;
488
+ const exists = this.skippedDates.some(i => new Date(i).getTime() === date.toJSDate().getTime());
489
+ return exists;
490
+ }
491
+ /**
492
+ * @description Only for repeted definitions (repetition = true)
493
+ * @description Finds the final duration of the appointment, considering any duration updates
494
+ * @description If no duration updates are found, this.duration will be returned by default
495
+ * @param date DateTime - date of the appointment
496
+ * @returns number - duration of the appointment (in minutes)
497
+ */
498
+ getAppointmentDuration(date) {
499
+ if (!this.durations?.length)
500
+ return this.duration;
501
+ const durations = this.durations.filter(i => new Date(i.date).getTime() === date.toJSDate().getTime());
502
+ if (!durations?.length)
503
+ return this.duration;
504
+ return common_1.ArrayHelper.getLastItem(durations).duration;
505
+ }
506
+ /**
507
+ * @description Checks weather or not there is a student with a matching name registered in this schedule for the given appointment
508
+ * @description Currently only works for flexible course trainings (MVP logic), and will always return false for fixed course trainings
509
+ * 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
510
+ * @param appointment Appointment - appointment to check for registered students
511
+ * @param studentName string - name of the student to check for registration
512
+ * @returns boolean - Weather or not there a student with the given name registered for the appointment
513
+ */
514
+ async isStudentRegistered(appointment, studentName) {
515
+ const course = await this.getCourse();
516
+ return await appointment_entity_1.StudentTrainingAppointmentEntity
517
+ .createQueryBuilder('a')
518
+ .innerJoin('a.training', 't')
519
+ .innerJoin('t.course', 'c')
520
+ .where('c.id = :courseid', { courseId: course.id })
521
+ .andWhere('c.isFixed = :false', { false: false })
522
+ .andWhere('a.lessonId = :lessonId', { lessonId: this.lessonId })
523
+ .andWhere('a.scheduleId = :scheduleId', { scheduleId: this.id })
524
+ .andWhere('a.startDate = :startDate', { startDate: appointment.startDate })
525
+ .andWhere(`t.studentSnapshot ->> '$.name' like :studentname`, { studentname: `%${studentName}%` })
526
+ .getExists();
527
+ }
528
+ /**
529
+ * @description Doesn't check for the definition's endDate, or updates and skippedDates
530
+ * @returns the next appointment based on repetition logic and weekdays assigned
531
+ */
532
+ getNextAppointmentDate(date) {
533
+ if (!this.weekdays?.length)
534
+ return null;
535
+ const startDate = common_1.DateHelper.toDateTimeInstance(this.startDate);
536
+ // after going to the next day, set the time to the startDate's time
537
+ // since the param date can be the last appointment's date, and the last appointment's time could've been updated
538
+ date = date.plus({ days: 1 }).set({
539
+ hour: startDate.hour,
540
+ minute: startDate.minute,
541
+ second: startDate.second,
542
+ millisecond: startDate.millisecond
543
+ });
544
+ // weekdays: sorted array of WeekdayNumbers
545
+ const weekdays = this.weekdays
546
+ .map(i => common_1.DateHelper.getWeekdayNumber(i))
547
+ .sort((a, b) => a - b);
548
+ while (!weekdays.includes(common_1.DateHelper.toWeekdayNumber(date.weekday))) {
549
+ date = date.plus({ days: 1 }).set({
550
+ hour: startDate.hour,
551
+ minute: startDate.minute,
552
+ second: startDate.second,
553
+ millisecond: startDate.millisecond
554
+ });
555
+ }
556
+ return date;
557
+ }
558
+ /**
559
+ * Get the instructor registered for the appointment (works for repeated and single appointments)
560
+ * @param date Date - the date of the appointment
561
+ * @returns Instructor - simple instructor model
562
+ */
563
+ async getAppointmentInstructor(date) {
564
+ const instructorId = this.getAppointmentInstructorId(date);
565
+ return await this.getInstructorById(instructorId);
566
+ }
567
+ /**
568
+ * @param date DateTime - is presumed to belong to an existing appointment
569
+ * @returns number - instructor id for the appointment of the given date
570
+ */
571
+ getAppointmentInstructorId(date) {
572
+ if (!this.instructors?.length)
573
+ return this.instructorId;
574
+ const instructors = this.instructors.filter(i => new Date(i.date).getTime() === date.toJSDate().getTime());
575
+ if (!instructors?.length)
576
+ return this.instructorId;
577
+ return common_1.ArrayHelper.getLastItem(instructors).id;
578
+ }
579
+ /**
580
+ * Find instructor by id and map with simple information to User model
581
+ * @param id instructor id
582
+ * @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
583
+ */
584
+ async getInstructorById(id) {
585
+ const companyInstructor = await instructor_entity_1.CompanyInstructorEntity.findOneBy({ id });
586
+ if (!companyInstructor)
587
+ return null;
588
+ const instructor = await companyInstructor.instructor;
589
+ const user = await instructor.user;
590
+ return {
591
+ id: companyInstructor.id,
592
+ name: instructor.name,
593
+ image: instructor.imageUrl,
594
+ phone: user.phone,
595
+ role: companyInstructor.role,
596
+ status: companyInstructor.status,
597
+ canReinstate: await companyInstructor.canReinstate(),
598
+ calendarLinks: companyInstructor.calendarLinks || []
599
+ };
600
+ }
601
+ /**
602
+ * Get total number of appointments that have any update (duration/instructor/date) after the given date
603
+ * @param from Date - if null, from definition start date
604
+ * @returns number - total updated appointments
605
+ */
606
+ getTotalUpdatedAppointments(from) {
607
+ if (!from) {
608
+ from = this.startDate;
609
+ }
610
+ const durationExceptions = this.durations?.filter(i => new Date(i.date) > from);
611
+ const updateExceptions = this.updates?.filter(i => new Date(i.from) > from || new Date(i.to) > from);
612
+ const instructorExceptions = this.instructors?.filter(i => new Date(i.date) > from);
613
+ // Collect unique appointment dates that have any exception
614
+ // This is to avoid counting multiple exceptions for the same appointment more than once
615
+ // i.e if an appointment has duration and instructor and date (updates) exceptions, it should be counted once, not three times
616
+ const uniqueExceptionDates = new Set();
617
+ durationExceptions?.forEach(i => {
618
+ uniqueExceptionDates.add(new Date(i.date).toISOString());
619
+ });
620
+ updateExceptions?.forEach(i => {
621
+ uniqueExceptionDates.add(new Date(i.to).toISOString());
622
+ });
623
+ instructorExceptions?.forEach(i => {
624
+ uniqueExceptionDates.add(new Date(i.date).toISOString());
625
+ });
626
+ // Count unique appointments with exceptions
627
+ return uniqueExceptionDates.size;
628
+ }
629
+ async getRemainingSeats(date) {
630
+ const lesson = await lesson_entity_1.CompanyCourseLessonEntity.findOneBy({ id: this.lessonId });
631
+ const course = await lesson.course;
632
+ if (!course.maxStudents)
633
+ return;
634
+ const takenSeats = await this.getTakenSeats(date);
635
+ return +course.maxStudents - (takenSeats || 0);
636
+ }
637
+ /**
638
+ * This method must be called anytime when definition's endDate is changed to a value other than null/undefined
639
+ *
640
+ * Removes all 'updates', 'skippedDates', 'instructors' and 'durations' after the definition's endDate
641
+ *
642
+ * - Does not save the definition
643
+ */
644
+ removeUpdatesAfterEndDate() {
645
+ this.updates = (this.updates ?? []).filter(i => new Date(i.from) <= this.endDate);
646
+ this.skippedDates = (this.skippedDates ?? []).filter(i => new Date(i) <= this.endDate);
647
+ this.instructors = (this.instructors ?? []).filter(i => new Date(i.date) <= this.endDate);
648
+ this.durations = (this.durations ?? []).filter(i => new Date(i.date) <= this.endDate);
649
+ return true;
650
+ }
651
+ };
652
+ exports.CompanyCourseScheduleEntity = CompanyCourseScheduleEntity;
653
+ __decorate([
654
+ (0, typeorm_1.Column)(),
655
+ __metadata("design:type", Number)
656
+ ], CompanyCourseScheduleEntity.prototype, "lessonId", void 0);
657
+ __decorate([
658
+ (0, typeorm_1.Column)({
659
+ nullable: true,
660
+ default: null
661
+ }),
662
+ __metadata("design:type", Number)
663
+ ], CompanyCourseScheduleEntity.prototype, "instructorId", void 0);
664
+ __decorate([
665
+ (0, typeorm_1.Column)(),
666
+ (0, typeorm_1.Generated)('uuid'),
667
+ __metadata("design:type", String)
668
+ ], CompanyCourseScheduleEntity.prototype, "uid", void 0);
669
+ __decorate([
670
+ (0, typeorm_1.Column)(),
671
+ __metadata("design:type", Date)
672
+ ], CompanyCourseScheduleEntity.prototype, "startDate", void 0);
673
+ __decorate([
674
+ (0, typeorm_1.Column)({
675
+ nullable: true,
676
+ default: null
677
+ }),
678
+ __metadata("design:type", Date)
679
+ ], CompanyCourseScheduleEntity.prototype, "endDate", void 0);
680
+ __decorate([
681
+ (0, typeorm_1.Column)({ default: 60 }),
682
+ __metadata("design:type", Number)
683
+ ], CompanyCourseScheduleEntity.prototype, "duration", void 0);
684
+ __decorate([
685
+ (0, typeorm_1.Column)({ default: false }),
686
+ __metadata("design:type", Boolean)
687
+ ], CompanyCourseScheduleEntity.prototype, "repetition", void 0);
688
+ __decorate([
689
+ (0, typeorm_1.Column)({
690
+ type: 'simple-json',
691
+ nullable: true,
692
+ default: null
693
+ }),
694
+ __metadata("design:type", Array)
695
+ ], CompanyCourseScheduleEntity.prototype, "weekdays", void 0);
696
+ __decorate([
697
+ (0, typeorm_1.Column)({
698
+ type: 'simple-json',
699
+ nullable: true,
700
+ default: null
701
+ }),
702
+ __metadata("design:type", Array)
703
+ ], CompanyCourseScheduleEntity.prototype, "skippedDates", void 0);
704
+ __decorate([
705
+ (0, typeorm_1.Column)({
706
+ type: 'simple-json',
707
+ nullable: true,
708
+ default: null
709
+ }),
710
+ __metadata("design:type", Array)
711
+ ], CompanyCourseScheduleEntity.prototype, "updates", void 0);
712
+ __decorate([
713
+ (0, typeorm_1.Column)({
714
+ type: 'simple-json',
715
+ nullable: true,
716
+ default: null
717
+ }),
718
+ __metadata("design:type", Array)
719
+ ], CompanyCourseScheduleEntity.prototype, "instructors", void 0);
720
+ __decorate([
721
+ (0, typeorm_1.Column)({
722
+ type: 'simple-json',
723
+ nullable: true,
724
+ default: null
725
+ }),
726
+ __metadata("design:type", Array)
727
+ ], CompanyCourseScheduleEntity.prototype, "durations", void 0);
728
+ __decorate([
729
+ (0, typeorm_1.ManyToOne)(() => lesson_entity_1.CompanyCourseLessonEntity, lesson => lesson.schedule),
730
+ __metadata("design:type", Promise)
731
+ ], CompanyCourseScheduleEntity.prototype, "lesson", void 0);
732
+ __decorate([
733
+ (0, typeorm_1.ManyToOne)(() => instructor_entity_1.CompanyInstructorEntity, lesson => lesson.companyCourseSchedule),
734
+ __metadata("design:type", Promise)
735
+ ], CompanyCourseScheduleEntity.prototype, "instructor", void 0);
736
+ __decorate([
737
+ (0, typeorm_1.OneToMany)(() => appointment_entity_1.StudentTrainingAppointmentEntity, appointment => appointment.schedule),
738
+ __metadata("design:type", Promise)
739
+ ], CompanyCourseScheduleEntity.prototype, "studentSchedule", void 0);
740
+ exports.CompanyCourseScheduleEntity = CompanyCourseScheduleEntity = __decorate([
741
+ (0, typeorm_1.Entity)('companyCourseSchedules'),
742
+ __metadata("design:paramtypes", [Object])
743
+ ], CompanyCourseScheduleEntity);
744
+ //# sourceMappingURL=schedule.entity.js.map