@driveup/schema 0.1.0

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