@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,118 @@
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.CompanyPaymentMethodEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const typeorm_2 = require("typeorm");
15
+ const company_entity_1 = require("../../company.entity");
16
+ const transaction_entity_1 = require("../billing/transaction.entity");
17
+ const common_1 = require("@driveup/common");
18
+ const priceplan_entity_1 = require("../../product/priceplan.entity");
19
+ const utils_1 = require("../../../../utils");
20
+ let CompanyPaymentMethodEntity = class CompanyPaymentMethodEntity extends utils_1.TrackableEntity {
21
+ constructor(props) {
22
+ super();
23
+ Object.assign(this, props);
24
+ }
25
+ toModel() {
26
+ return new common_1.PaymentMethod({
27
+ id: this.id,
28
+ name: this.name,
29
+ active: this.active,
30
+ methodId: this.methodId,
31
+ customerId: this.customerId,
32
+ confirmed: this.confirmed,
33
+ metadata: this.metadata,
34
+ });
35
+ }
36
+ async getFailedTransactions() {
37
+ return await transaction_entity_1.CompanyBillTransactionEntity
38
+ .createQueryBuilder('t')
39
+ .leftJoinAndSelect('t.bill', 'bill')
40
+ .where('t.paymentMethodId = :id', { id: this.id })
41
+ .andWhere('t.status = :status', { status: common_1.StatusType.Failed })
42
+ .andWhere('bill.status = :billStatus', { billStatus: common_1.BillStatus.Unpaid })
43
+ .getMany();
44
+ }
45
+ async getActivities() {
46
+ const activities = [];
47
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
48
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
49
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
50
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
51
+ return activities.filter(a => !a);
52
+ }
53
+ };
54
+ exports.CompanyPaymentMethodEntity = CompanyPaymentMethodEntity;
55
+ __decorate([
56
+ (0, typeorm_1.Column)(),
57
+ __metadata("design:type", Number)
58
+ ], CompanyPaymentMethodEntity.prototype, "companyId", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({
61
+ nullable: true,
62
+ default: null
63
+ }),
64
+ __metadata("design:type", String)
65
+ ], CompanyPaymentMethodEntity.prototype, "name", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.Column)({
68
+ nullable: false,
69
+ default: true
70
+ }),
71
+ __metadata("design:type", Boolean)
72
+ ], CompanyPaymentMethodEntity.prototype, "active", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({
75
+ type: 'simple-json',
76
+ nullable: true,
77
+ default: null
78
+ }),
79
+ __metadata("design:type", Object)
80
+ ], CompanyPaymentMethodEntity.prototype, "metadata", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({
83
+ nullable: true,
84
+ default: null
85
+ }),
86
+ __metadata("design:type", String)
87
+ ], CompanyPaymentMethodEntity.prototype, "methodId", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.Column)({
90
+ nullable: true,
91
+ default: null
92
+ }),
93
+ __metadata("design:type", String)
94
+ ], CompanyPaymentMethodEntity.prototype, "customerId", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.Column)({
97
+ nullable: false,
98
+ default: false
99
+ }),
100
+ __metadata("design:type", Boolean)
101
+ ], CompanyPaymentMethodEntity.prototype, "confirmed", void 0);
102
+ __decorate([
103
+ (0, typeorm_2.ManyToOne)(() => company_entity_1.CompanyEntity, company => company.paymentMethods),
104
+ __metadata("design:type", Promise)
105
+ ], CompanyPaymentMethodEntity.prototype, "company", void 0);
106
+ __decorate([
107
+ (0, typeorm_2.OneToMany)(() => transaction_entity_1.CompanyBillTransactionEntity, payment => payment.paymentMethod),
108
+ __metadata("design:type", Promise)
109
+ ], CompanyPaymentMethodEntity.prototype, "transactions", void 0);
110
+ __decorate([
111
+ (0, typeorm_1.OneToOne)(() => priceplan_entity_1.CompanyProductPricePlanEntity, priceplan => priceplan.paymentMethod),
112
+ __metadata("design:type", Promise)
113
+ ], CompanyPaymentMethodEntity.prototype, "productPaymentMethod", void 0);
114
+ exports.CompanyPaymentMethodEntity = CompanyPaymentMethodEntity = __decorate([
115
+ (0, typeorm_1.Entity)('companyPaymentMethods'),
116
+ __metadata("design:paramtypes", [Object])
117
+ ], CompanyPaymentMethodEntity);
118
+ //# sourceMappingURL=payment-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-method.js","sourceRoot":"","sources":["../../../../../src/profile/company/finances/peyment-method/payment-method.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAmD;AACnD,qCAA+C;AAC/C,yDAAqD;AACrD,sEAA6E;AAC7E,4CAAgG;AAChG,qEAA+E;AAC/E,6CAAgE;AAGzD,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,uBAA8B;IAgE7E,YAAY,KAA2C;QACtD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAA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C,uBAAuB,CAAC;;GACnB,0BAA0B,CAmGtC"}
@@ -0,0 +1,85 @@
1
+ import { AccountStatus, Activity, Instructor } from '@driveup/common';
2
+ import { WorkingHours, Holiday, Preference, CompanyRole } from '@driveup/common';
3
+ import { CompanyEntity } from '../company.entity';
4
+ import { CompanyInstructorTaskEntity } from './task.entity';
5
+ import { InstructorEntity } from '../../instructor/instructor.entity';
6
+ import { CompanyHandoverEntity } from '../finances/handover/handover.entity';
7
+ import { CompanyCourseEntity } from '../course/course.entity';
8
+ import { CompanyCourseLessonEntity } from '../course/lesson.entity';
9
+ import { StudentTrainingEntity } from '../../student/program/training/training.entity';
10
+ import { StudentTrainingAppointmentEntity } from '../../student/program/training/appointment.entity';
11
+ import { CompanyCourseAppointmentEntity } from '../course/appointment.entity';
12
+ import { StudentTrainingLessonEntity } from '../../student/program/training/lesson.entity';
13
+ import { TrackableEntity } from '../../../utils';
14
+ export declare class CompanyInstructorEntity extends TrackableEntity<Instructor> {
15
+ instructorId: number;
16
+ companyId: number;
17
+ status: AccountStatus;
18
+ role: CompanyRole;
19
+ /**
20
+ * Instructor working hours definition
21
+ * @attention must get a default value of empty object array when creating the entity
22
+ */
23
+ workingHours: WorkingHours[];
24
+ /**
25
+ * Instructor holidays / off-days
26
+ * @attention must get a default value of empty object array when creating the entity
27
+ */
28
+ holidays: Holiday[];
29
+ /**
30
+ * Notification preferences stored as JSON
31
+ */
32
+ preferences: Preference[];
33
+ startedOn: Date;
34
+ invitedBy: number;
35
+ invitedOn: Date;
36
+ closedBy: number;
37
+ closedOn: Date;
38
+ /**
39
+ * Instrucor profile relation
40
+ */
41
+ instructor: Promise<InstructorEntity>;
42
+ /**
43
+ * Company relation
44
+ */
45
+ company: Promise<CompanyEntity>;
46
+ /**
47
+ * Company course assigned to this instructor (in-charge)
48
+ */
49
+ companyCourses: Promise<CompanyCourseEntity[]>;
50
+ /**
51
+ * Company course lesson assigned to this instructor (in-charge)
52
+ */
53
+ companyCourseLessons: Promise<CompanyCourseLessonEntity[]>;
54
+ /**
55
+ * Company course appointments assigned to this instructor (in-charge)
56
+ */
57
+ companyCourseAppointments: Promise<CompanyCourseAppointmentEntity[]>;
58
+ /**
59
+ * Tasks assigned to the instructors
60
+ */
61
+ companyHandovers: Promise<CompanyHandoverEntity[]>;
62
+ /**
63
+ * Student training assigned to this instructor (in-charge)
64
+ */
65
+ studentTrainings: Promise<StudentTrainingEntity[]>;
66
+ /**
67
+ * Student training lessons assigned to this instructor
68
+ */
69
+ studentTrainingLessons: Promise<StudentTrainingLessonEntity[]>;
70
+ /**s
71
+ * Instructor student training appointments
72
+ */
73
+ studentTrainingAppointments: Promise<StudentTrainingAppointmentEntity[]>;
74
+ /**
75
+ * Tasks assigned to the instructors
76
+ */
77
+ tasks: Promise<CompanyInstructorTaskEntity[]>;
78
+ constructor(props?: Partial<CompanyInstructorEntity>);
79
+ toModel(): Promise<Instructor>;
80
+ toSummary(): Promise<Instructor>;
81
+ toPerson(): Promise<import("@driveup/common").Person>;
82
+ getInstructor(): Promise<InstructorEntity>;
83
+ canReinstate(): Promise<boolean>;
84
+ getActivities(): Promise<Activity[]>;
85
+ }
@@ -0,0 +1,254 @@
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.CompanyInstructorEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const common_2 = require("@driveup/common");
16
+ const company_entity_1 = require("../company.entity");
17
+ const task_entity_1 = require("./task.entity");
18
+ const instructor_entity_1 = require("../../instructor/instructor.entity");
19
+ const handover_entity_1 = require("../finances/handover/handover.entity");
20
+ const course_entity_1 = require("../course/course.entity");
21
+ const lesson_entity_1 = require("../course/lesson.entity");
22
+ const training_entity_1 = require("../../student/program/training/training.entity");
23
+ const appointment_entity_1 = require("../../student/program/training/appointment.entity");
24
+ const appointment_entity_2 = require("../course/appointment.entity");
25
+ const lesson_entity_2 = require("../../student/program/training/lesson.entity");
26
+ const utils_1 = require("../../../utils");
27
+ let CompanyInstructorEntity = class CompanyInstructorEntity extends utils_1.TrackableEntity {
28
+ instructorId;
29
+ companyId;
30
+ status;
31
+ role;
32
+ /**
33
+ * Instructor working hours definition
34
+ * @attention must get a default value of empty object array when creating the entity
35
+ */
36
+ workingHours;
37
+ /**
38
+ * Instructor holidays / off-days
39
+ * @attention must get a default value of empty object array when creating the entity
40
+ */
41
+ holidays;
42
+ /**
43
+ * Notification preferences stored as JSON
44
+ */
45
+ preferences;
46
+ startedOn;
47
+ invitedBy;
48
+ invitedOn;
49
+ closedBy;
50
+ closedOn;
51
+ /**
52
+ * Instrucor profile relation
53
+ */
54
+ instructor;
55
+ /**
56
+ * Company relation
57
+ */
58
+ company;
59
+ /**
60
+ * Company course assigned to this instructor (in-charge)
61
+ */
62
+ companyCourses;
63
+ /**
64
+ * Company course lesson assigned to this instructor (in-charge)
65
+ */
66
+ companyCourseLessons;
67
+ /**
68
+ * Company course appointments assigned to this instructor (in-charge)
69
+ */
70
+ companyCourseAppointments;
71
+ /**
72
+ * Tasks assigned to the instructors
73
+ */
74
+ companyHandovers;
75
+ /**
76
+ * Student training assigned to this instructor (in-charge)
77
+ */
78
+ studentTrainings;
79
+ /**
80
+ * Student training lessons assigned to this instructor
81
+ */
82
+ studentTrainingLessons;
83
+ /**s
84
+ * Instructor student training appointments
85
+ */
86
+ studentTrainingAppointments;
87
+ /**
88
+ * Tasks assigned to the instructors
89
+ */
90
+ tasks;
91
+ constructor(props) {
92
+ super();
93
+ Object.assign(this, props);
94
+ }
95
+ async toModel() {
96
+ const entity = await this.instructor;
97
+ const instructor = await entity.toModel();
98
+ instructor.id = this.id;
99
+ instructor.status = this.status;
100
+ instructor.role = this.role;
101
+ instructor.startedOn = this.startedOn;
102
+ instructor.workingHours = this.workingHours?.map(common_2.WorkingHours.toInstance);
103
+ instructor.holidays = this.holidays?.map(common_2.Holiday.toInstance);
104
+ instructor.preferences = this.preferences?.map(common_2.Preference.toInstance);
105
+ return instructor;
106
+ }
107
+ async toSummary() {
108
+ const entity = await this.instructor;
109
+ const instructor = await entity.toModel();
110
+ instructor.id = this.id;
111
+ instructor.status = this.status;
112
+ instructor.role = this.role;
113
+ return instructor;
114
+ }
115
+ async toPerson() {
116
+ const instructor = await this.instructor;
117
+ return await instructor.toPerson();
118
+ }
119
+ async getInstructor() {
120
+ return await this.instructor;
121
+ }
122
+ async canReinstate() {
123
+ const instructor = await this.getInstructor();
124
+ return this.status === common_1.AccountStatus.Closed && instructor.status === common_1.AccountStatus.Active;
125
+ }
126
+ async getActivities() {
127
+ const activities = [];
128
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
129
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
130
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
131
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
132
+ activities.push(await (0, utils_1.toActivity)(this.closedBy, common_1.ActivityType.closedBy));
133
+ activities.push(await (0, utils_1.toActivity)(this.closedOn, common_1.ActivityType.closedOn));
134
+ activities.push(await (0, utils_1.toActivity)(this.invitedBy, common_1.ActivityType.invitedBy));
135
+ activities.push(await (0, utils_1.toActivity)(this.invitedOn, common_1.ActivityType.invitedOn));
136
+ return activities.filter(a => a);
137
+ }
138
+ };
139
+ exports.CompanyInstructorEntity = CompanyInstructorEntity;
140
+ __decorate([
141
+ (0, typeorm_1.Column)(),
142
+ __metadata("design:type", Number)
143
+ ], CompanyInstructorEntity.prototype, "instructorId", void 0);
144
+ __decorate([
145
+ (0, typeorm_1.Column)(),
146
+ __metadata("design:type", Number)
147
+ ], CompanyInstructorEntity.prototype, "companyId", void 0);
148
+ __decorate([
149
+ (0, typeorm_1.Column)({
150
+ type: 'enum',
151
+ enum: common_1.AccountStatus,
152
+ default: common_1.AccountStatus.Invited,
153
+ nullable: false
154
+ }),
155
+ __metadata("design:type", String)
156
+ ], CompanyInstructorEntity.prototype, "status", void 0);
157
+ __decorate([
158
+ (0, typeorm_1.Column)({
159
+ type: 'enum',
160
+ enum: common_2.CompanyRole,
161
+ default: common_2.CompanyRole.Instructor,
162
+ nullable: false
163
+ }),
164
+ __metadata("design:type", String)
165
+ ], CompanyInstructorEntity.prototype, "role", void 0);
166
+ __decorate([
167
+ (0, typeorm_1.Column)({
168
+ type: 'simple-json',
169
+ nullable: true,
170
+ default: null
171
+ }),
172
+ __metadata("design:type", Array)
173
+ ], CompanyInstructorEntity.prototype, "workingHours", void 0);
174
+ __decorate([
175
+ (0, typeorm_1.Column)({
176
+ type: 'simple-json',
177
+ nullable: true,
178
+ default: null
179
+ }),
180
+ __metadata("design:type", Array)
181
+ ], CompanyInstructorEntity.prototype, "holidays", void 0);
182
+ __decorate([
183
+ (0, typeorm_1.Column)({
184
+ type: 'simple-json',
185
+ nullable: true,
186
+ default: null
187
+ }),
188
+ __metadata("design:type", Array)
189
+ ], CompanyInstructorEntity.prototype, "preferences", void 0);
190
+ __decorate([
191
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
192
+ __metadata("design:type", Date)
193
+ ], CompanyInstructorEntity.prototype, "startedOn", void 0);
194
+ __decorate([
195
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
196
+ __metadata("design:type", Number)
197
+ ], CompanyInstructorEntity.prototype, "invitedBy", void 0);
198
+ __decorate([
199
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
200
+ __metadata("design:type", Date)
201
+ ], CompanyInstructorEntity.prototype, "invitedOn", void 0);
202
+ __decorate([
203
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
204
+ __metadata("design:type", Number)
205
+ ], CompanyInstructorEntity.prototype, "closedBy", void 0);
206
+ __decorate([
207
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
208
+ __metadata("design:type", Date)
209
+ ], CompanyInstructorEntity.prototype, "closedOn", void 0);
210
+ __decorate([
211
+ (0, typeorm_1.ManyToOne)(() => instructor_entity_1.InstructorEntity, instructor => instructor.companies),
212
+ __metadata("design:type", Promise)
213
+ ], CompanyInstructorEntity.prototype, "instructor", void 0);
214
+ __decorate([
215
+ (0, typeorm_1.ManyToOne)(() => company_entity_1.CompanyEntity, company => company.instructors),
216
+ __metadata("design:type", Promise)
217
+ ], CompanyInstructorEntity.prototype, "company", void 0);
218
+ __decorate([
219
+ (0, typeorm_1.OneToMany)(() => course_entity_1.CompanyCourseEntity, training => training.instructor),
220
+ __metadata("design:type", Promise)
221
+ ], CompanyInstructorEntity.prototype, "companyCourses", void 0);
222
+ __decorate([
223
+ (0, typeorm_1.OneToMany)(() => lesson_entity_1.CompanyCourseLessonEntity, lesson => lesson.instructor),
224
+ __metadata("design:type", Promise)
225
+ ], CompanyInstructorEntity.prototype, "companyCourseLessons", void 0);
226
+ __decorate([
227
+ (0, typeorm_1.OneToMany)(() => appointment_entity_2.CompanyCourseAppointmentEntity, appointment => appointment.instructor),
228
+ __metadata("design:type", Promise)
229
+ ], CompanyInstructorEntity.prototype, "companyCourseAppointments", void 0);
230
+ __decorate([
231
+ (0, typeorm_1.OneToMany)(() => handover_entity_1.CompanyHandoverEntity, handover => handover.instructor),
232
+ __metadata("design:type", Promise)
233
+ ], CompanyInstructorEntity.prototype, "companyHandovers", void 0);
234
+ __decorate([
235
+ (0, typeorm_1.OneToMany)(() => training_entity_1.StudentTrainingEntity, training => training.instructor),
236
+ __metadata("design:type", Promise)
237
+ ], CompanyInstructorEntity.prototype, "studentTrainings", void 0);
238
+ __decorate([
239
+ (0, typeorm_1.OneToMany)(() => lesson_entity_2.StudentTrainingLessonEntity, lesson => lesson.instructor),
240
+ __metadata("design:type", Promise)
241
+ ], CompanyInstructorEntity.prototype, "studentTrainingLessons", void 0);
242
+ __decorate([
243
+ (0, typeorm_1.OneToMany)(() => appointment_entity_1.StudentTrainingAppointmentEntity, appointment => appointment.instructor),
244
+ __metadata("design:type", Promise)
245
+ ], CompanyInstructorEntity.prototype, "studentTrainingAppointments", void 0);
246
+ __decorate([
247
+ (0, typeorm_1.OneToMany)(() => task_entity_1.CompanyInstructorTaskEntity, task => task.instructor),
248
+ __metadata("design:type", Promise)
249
+ ], CompanyInstructorEntity.prototype, "tasks", void 0);
250
+ exports.CompanyInstructorEntity = CompanyInstructorEntity = __decorate([
251
+ (0, typeorm_1.Entity)('companyInstructors'),
252
+ __metadata("design:paramtypes", [Object])
253
+ ], CompanyInstructorEntity);
254
+ //# sourceMappingURL=instructor.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructor.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/instructor/instructor.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4CAAoF;AACpF,4CAAiF;AACjF,sDAAkD;AAClD,+CAA4D;AAC5D,0EAAsE;AACtE,0EAA6E;AAC7E,2DAA8D;AAC9D,2DAAoE;AACpE,oFAAuF;AACvF,0FAAqG;AACrG,qEAA8E;AAC9E,gFAA2F;AAC3F,0CAA6D;AAGtD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,uBAA2B;IAGvE,YAAY,CAAS;IAGrB,SAAS,CAAS;IAQlB,MAAM,CAAgB;IAQtB,IAAI,CAAc;IAElB;;;OAGG;IAMH,YAAY,CAAiB;IAE7B;;;OAGG;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AM,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC;;qEACb;AAM3D;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,mDAA8B,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC;;0EAClB;AAMrE;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;;iEACrB;AAMnD;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;;iEACrB;AAMnD;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAA2B,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC;;uEACX;AAM/D;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qDAAgC,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC;;4EAChB;AAMzE;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,yCAA2B,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;;sDACxB;kCAjIlC,uBAAuB;IADnC,IAAA,gBAAM,EAAC,oBAAoB,CAAC;;GAChB,uBAAuB,CAwLnC"}
@@ -0,0 +1,60 @@
1
+ import { Activity, Task } from '@driveup/common';
2
+ import { CompanyInstructorEntity } from './instructor.entity';
3
+ import { TrackableEntity } from '../../../utils';
4
+ /**
5
+ * Represents a task or calendar event for a company instructor.
6
+ * Tasks can represent scheduled work, appointments, meetings, or other time blocks.
7
+ * Tracks availability and completion status for scheduling purposes.
8
+ *
9
+ * @extends TrackableEntity<Task>
10
+ */
11
+ export declare class CompanyInstructorTaskEntity extends TrackableEntity<Task> {
12
+ /**
13
+ * Reference to the instructor who owns this task
14
+ */
15
+ instructorId: number;
16
+ /**
17
+ * Task title or description
18
+ */
19
+ title: string;
20
+ /**
21
+ * Task start date and time
22
+ */
23
+ startDate: Date;
24
+ /**
25
+ * Task end date and time
26
+ */
27
+ endDate: Date;
28
+ /**
29
+ * Whether the task spans the entire day
30
+ * @default false
31
+ */
32
+ allDay: boolean;
33
+ /**
34
+ * Whether the instructor is busy during this time
35
+ * Used for scheduling conflicts
36
+ * @default true
37
+ */
38
+ busy: boolean;
39
+ /**
40
+ * Whether the task has been completed
41
+ * @default false
42
+ */
43
+ done: boolean;
44
+ /**
45
+ * Reference to the instructor who owns this task
46
+ */
47
+ instructor: Promise<CompanyInstructorEntity>;
48
+ /**
49
+ * Creates an instance of CompanyInstructorTaskEntity
50
+ * @param props - Partial properties to initialize the entity
51
+ */
52
+ constructor(props?: Partial<CompanyInstructorTaskEntity>);
53
+ /**
54
+ * Converts the entity to a Task model instance
55
+ * @returns Task model with all task information
56
+ */
57
+ toModel(): Task;
58
+ toSummary(): Task;
59
+ getActivities(): Promise<Activity[]>;
60
+ }
@@ -0,0 +1,133 @@
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.CompanyInstructorTaskEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const instructor_entity_1 = require("./instructor.entity");
16
+ const utils_1 = require("../../../utils");
17
+ /**
18
+ * Represents a task or calendar event for a company instructor.
19
+ * Tasks can represent scheduled work, appointments, meetings, or other time blocks.
20
+ * Tracks availability and completion status for scheduling purposes.
21
+ *
22
+ * @extends TrackableEntity<Task>
23
+ */
24
+ let CompanyInstructorTaskEntity = class CompanyInstructorTaskEntity extends utils_1.TrackableEntity {
25
+ /**
26
+ * Reference to the instructor who owns this task
27
+ */
28
+ instructorId;
29
+ /**
30
+ * Task title or description
31
+ */
32
+ title;
33
+ /**
34
+ * Task start date and time
35
+ */
36
+ startDate;
37
+ /**
38
+ * Task end date and time
39
+ */
40
+ endDate;
41
+ /**
42
+ * Whether the task spans the entire day
43
+ * @default false
44
+ */
45
+ allDay;
46
+ /**
47
+ * Whether the instructor is busy during this time
48
+ * Used for scheduling conflicts
49
+ * @default true
50
+ */
51
+ busy;
52
+ /**
53
+ * Whether the task has been completed
54
+ * @default false
55
+ */
56
+ done;
57
+ /**
58
+ * Reference to the instructor who owns this task
59
+ */
60
+ instructor;
61
+ /**
62
+ * Creates an instance of CompanyInstructorTaskEntity
63
+ * @param props - Partial properties to initialize the entity
64
+ */
65
+ constructor(props) {
66
+ super();
67
+ Object.assign(this, props);
68
+ }
69
+ /**
70
+ * Converts the entity to a Task model instance
71
+ * @returns Task model with all task information
72
+ */
73
+ toModel() {
74
+ return new common_1.Task({
75
+ id: this.id,
76
+ title: this.title,
77
+ startDate: this.startDate,
78
+ endDate: this.endDate,
79
+ allDay: this.allDay,
80
+ busy: this.busy,
81
+ done: this.done
82
+ });
83
+ }
84
+ toSummary() {
85
+ return this.toModel();
86
+ }
87
+ async getActivities() {
88
+ const activities = [];
89
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
90
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
91
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
92
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
93
+ return activities.filter(a => a);
94
+ }
95
+ };
96
+ exports.CompanyInstructorTaskEntity = CompanyInstructorTaskEntity;
97
+ __decorate([
98
+ (0, typeorm_1.Column)(),
99
+ __metadata("design:type", Number)
100
+ ], CompanyInstructorTaskEntity.prototype, "instructorId", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)(),
103
+ __metadata("design:type", String)
104
+ ], CompanyInstructorTaskEntity.prototype, "title", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)(),
107
+ __metadata("design:type", Date)
108
+ ], CompanyInstructorTaskEntity.prototype, "startDate", void 0);
109
+ __decorate([
110
+ (0, typeorm_1.Column)(),
111
+ __metadata("design:type", Date)
112
+ ], CompanyInstructorTaskEntity.prototype, "endDate", void 0);
113
+ __decorate([
114
+ (0, typeorm_1.Column)({ default: false }),
115
+ __metadata("design:type", Boolean)
116
+ ], CompanyInstructorTaskEntity.prototype, "allDay", void 0);
117
+ __decorate([
118
+ (0, typeorm_1.Column)({ default: true }),
119
+ __metadata("design:type", Boolean)
120
+ ], CompanyInstructorTaskEntity.prototype, "busy", void 0);
121
+ __decorate([
122
+ (0, typeorm_1.Column)({ default: false }),
123
+ __metadata("design:type", Boolean)
124
+ ], CompanyInstructorTaskEntity.prototype, "done", void 0);
125
+ __decorate([
126
+ (0, typeorm_1.ManyToOne)(() => instructor_entity_1.CompanyInstructorEntity, instructor => instructor.tasks),
127
+ __metadata("design:type", Promise)
128
+ ], CompanyInstructorTaskEntity.prototype, "instructor", void 0);
129
+ exports.CompanyInstructorTaskEntity = CompanyInstructorTaskEntity = __decorate([
130
+ (0, typeorm_1.Entity)('companyInstructorTasks'),
131
+ __metadata("design:paramtypes", [Object])
132
+ ], CompanyInstructorTaskEntity);
133
+ //# sourceMappingURL=task.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/instructor/task.entity.ts"],"names":[],"mappings":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