@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,501 @@
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.StudentTrainingEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const common_2 = require("@driveup/common");
16
+ const common_3 = require("@driveup/common");
17
+ const invoice_entity_1 = require("../../../company/finances/invoice/invoice.entity");
18
+ const transaction_entity_1 = require("./transaction.entity");
19
+ const instructor_entity_1 = require("../../../company/instructor/instructor.entity");
20
+ const course_entity_1 = require("../../../company/course/course.entity");
21
+ const program_entity_1 = require("../program.entity");
22
+ const lesson_entity_1 = require("./lesson.entity");
23
+ const appointment_entity_1 = require("./appointment.entity");
24
+ const utils_1 = require("../../../../utils");
25
+ let StudentTrainingEntity = class StudentTrainingEntity extends utils_1.TrackableEntity {
26
+ /**
27
+ * Student program
28
+ */
29
+ programId;
30
+ /**
31
+ * Company course
32
+ */
33
+ courseId;
34
+ /**
35
+ * In-charge instructor
36
+ */
37
+ instructorId;
38
+ /**
39
+ * Training status
40
+ */
41
+ status;
42
+ /**
43
+ * Title of the training session
44
+ */
45
+ title;
46
+ /**
47
+ * Detailed description of the training content and objectives
48
+ */
49
+ description;
50
+ /**
51
+ * Company training price
52
+ * Snapshot of the price at the time of training creation
53
+ * For driving training this price represents the driving session price
54
+ */
55
+ price;
56
+ /**
57
+ * Training session duration in minutes
58
+ * For driving training this represents the driving session duration
59
+ * For course training this represents the course lesson duration
60
+ */
61
+ sessionDuration;
62
+ /**
63
+ * Administration fee for this training
64
+ */
65
+ administrationFee;
66
+ /**
67
+ * Total Training cost
68
+ * All training related costs
69
+ */
70
+ cost;
71
+ /**
72
+ * Current training balance
73
+ */
74
+ balance;
75
+ /**
76
+ * The sum of the payments made by student for this training
77
+ */
78
+ paid;
79
+ /**
80
+ * The sum of the discounts applied to this training
81
+ */
82
+ discount;
83
+ /**
84
+ * The sum of the refunds applied to this training
85
+ */
86
+ refund;
87
+ /**
88
+ * Company training location
89
+ * This is a snapshot of the location at the time of training creation
90
+ * For driving tranings this represents the pickup location
91
+ */
92
+ location;
93
+ /**
94
+ * The last viewed lesson by student
95
+ * Resume where they left off
96
+ */
97
+ resentLessonId;
98
+ /**
99
+ * The last viewed topic by student
100
+ * Resume where they left off
101
+ */
102
+ recentTopicId;
103
+ /**
104
+ * Transmission type for driving training
105
+ */
106
+ transmission;
107
+ /**
108
+ * A student profile snapshot details at the time of training creation
109
+ * This data can be managed only by driving school
110
+ */
111
+ studentSnapshoot;
112
+ /**
113
+ * Ratings and reviews given by the student for this training
114
+ */
115
+ ratings;
116
+ /**
117
+ * List of addons used in the training
118
+ */
119
+ addons;
120
+ /**
121
+ * ID of the user who marked this training as completed
122
+ */
123
+ completedBy;
124
+ /**
125
+ * Timestamp when this training was marked as completed
126
+ */
127
+ completedOn;
128
+ /**
129
+ * ID of the user who terminated this training
130
+ */
131
+ terminatedBy;
132
+ /**
133
+ * Timestamp when this training was terminated
134
+ */
135
+ terminatedOn;
136
+ /**
137
+ * Student who is taking the training
138
+ */
139
+ program;
140
+ /**
141
+ * Company course
142
+ * Example: Defensive driving course, First aid course, etc.
143
+ */
144
+ course;
145
+ /**
146
+ * Training in-charge instructor
147
+ */
148
+ instructor;
149
+ /**
150
+ * Student training lessons
151
+ */
152
+ lessons;
153
+ /**
154
+ * Student training appointments
155
+ */
156
+ appointments;
157
+ /**
158
+ * Student training payments
159
+ */
160
+ transactions;
161
+ /**
162
+ * Invoices for this training
163
+ */
164
+ invoices;
165
+ constructor(props) {
166
+ super();
167
+ Object.assign(this, props);
168
+ }
169
+ async toModel() {
170
+ const student = await (await this.getStudent()).toSummary();
171
+ const instructor = this.instructorId ? (await (await this.instructor).toSummary()) : null;
172
+ return new common_1.Training({
173
+ id: this.id,
174
+ student: student,
175
+ instructor: instructor,
176
+ title: this.title,
177
+ description: this.description,
178
+ status: this.status,
179
+ price: this.price,
180
+ sessionDuration: this.sessionDuration,
181
+ administrationFee: this.administrationFee,
182
+ cost: this.cost,
183
+ balance: this.balance,
184
+ paid: this.paid,
185
+ discount: this.discount,
186
+ refund: this.refund,
187
+ location: this.location ? common_2.Address.toInstance(this.location) : null,
188
+ ratings: this.ratings ? this.ratings.map(common_1.Rating.toInstance) : null,
189
+ transmission: this.transmission
190
+ });
191
+ }
192
+ async toSummary() {
193
+ const student = await (await this.getStudent()).toSummary();
194
+ const instructor = this.instructorId ? (await (await this.instructor).toSummary()) : null;
195
+ return new common_1.Training({
196
+ id: this.id,
197
+ student: student,
198
+ instructor: instructor,
199
+ status: this.status,
200
+ transmission: this.transmission
201
+ });
202
+ }
203
+ async toModelWithDetails() {
204
+ const training = await this.toModel();
205
+ // get all apointments notes
206
+ const appointtemnts = await this.appointments;
207
+ training.notes = appointtemnts?.map(a => a.note)?.map(common_1.Note.toInstance);
208
+ // get ratings
209
+ training.ratings = this.ratings?.map(common_1.Rating.toInstance) || null;
210
+ // get addons
211
+ training.addons = this.addons?.map(common_1.AddonUsage.toInstance) || null;
212
+ return training;
213
+ }
214
+ async getStudent() {
215
+ const program = await this.program;
216
+ return await program.getStudent();
217
+ }
218
+ getStudentSnapshot() {
219
+ return new common_1.Student(this.studentSnapshoot);
220
+ }
221
+ async getProgram() {
222
+ return await this.program;
223
+ }
224
+ async getCourse() {
225
+ return await this.course;
226
+ }
227
+ async getCompany() {
228
+ const companyTraining = await this.getCourse();
229
+ return (await companyTraining.product).company;
230
+ }
231
+ async getPaymentTransactions() {
232
+ const total = await transaction_entity_1.StudentTrainingTransactionEntity.sum('amount', {
233
+ trainingId: this.id,
234
+ type: common_3.TransactionType.Payment,
235
+ status: (0, typeorm_1.Not)(common_3.StatusType.Canceled),
236
+ refTransactionId: (0, typeorm_1.IsNull)()
237
+ });
238
+ return total || 0;
239
+ }
240
+ async getCashTransactions() {
241
+ const total = await transaction_entity_1.StudentTrainingTransactionEntity.sum('amount', {
242
+ trainingId: this.id,
243
+ type: common_3.TransactionType.Payment,
244
+ paymentType: common_3.PaymentType.Cash,
245
+ status: (0, typeorm_1.Not)(common_3.StatusType.Canceled),
246
+ refTransactionId: (0, typeorm_1.IsNull)()
247
+ });
248
+ return total || 0;
249
+ }
250
+ async getDiscountTransactions() {
251
+ const total = await transaction_entity_1.StudentTrainingTransactionEntity.sum('amount', {
252
+ trainingId: this.id,
253
+ type: common_3.TransactionType.Discount,
254
+ status: (0, typeorm_1.Not)(common_3.StatusType.Canceled),
255
+ refTransactionId: (0, typeorm_1.IsNull)()
256
+ });
257
+ return total || 0;
258
+ }
259
+ async getRefundTransactions() {
260
+ const total = await transaction_entity_1.StudentTrainingTransactionEntity.sum('amount', {
261
+ trainingId: this.id,
262
+ type: common_3.TransactionType.Refund,
263
+ status: (0, typeorm_1.Not)(common_3.StatusType.Canceled),
264
+ refTransactionId: (0, typeorm_1.IsNull)()
265
+ });
266
+ return total || 0;
267
+ }
268
+ async getCanceledTransactions() {
269
+ const total = await transaction_entity_1.StudentTrainingTransactionEntity.sum('amount', {
270
+ trainingId: this.id,
271
+ type: common_3.TransactionType.Cancelation,
272
+ status: (0, typeorm_1.Not)(common_3.StatusType.Canceled),
273
+ });
274
+ return total || 0;
275
+ }
276
+ async getActivities() {
277
+ const activities = [];
278
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy));
279
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
280
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy));
281
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
282
+ activities.push(await (0, utils_1.toActivity)(this.completedBy, common_2.ActivityType.completedBy));
283
+ activities.push(await (0, utils_1.toActivity)(this.completedOn, common_2.ActivityType.completedOn));
284
+ activities.push(await (0, utils_1.toActivity)(this.terminatedBy, common_2.ActivityType.terminatedBy));
285
+ activities.push(await (0, utils_1.toActivity)(this.terminatedOn, common_2.ActivityType.terminatedOn));
286
+ return activities.filter(a => a);
287
+ }
288
+ };
289
+ exports.StudentTrainingEntity = StudentTrainingEntity;
290
+ __decorate([
291
+ (0, typeorm_1.Column)(),
292
+ __metadata("design:type", Number)
293
+ ], StudentTrainingEntity.prototype, "programId", void 0);
294
+ __decorate([
295
+ (0, typeorm_1.Column)(),
296
+ __metadata("design:type", Number)
297
+ ], StudentTrainingEntity.prototype, "courseId", void 0);
298
+ __decorate([
299
+ (0, typeorm_1.Column)(),
300
+ __metadata("design:type", Number)
301
+ ], StudentTrainingEntity.prototype, "instructorId", void 0);
302
+ __decorate([
303
+ (0, typeorm_1.Column)({
304
+ type: 'enum',
305
+ enum: common_3.StatusType,
306
+ default: common_3.StatusType.Progress,
307
+ nullable: false
308
+ }),
309
+ __metadata("design:type", String)
310
+ ], StudentTrainingEntity.prototype, "status", void 0);
311
+ __decorate([
312
+ (0, typeorm_1.Column)(),
313
+ __metadata("design:type", String)
314
+ ], StudentTrainingEntity.prototype, "title", void 0);
315
+ __decorate([
316
+ (0, typeorm_1.Column)({
317
+ nullable: true,
318
+ default: null
319
+ }),
320
+ __metadata("design:type", String)
321
+ ], StudentTrainingEntity.prototype, "description", void 0);
322
+ __decorate([
323
+ (0, typeorm_1.Column)({
324
+ type: 'decimal',
325
+ precision: 8,
326
+ scale: 2,
327
+ nullable: false,
328
+ default: 0
329
+ }),
330
+ __metadata("design:type", Number)
331
+ ], StudentTrainingEntity.prototype, "price", void 0);
332
+ __decorate([
333
+ (0, typeorm_1.Column)({
334
+ nullable: true,
335
+ default: null
336
+ }),
337
+ __metadata("design:type", Number)
338
+ ], StudentTrainingEntity.prototype, "sessionDuration", void 0);
339
+ __decorate([
340
+ (0, typeorm_1.Column)({
341
+ type: 'decimal',
342
+ precision: 8,
343
+ scale: 2,
344
+ nullable: true,
345
+ default: null
346
+ }),
347
+ __metadata("design:type", Number)
348
+ ], StudentTrainingEntity.prototype, "administrationFee", void 0);
349
+ __decorate([
350
+ (0, typeorm_1.Column)({
351
+ type: 'decimal',
352
+ precision: 8,
353
+ scale: 2,
354
+ nullable: false,
355
+ default: 0
356
+ }),
357
+ __metadata("design:type", Number)
358
+ ], StudentTrainingEntity.prototype, "cost", void 0);
359
+ __decorate([
360
+ (0, typeorm_1.Column)({
361
+ type: 'decimal',
362
+ precision: 8,
363
+ scale: 2,
364
+ nullable: false,
365
+ default: 0
366
+ }),
367
+ __metadata("design:type", Number)
368
+ ], StudentTrainingEntity.prototype, "balance", void 0);
369
+ __decorate([
370
+ (0, typeorm_1.Column)({
371
+ type: 'decimal',
372
+ precision: 8,
373
+ scale: 2,
374
+ nullable: false,
375
+ default: 0
376
+ }),
377
+ __metadata("design:type", Number)
378
+ ], StudentTrainingEntity.prototype, "paid", void 0);
379
+ __decorate([
380
+ (0, typeorm_1.Column)({
381
+ type: 'decimal',
382
+ precision: 8,
383
+ scale: 2,
384
+ nullable: false,
385
+ default: 0
386
+ }),
387
+ __metadata("design:type", Number)
388
+ ], StudentTrainingEntity.prototype, "discount", void 0);
389
+ __decorate([
390
+ (0, typeorm_1.Column)({
391
+ type: 'decimal',
392
+ precision: 8,
393
+ scale: 2,
394
+ nullable: false,
395
+ default: 0
396
+ }),
397
+ __metadata("design:type", Number)
398
+ ], StudentTrainingEntity.prototype, "refund", void 0);
399
+ __decorate([
400
+ (0, typeorm_1.Column)({
401
+ type: 'simple-json',
402
+ nullable: true,
403
+ default: null
404
+ }),
405
+ __metadata("design:type", common_2.Address)
406
+ ], StudentTrainingEntity.prototype, "location", void 0);
407
+ __decorate([
408
+ (0, typeorm_1.Column)({
409
+ nullable: true,
410
+ default: null
411
+ }),
412
+ __metadata("design:type", Number)
413
+ ], StudentTrainingEntity.prototype, "resentLessonId", void 0);
414
+ __decorate([
415
+ (0, typeorm_1.Column)({
416
+ nullable: true,
417
+ default: null
418
+ }),
419
+ __metadata("design:type", Number)
420
+ ], StudentTrainingEntity.prototype, "recentTopicId", void 0);
421
+ __decorate([
422
+ (0, typeorm_1.Column)({
423
+ type: 'enum',
424
+ enum: common_2.CarTransmission,
425
+ default: common_2.CarTransmission.Manual,
426
+ nullable: false
427
+ }),
428
+ __metadata("design:type", String)
429
+ ], StudentTrainingEntity.prototype, "transmission", void 0);
430
+ __decorate([
431
+ (0, typeorm_1.Column)({
432
+ type: 'simple-json',
433
+ nullable: false
434
+ }),
435
+ __metadata("design:type", common_1.Person)
436
+ ], StudentTrainingEntity.prototype, "studentSnapshoot", void 0);
437
+ __decorate([
438
+ (0, typeorm_1.Column)({
439
+ type: 'simple-json',
440
+ nullable: true,
441
+ default: null
442
+ }),
443
+ __metadata("design:type", Array)
444
+ ], StudentTrainingEntity.prototype, "ratings", void 0);
445
+ __decorate([
446
+ (0, typeorm_1.Column)({
447
+ type: 'simple-json',
448
+ nullable: true,
449
+ default: null
450
+ }),
451
+ __metadata("design:type", Array)
452
+ ], StudentTrainingEntity.prototype, "addons", void 0);
453
+ __decorate([
454
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
455
+ __metadata("design:type", Number)
456
+ ], StudentTrainingEntity.prototype, "completedBy", void 0);
457
+ __decorate([
458
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
459
+ __metadata("design:type", Date)
460
+ ], StudentTrainingEntity.prototype, "completedOn", void 0);
461
+ __decorate([
462
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
463
+ __metadata("design:type", Number)
464
+ ], StudentTrainingEntity.prototype, "terminatedBy", void 0);
465
+ __decorate([
466
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
467
+ __metadata("design:type", Date)
468
+ ], StudentTrainingEntity.prototype, "terminatedOn", void 0);
469
+ __decorate([
470
+ (0, typeorm_1.ManyToOne)(() => program_entity_1.StudentProgramEntity, program => program.trainings),
471
+ __metadata("design:type", Promise)
472
+ ], StudentTrainingEntity.prototype, "program", void 0);
473
+ __decorate([
474
+ (0, typeorm_1.ManyToOne)(() => course_entity_1.CompanyCourseEntity, training => training.students),
475
+ __metadata("design:type", Promise)
476
+ ], StudentTrainingEntity.prototype, "course", void 0);
477
+ __decorate([
478
+ (0, typeorm_1.ManyToOne)(() => instructor_entity_1.CompanyInstructorEntity, training => training.studentTrainings),
479
+ __metadata("design:type", Promise)
480
+ ], StudentTrainingEntity.prototype, "instructor", void 0);
481
+ __decorate([
482
+ (0, typeorm_1.OneToOne)(() => lesson_entity_1.StudentTrainingLessonEntity, lesson => lesson.training),
483
+ __metadata("design:type", Promise)
484
+ ], StudentTrainingEntity.prototype, "lessons", void 0);
485
+ __decorate([
486
+ (0, typeorm_1.OneToOne)(() => appointment_entity_1.StudentTrainingAppointmentEntity, lesson => lesson.training),
487
+ __metadata("design:type", Promise)
488
+ ], StudentTrainingEntity.prototype, "appointments", void 0);
489
+ __decorate([
490
+ (0, typeorm_1.OneToMany)(() => transaction_entity_1.StudentTrainingTransactionEntity, payment => payment.training),
491
+ __metadata("design:type", Promise)
492
+ ], StudentTrainingEntity.prototype, "transactions", void 0);
493
+ __decorate([
494
+ (0, typeorm_1.OneToMany)(() => invoice_entity_1.CompanyInvoiceEntity, invoice => invoice.training),
495
+ __metadata("design:type", Promise)
496
+ ], StudentTrainingEntity.prototype, "invoices", void 0);
497
+ exports.StudentTrainingEntity = StudentTrainingEntity = __decorate([
498
+ (0, typeorm_1.Entity)('studentTranings'),
499
+ __metadata("design:paramtypes", [Object])
500
+ ], StudentTrainingEntity);
501
+ //# sourceMappingURL=training.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"training.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/training.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAsF;AACtF,4CAAuF;AACvF,4CAAoF;AACpF,4CAA2E;AAC3E,qFAAwF;AACxF,6DAAwE;AACxE,qFAAwF;AACxF,yEAA4E;AAC5E,sDAAyD;AACzD,mDAA8D;AAC9D,6DAAwE;AACxE,6CAAgE;AAGzD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,uBAAyB;IAEnE;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,QAAQ,CAAS;IAEjB;;OAEG;IAEH,YAAY,CAAS;IAErB;;OAEG;IAOH,MAAM,CAAa;IAEnB;;OAEG;IAEH,KAAK,CAAS;IAEd;;OAEG;IAKH,WAAW,CAAS;IAEpB;;;;OAIG;IAQH,KAAK,CAAS;IAEd;;;;OAIG;IAKH,eAAe,CAAS;IAExB;;OAEG;IAQH,iBAAiB,CAAS;IAE1B;;;OAGG;IAQH,IAAI,CAAS;IAEb;;OAEG;IAQH,OAAO,CAAS;IAEhB;;OAEG;IAQH,IAAI,CAAS;IAEb;;OAEG;IAQH,QAAQ,CAAS;IAEjB;;OAEG;IAQH,MAAM,CAAS;IAEf;;;;OAIG;IAMH,QAAQ,CAAU;IAElB;;;OAGG;IAKH,cAAc,CAAS;IAEvB;;;OAGG;IAKH,aAAa,CAAS;IAEtB;;OAEG;IAOH,YAAY,CAAkB;IAE9B;;;OAGG;IAKH,gBAAgB,CAAS;IAE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,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;uDACzB;gCA1R9B,qBAAqB;IADjC,IAAA,gBAAM,EAAC,iBAAiB,CAAC;;GACb,qBAAqB,CA0ajC"}
@@ -0,0 +1,111 @@
1
+ import { PaymentType, TransactionType, Transaction, BankAccount } from '@driveup/common';
2
+ import { StatusType, Activity } from '@driveup/common';
3
+ import { CompanyInvoiceEntity } from '../../../company/finances/invoice/invoice.entity';
4
+ import { StudentTrainingEntity } from './training.entity';
5
+ import { TrackableEntity } from '../../../../utils';
6
+ /**
7
+ * Student training transaction entity representing financial transactions for training sessions.
8
+ * Handles payments, cancellations, and refunds related to student training programs.
9
+ * Extends TrackableEntity to track creation and update information.
10
+ */
11
+ export declare class StudentTrainingTransactionEntity extends TrackableEntity<Transaction> {
12
+ /**
13
+ * The ID of the training this transaction belongs to
14
+ */
15
+ trainingId: number;
16
+ /**
17
+ * Type of transaction (Payment, Cancellation, Refund, etc.)
18
+ */
19
+ type: TransactionType;
20
+ /**
21
+ * Payment method used for this transaction
22
+ * Members: Cash, Online, Invoice
23
+ * For caancalellation transactions, this field will be null
24
+ */
25
+ paymentType: PaymentType;
26
+ /**
27
+ * Indicate the status of this transaction
28
+ */
29
+ status: StatusType;
30
+ /**
31
+ * Invoice reference for this transaction, if applicable.
32
+ * When an invoice status is marked as 'Paid', a transaction entry is created with reference to the invoice.
33
+ */
34
+ invoiceId: number;
35
+ /**
36
+ * Transaction amount in the system's base currency
37
+ * Precision: 8 digits, Scale: 2 decimal places
38
+ */
39
+ amount: number;
40
+ /**
41
+ * Optional description or notes about this transaction
42
+ */
43
+ description: string;
44
+ /**
45
+ * Reference to a related transaction (typically used for cancellations).
46
+ * When an approved transaction is canceled, a new cancellation transaction is created,
47
+ * and this field points to that cancellation transaction.
48
+ * The original approved transaction's status remains Approved.
49
+ */
50
+ refTransactionId: number;
51
+ /**
52
+ * Bank account information used for this transaction
53
+ */
54
+ bankAccount: BankAccount;
55
+ /**
56
+ * ID of the user who approved this transaction
57
+ */
58
+ approvedBy: number;
59
+ /**
60
+ * Timestamp when this transaction was approved
61
+ */
62
+ approvedOn: Date;
63
+ /**
64
+ * ID of the user who canceled this transaction
65
+ */
66
+ canceledBy: number;
67
+ /**
68
+ * Timestamp when this transaction was canceled
69
+ */
70
+ canceledOn: Date;
71
+ /**
72
+ * Student training related to this transaction
73
+ */
74
+ training: Promise<StudentTrainingEntity>;
75
+ /**
76
+ * Invoice related to this transaction, if applicable
77
+ */
78
+ invoice: Promise<CompanyInvoiceEntity>;
79
+ /**
80
+ * Creates a new StudentTrainingTransactionEntity instance
81
+ * @param props - Partial properties to initialize the entity with
82
+ */
83
+ constructor(props?: Partial<StudentTrainingTransactionEntity>);
84
+ /**
85
+ * Converts the entity to a Transaction model instance
86
+ * @returns Transaction model with transaction details
87
+ */
88
+ toModel(): Transaction;
89
+ /**
90
+ * Returns a summary representation of the transaction
91
+ * @returns Transaction model instance (same as toModel())
92
+ */
93
+ toSummary(): Transaction;
94
+ /**
95
+ * Retrieves the referenced transaction (typically a cancellation transaction)
96
+ * @returns The related transaction entity or undefined if no reference exists
97
+ */
98
+ getRefTransaction(): Promise<StudentTrainingTransactionEntity>;
99
+ /**
100
+ * Retrieves the original transaction that was canceled by this cancellation transaction
101
+ * Only applicable if this is a cancellation transaction
102
+ * @returns The original transaction entity that was canceled
103
+ */
104
+ getByRefTransaction(): Promise<StudentTrainingTransactionEntity>;
105
+ /**
106
+ * Retrieves all tracked activities for this transaction
107
+ * Includes creation and update timestamps and associated users
108
+ * @returns Array of Activity objects filtered to exclude null values
109
+ */
110
+ getActivities(): Promise<Activity[]>;
111
+ }