@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,266 @@
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
+ var StudentTrainingTransactionEntity_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.StudentTrainingTransactionEntity = void 0;
14
+ const typeorm_1 = require("typeorm");
15
+ const common_1 = require("@driveup/common");
16
+ const common_2 = require("@driveup/common");
17
+ const invoice_entity_1 = require("../../../company/finances/invoice/invoice.entity");
18
+ const training_entity_1 = require("./training.entity");
19
+ const utils_1 = require("../../../../utils");
20
+ /**
21
+ * Student training transaction entity representing financial transactions for training sessions.
22
+ * Handles payments, cancellations, and refunds related to student training programs.
23
+ * Extends TrackableEntity to track creation and update information.
24
+ */
25
+ let StudentTrainingTransactionEntity = StudentTrainingTransactionEntity_1 = class StudentTrainingTransactionEntity extends utils_1.TrackableEntity {
26
+ /**
27
+ * The ID of the training this transaction belongs to
28
+ */
29
+ trainingId;
30
+ /**
31
+ * Type of transaction (Payment, Cancellation, Refund, etc.)
32
+ */
33
+ type;
34
+ /**
35
+ * Payment method used for this transaction
36
+ * Members: Cash, Online, Invoice
37
+ * For caancalellation transactions, this field will be null
38
+ */
39
+ paymentType;
40
+ /**
41
+ * Indicate the status of this transaction
42
+ */
43
+ status;
44
+ /**
45
+ * Invoice reference for this transaction, if applicable.
46
+ * When an invoice status is marked as 'Paid', a transaction entry is created with reference to the invoice.
47
+ */
48
+ invoiceId;
49
+ /**
50
+ * Transaction amount in the system's base currency
51
+ * Precision: 8 digits, Scale: 2 decimal places
52
+ */
53
+ amount;
54
+ /**
55
+ * Optional description or notes about this transaction
56
+ */
57
+ description;
58
+ /**
59
+ * Reference to a related transaction (typically used for cancellations).
60
+ * When an approved transaction is canceled, a new cancellation transaction is created,
61
+ * and this field points to that cancellation transaction.
62
+ * The original approved transaction's status remains Approved.
63
+ */
64
+ refTransactionId;
65
+ /**
66
+ * Bank account information used for this transaction
67
+ */
68
+ bankAccount;
69
+ /**
70
+ * ID of the user who approved this transaction
71
+ */
72
+ approvedBy;
73
+ /**
74
+ * Timestamp when this transaction was approved
75
+ */
76
+ approvedOn;
77
+ /**
78
+ * ID of the user who canceled this transaction
79
+ */
80
+ canceledBy;
81
+ /**
82
+ * Timestamp when this transaction was canceled
83
+ */
84
+ canceledOn;
85
+ /**
86
+ * Student training related to this transaction
87
+ */
88
+ training;
89
+ /**
90
+ * Invoice related to this transaction, if applicable
91
+ */
92
+ invoice;
93
+ /**
94
+ * Creates a new StudentTrainingTransactionEntity instance
95
+ * @param props - Partial properties to initialize the entity with
96
+ */
97
+ constructor(props) {
98
+ super();
99
+ Object.assign(this, props);
100
+ }
101
+ /**
102
+ * Converts the entity to a Transaction model instance
103
+ * @returns Transaction model with transaction details
104
+ */
105
+ toModel() {
106
+ return new common_1.Transaction({
107
+ id: this.id,
108
+ type: this.type,
109
+ paymentType: this.paymentType,
110
+ status: this.status,
111
+ amount: this.amount,
112
+ description: this.description,
113
+ bank: this.bankAccount ? common_1.BankAccount.toInstance(this.bankAccount) : null,
114
+ });
115
+ }
116
+ /**
117
+ * Returns a summary representation of the transaction
118
+ * @returns Transaction model instance (same as toModel())
119
+ */
120
+ toSummary() {
121
+ return this.toModel();
122
+ }
123
+ /**
124
+ * Retrieves the referenced transaction (typically a cancellation transaction)
125
+ * @returns The related transaction entity or undefined if no reference exists
126
+ */
127
+ async getRefTransaction() {
128
+ if (!this.refTransactionId)
129
+ return;
130
+ return await StudentTrainingTransactionEntity_1.findOneBy({
131
+ id: this.refTransactionId
132
+ });
133
+ }
134
+ /**
135
+ * Retrieves the original transaction that was canceled by this cancellation transaction
136
+ * Only applicable if this is a cancellation transaction
137
+ * @returns The original transaction entity that was canceled
138
+ */
139
+ async getByRefTransaction() {
140
+ return await StudentTrainingTransactionEntity_1.findOneBy({
141
+ refTransactionId: this.id
142
+ });
143
+ }
144
+ /**
145
+ * Retrieves all tracked activities for this transaction
146
+ * Includes creation and update timestamps and associated users
147
+ * @returns Array of Activity objects filtered to exclude null values
148
+ */
149
+ async getActivities() {
150
+ const activities = [];
151
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy));
152
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
153
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy));
154
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
155
+ return activities.filter(a => a);
156
+ }
157
+ };
158
+ exports.StudentTrainingTransactionEntity = StudentTrainingTransactionEntity;
159
+ __decorate([
160
+ (0, typeorm_1.Column)(),
161
+ __metadata("design:type", Number)
162
+ ], StudentTrainingTransactionEntity.prototype, "trainingId", void 0);
163
+ __decorate([
164
+ (0, typeorm_1.Column)({
165
+ type: 'enum',
166
+ name: 'transactionType',
167
+ enum: common_1.TransactionType,
168
+ default: common_1.TransactionType.Payment,
169
+ nullable: false
170
+ }),
171
+ __metadata("design:type", String)
172
+ ], StudentTrainingTransactionEntity.prototype, "type", void 0);
173
+ __decorate([
174
+ (0, typeorm_1.Column)({
175
+ type: 'enum',
176
+ enum: common_1.PaymentType,
177
+ default: common_1.PaymentType.Online,
178
+ nullable: true
179
+ }),
180
+ __metadata("design:type", String)
181
+ ], StudentTrainingTransactionEntity.prototype, "paymentType", void 0);
182
+ __decorate([
183
+ (0, typeorm_1.Column)({
184
+ type: 'enum',
185
+ nullable: false,
186
+ enum: [
187
+ common_2.StatusType.Pending,
188
+ common_2.StatusType.Approved,
189
+ common_2.StatusType.Rejected,
190
+ common_2.StatusType.Canceled,
191
+ ],
192
+ default: common_2.StatusType.Pending
193
+ }),
194
+ __metadata("design:type", String)
195
+ ], StudentTrainingTransactionEntity.prototype, "status", void 0);
196
+ __decorate([
197
+ (0, typeorm_1.Column)({
198
+ nullable: true,
199
+ default: null
200
+ }),
201
+ __metadata("design:type", Number)
202
+ ], StudentTrainingTransactionEntity.prototype, "invoiceId", void 0);
203
+ __decorate([
204
+ (0, typeorm_1.Column)({
205
+ type: 'decimal',
206
+ precision: 8,
207
+ scale: 2,
208
+ nullable: false,
209
+ default: 0
210
+ }),
211
+ __metadata("design:type", Number)
212
+ ], StudentTrainingTransactionEntity.prototype, "amount", void 0);
213
+ __decorate([
214
+ (0, typeorm_1.Column)({
215
+ type: 'mediumtext',
216
+ nullable: true,
217
+ default: null
218
+ }),
219
+ __metadata("design:type", String)
220
+ ], StudentTrainingTransactionEntity.prototype, "description", void 0);
221
+ __decorate([
222
+ (0, typeorm_1.Column)({
223
+ unique: true,
224
+ nullable: true,
225
+ default: null
226
+ }),
227
+ __metadata("design:type", Number)
228
+ ], StudentTrainingTransactionEntity.prototype, "refTransactionId", void 0);
229
+ __decorate([
230
+ (0, typeorm_1.Column)({
231
+ type: 'simple-json',
232
+ nullable: true,
233
+ default: null
234
+ }),
235
+ __metadata("design:type", common_1.BankAccount)
236
+ ], StudentTrainingTransactionEntity.prototype, "bankAccount", void 0);
237
+ __decorate([
238
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
239
+ __metadata("design:type", Number)
240
+ ], StudentTrainingTransactionEntity.prototype, "approvedBy", void 0);
241
+ __decorate([
242
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
243
+ __metadata("design:type", Date)
244
+ ], StudentTrainingTransactionEntity.prototype, "approvedOn", void 0);
245
+ __decorate([
246
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
247
+ __metadata("design:type", Number)
248
+ ], StudentTrainingTransactionEntity.prototype, "canceledBy", void 0);
249
+ __decorate([
250
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
251
+ __metadata("design:type", Date)
252
+ ], StudentTrainingTransactionEntity.prototype, "canceledOn", void 0);
253
+ __decorate([
254
+ (0, typeorm_1.ManyToOne)(() => training_entity_1.StudentTrainingEntity, training => training.transactions),
255
+ __metadata("design:type", Promise)
256
+ ], StudentTrainingTransactionEntity.prototype, "training", void 0);
257
+ __decorate([
258
+ (0, typeorm_1.OneToOne)(() => invoice_entity_1.CompanyInvoiceEntity, invoice => invoice.training),
259
+ (0, typeorm_1.JoinColumn)(),
260
+ __metadata("design:type", Promise)
261
+ ], StudentTrainingTransactionEntity.prototype, "invoice", void 0);
262
+ exports.StudentTrainingTransactionEntity = StudentTrainingTransactionEntity = StudentTrainingTransactionEntity_1 = __decorate([
263
+ (0, typeorm_1.Entity)('studentTrainingTransactions'),
264
+ __metadata("design:paramtypes", [Object])
265
+ ], StudentTrainingTransactionEntity);
266
+ //# sourceMappingURL=transaction.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/transaction.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA0E;AAC1E,4CAAmG;AACnG,4CAAqE;AACrE,qFAAwF;AACxF,uDAA0D;AAC1D,6CAAgE;AAEhE;;;;GAIG;AAEI,IAAM,gCAAgC,wCAAtC,MAAM,gCAAiC,SAAQ,uBAA4B;IAEjF;;OAEG;I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IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oEACvB;AAMnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC9B,IAAI;oEAAC;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;;kEACjC;AAOzC;IAFC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjE,IAAA,oBAAU,GAAE;;iEAC0B;2CA5I3B,gCAAgC;IAD5C,IAAA,gBAAM,EAAC,6BAA6B,CAAC;;GACzB,gCAAgC,CAiN5C"}
@@ -0,0 +1,89 @@
1
+ import { AccountStatus, Language, Preference, Activity, Student } from '@driveup/common';
2
+ import { UserEntity } from '../../user/user.entity';
3
+ import { StudentLicenceEntity } from './program/licence/licence.entity';
4
+ import { StudentMedicalExaminationEntity } from './program/medical/examination.model';
5
+ import { StudentProgramEntity } from './program/program.entity';
6
+ import { StudentMedicalCertificateEntity } from './program/medical/certificate.entity';
7
+ import { TrackableEntity } from '../../utils';
8
+ export declare class StudentEntity extends TrackableEntity<Student> {
9
+ /**
10
+ * Reference to the user account associated with this student profile
11
+ */
12
+ userId: number;
13
+ /**
14
+ * Student profile name
15
+ * By default is set from user account name
16
+ * Usefull when the student wants to have a different name on his profile
17
+ */
18
+ name: string;
19
+ /**
20
+ * Student profile language
21
+ * By default is set from user account name
22
+ * Usefull when the student wants to have a different language on his profile
23
+ */
24
+ language: Language;
25
+ /**
26
+ * Student account status
27
+ * When company invites a student, the status is set to Pending
28
+ * Only student onbording can change the status to Active
29
+ */
30
+ status: AccountStatus;
31
+ /**
32
+ * Student prefered settings
33
+ * E.g. Notifications, reminders etc.
34
+ */
35
+ preferences: Preference[];
36
+ /**
37
+ * Reference to the user account
38
+ * This is a many-to-one relation where userId is not unique at DB level
39
+ * to allow soft-deleted students to be recreated with the same userId
40
+ */
41
+ user: Promise<UserEntity>;
42
+ /**
43
+ * Student medical certificates
44
+ * The student can register certificates without linking them to an examination
45
+ * This is the case where the student already has a valid medical certificate
46
+ */
47
+ medicalCertificates: Promise<StudentMedicalCertificateEntity[]>;
48
+ /**
49
+ * Student medical examinations
50
+ * The student examination to obtaining medical certificates
51
+ * This is the case where the student certificates are linked to examinations
52
+ */
53
+ medicalExaminations: Promise<StudentMedicalExaminationEntity[]>;
54
+ /**
55
+ * Student licences
56
+ * The licences obtained by the student after completing product programs
57
+ * Currently driveup has't state authority integration for licence management
58
+ * So the licences are managed directly by the student profile manually
59
+ */
60
+ licences: Promise<StudentLicenceEntity[]>;
61
+ /**
62
+ * All programs linked to this student profile
63
+ * The programs are created when the student enrolls to a driving category
64
+ * The program is palette of trainings and preperation trainings
65
+ */
66
+ programs: Promise<StudentProgramEntity[]>;
67
+ /**
68
+ * Creates an instance of StudentEntity
69
+ * @param props - Partial properties to initialize the entity
70
+ */
71
+ constructor(props?: Partial<StudentEntity>);
72
+ /**
73
+ * Converts the entity to a Student model instance
74
+ * Falls back to user data if student-specific data is not set
75
+ * @returns Promise resolving to Student model
76
+ */
77
+ toModel(): Promise<Student>;
78
+ /**
79
+ * Converts the entity to a Student model instance
80
+ * @returns Promise resolving to Student model
81
+ */
82
+ toSummary(): Promise<Student>;
83
+ /**
84
+ * Retrieves all activity records for this student
85
+ * Includes creation and update actions
86
+ * @returns Array of Activity objects
87
+ */
88
+ getActivities(): Promise<Activity[]>;
89
+ }
@@ -0,0 +1,183 @@
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.StudentEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const user_entity_1 = require("../../user/user.entity");
16
+ const licence_entity_1 = require("./program/licence/licence.entity");
17
+ const examination_model_1 = require("./program/medical/examination.model");
18
+ const program_entity_1 = require("./program/program.entity");
19
+ const certificate_entity_1 = require("./program/medical/certificate.entity");
20
+ const utils_1 = require("../../utils");
21
+ let StudentEntity = class StudentEntity extends utils_1.TrackableEntity {
22
+ /**
23
+ * Reference to the user account associated with this student profile
24
+ */
25
+ userId;
26
+ /**
27
+ * Student profile name
28
+ * By default is set from user account name
29
+ * Usefull when the student wants to have a different name on his profile
30
+ */
31
+ name;
32
+ /**
33
+ * Student profile language
34
+ * By default is set from user account name
35
+ * Usefull when the student wants to have a different language on his profile
36
+ */
37
+ language;
38
+ /**
39
+ * Student account status
40
+ * When company invites a student, the status is set to Pending
41
+ * Only student onbording can change the status to Active
42
+ */
43
+ status;
44
+ /**
45
+ * Student prefered settings
46
+ * E.g. Notifications, reminders etc.
47
+ */
48
+ preferences;
49
+ /**
50
+ * Reference to the user account
51
+ * This is a many-to-one relation where userId is not unique at DB level
52
+ * to allow soft-deleted students to be recreated with the same userId
53
+ */
54
+ user;
55
+ /**
56
+ * Student medical certificates
57
+ * The student can register certificates without linking them to an examination
58
+ * This is the case where the student already has a valid medical certificate
59
+ */
60
+ medicalCertificates;
61
+ /**
62
+ * Student medical examinations
63
+ * The student examination to obtaining medical certificates
64
+ * This is the case where the student certificates are linked to examinations
65
+ */
66
+ medicalExaminations;
67
+ /**
68
+ * Student licences
69
+ * The licences obtained by the student after completing product programs
70
+ * Currently driveup has't state authority integration for licence management
71
+ * So the licences are managed directly by the student profile manually
72
+ */
73
+ licences;
74
+ /**
75
+ * All programs linked to this student profile
76
+ * The programs are created when the student enrolls to a driving category
77
+ * The program is palette of trainings and preperation trainings
78
+ */
79
+ programs;
80
+ /**
81
+ * Creates an instance of StudentEntity
82
+ * @param props - Partial properties to initialize the entity
83
+ */
84
+ constructor(props) {
85
+ super();
86
+ Object.assign(this, props);
87
+ }
88
+ /**
89
+ * Converts the entity to a Student model instance
90
+ * Falls back to user data if student-specific data is not set
91
+ * @returns Promise resolving to Student model
92
+ */
93
+ async toModel() {
94
+ const user = await this.user;
95
+ return new common_1.Student({
96
+ id: this.id,
97
+ status: this.status,
98
+ name: this.name || user.name,
99
+ language: this.language || user.language,
100
+ imageUrl: user.imageUrl
101
+ });
102
+ }
103
+ /**
104
+ * Converts the entity to a Student model instance
105
+ * @returns Promise resolving to Student model
106
+ */
107
+ async toSummary() {
108
+ return await this.toModel();
109
+ }
110
+ /**
111
+ * Retrieves all activity records for this student
112
+ * Includes creation and update actions
113
+ * @returns Array of Activity objects
114
+ */
115
+ async getActivities() {
116
+ const activities = [];
117
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
118
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
119
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
120
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
121
+ return activities.filter(a => a);
122
+ }
123
+ };
124
+ exports.StudentEntity = StudentEntity;
125
+ __decorate([
126
+ (0, typeorm_1.Column)(),
127
+ __metadata("design:type", Number)
128
+ ], StudentEntity.prototype, "userId", void 0);
129
+ __decorate([
130
+ (0, typeorm_1.Column)(),
131
+ __metadata("design:type", String)
132
+ ], StudentEntity.prototype, "name", void 0);
133
+ __decorate([
134
+ (0, typeorm_1.Column)({
135
+ type: 'enum',
136
+ enum: common_1.Language,
137
+ default: common_1.Language.En,
138
+ nullable: true
139
+ }),
140
+ __metadata("design:type", String)
141
+ ], StudentEntity.prototype, "language", void 0);
142
+ __decorate([
143
+ (0, typeorm_1.Column)({
144
+ type: 'enum',
145
+ enum: common_1.AccountStatus,
146
+ default: common_1.AccountStatus.Pending,
147
+ nullable: false
148
+ }),
149
+ __metadata("design:type", String)
150
+ ], StudentEntity.prototype, "status", void 0);
151
+ __decorate([
152
+ (0, typeorm_1.Column)({
153
+ type: 'simple-json',
154
+ nullable: true,
155
+ default: null
156
+ }),
157
+ __metadata("design:type", Array)
158
+ ], StudentEntity.prototype, "preferences", void 0);
159
+ __decorate([
160
+ (0, typeorm_1.ManyToOne)(() => user_entity_1.UserEntity, user => user.studentProfiles),
161
+ __metadata("design:type", Promise)
162
+ ], StudentEntity.prototype, "user", void 0);
163
+ __decorate([
164
+ (0, typeorm_1.OneToMany)(() => certificate_entity_1.StudentMedicalCertificateEntity, certificate => certificate.student),
165
+ __metadata("design:type", Promise)
166
+ ], StudentEntity.prototype, "medicalCertificates", void 0);
167
+ __decorate([
168
+ (0, typeorm_1.OneToMany)(() => examination_model_1.StudentMedicalExaminationEntity, certificate => certificate.student),
169
+ __metadata("design:type", Promise)
170
+ ], StudentEntity.prototype, "medicalExaminations", void 0);
171
+ __decorate([
172
+ (0, typeorm_1.OneToMany)(() => licence_entity_1.StudentLicenceEntity, licence => licence.student),
173
+ __metadata("design:type", Promise)
174
+ ], StudentEntity.prototype, "licences", void 0);
175
+ __decorate([
176
+ (0, typeorm_1.OneToMany)(() => program_entity_1.StudentProgramEntity, program => program.student),
177
+ __metadata("design:type", Promise)
178
+ ], StudentEntity.prototype, "programs", void 0);
179
+ exports.StudentEntity = StudentEntity = __decorate([
180
+ (0, typeorm_1.Entity)('students'),
181
+ __metadata("design:paramtypes", [Object])
182
+ ], StudentEntity);
183
+ //# sourceMappingURL=student.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"student.entity.js","sourceRoot":"","sources":["../../../src/profile/student/student.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4CAAuG;AACvG,wDAAoD;AACpD,qEAAwE;AACxE,2EAAsF;AACtF,6DAAgE;AAChE,6EAAuF;AACvF,uCAA0D;AAGnD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,uBAAwB;IAE1D;;OAEG;IAEH,MAAM,CAAS;IAEf;;;;OAIG;IAEH,IAAI,CAAS;IAEb;;;;OAIG;IAOH,QAAQ,CAAW;IAEnB;;;;OAIG;IAOH,MAAM,CAAgB;IAEtB;;;OAGG;IAMH,WAAW,CAAe;IAE1B;;;;OAIG;IAEH,IAAI,CAAsB;IAE1B;;;;OAIG;IAEH,mBAAmB,CAA6C;IAEhE;;;;OAIG;IAEH,mBAAmB,CAA6C;IAEhE;;;;;OAKG;IAEH,QAAQ,CAAkC;IAE1C;;;;OAIG;IAEH,QAAQ,CAAkC;IAE1C;;;OAGG;IACH,YAAY,KAA8B;QACzC,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;QAC7B,OAAO,IAAI,gBAAO,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS;QACd,OAAO,MAAM,IAAI,CAA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mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAU,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC;;2CAChC;AAQ1B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,oDAA+B,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;0DACrB;AAQhE;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,mDAA+B,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;0DACrB;AAShE;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;+CACxB;AAQ1C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;+CACxB;wBA5F9B,aAAa;IADzB,IAAA,gBAAM,EAAC,UAAU,CAAC;;GACN,aAAa,CA4IzB"}
@@ -0,0 +1,68 @@
1
+ import { Activity, Campaigne, Content, IContent, Language } from '@driveup/common';
2
+ import { CampaignGiftCodeEntity } from './gifcode.entity';
3
+ import { ProductType } from '@driveup/common';
4
+ import { TrackableEntity } from '../../utils';
5
+ /**
6
+ * Represents a marketing campaign in the system.
7
+ * Campaigns offer promotional discounts through gift codes that users can redeem.
8
+ * Each campaign targets specific products and has an expiration date.
9
+ * Gift amounts are credited to the user's product wallet upon redemption.
10
+ *
11
+ * @extends TrackableEntity
12
+ */
13
+ export declare class CampaignEntity extends TrackableEntity {
14
+ /**
15
+ * Product types this campaign applies to
16
+ * @default []
17
+ */
18
+ products: ProductType[];
19
+ /**
20
+ * Localized content for the campaign (title, description, etc.)
21
+ */
22
+ translations: IContent[];
23
+ /**
24
+ * URL to the campaign's promotional image
25
+ */
26
+ imageUrl: string;
27
+ /**
28
+ * Campaign discount amount
29
+ * This amount will be stored on product credit
30
+ */
31
+ giftAmount: number;
32
+ /**
33
+ * Campaign expiration date - after this date, codes cannot be redeemed
34
+ */
35
+ exipryDate: Date;
36
+ /**
37
+ * Gift codes associated with this campaign
38
+ */
39
+ giftCodes: Promise<CampaignGiftCodeEntity[]>;
40
+ /**
41
+ * Creates a new CampaignEntity instance
42
+ * @param props - Partial properties to initialize the entity
43
+ */
44
+ constructor(props?: Partial<CampaignEntity>);
45
+ /**
46
+ * Converts the entity to a Campaigne model instance
47
+ * @param lang - Optional language for translations
48
+ * @returns Campaigne model with localized content
49
+ */
50
+ toModel(lang?: Language): Campaigne;
51
+ /**
52
+ * Retrieves all gift codes for this campaign
53
+ * @returns Promise resolving to array of GiftCode models
54
+ */
55
+ getCodes(): Promise<import("@driveup/common").GiftCode[]>;
56
+ /**
57
+ * Gets the localized translation for the campaign
58
+ * @param lang - Optional language code; defaults to current i18n context
59
+ * @returns Content instance with translated title and description
60
+ */
61
+ getTranslation(lang?: Language): Content;
62
+ /**
63
+ * Gets all available translations for the campaign
64
+ * @returns Array of Content instances for all languages
65
+ */
66
+ getTranslations(): Content[];
67
+ getActivities(): Promise<Activity[]>;
68
+ }