@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,78 @@
1
+ import { Activity, StatusType, StudentProgram } from '@driveup/common';
2
+ import { StudentEntity } from '../student.entity';
3
+ import { ProgramEntity } from '../../../catalog/program/program.entity';
4
+ import { StudentMedicalCertificateEntity } from './medical/certificate.entity';
5
+ import { StudentLicenceEntity } from './licence/licence.entity';
6
+ import { StudentTrainingEntity } from './training/training.entity';
7
+ import { StudentTrainingRequestEntity } from './training/request.entity';
8
+ import { TrackableEntity } from '../../../utils';
9
+ export declare class StudentProgramEntity extends TrackableEntity<StudentProgram> {
10
+ /**
11
+ * Reference to the student enrolled in this program
12
+ */
13
+ studentId: number;
14
+ /**
15
+ * Reference to the system program template this enrollment is based on
16
+ */
17
+ programId: number;
18
+ /**
19
+ * Current status of the student's program enrollment
20
+ * Can be Progress, Completed, or Terminated
21
+ * @default StatusType.Progress
22
+ */
23
+ status: StatusType;
24
+ /**
25
+ * Date when the student began the program
26
+ */
27
+ startDate: Date;
28
+ /**
29
+ * Date when the student completed or terminated the program
30
+ */
31
+ endDate: Date;
32
+ /**
33
+ * Total program cost
34
+ * Sum of all products linked to the program
35
+ */
36
+ cost: number;
37
+ /**
38
+ * ID of the user who closed/terminated this program
39
+ */
40
+ closedBy: number;
41
+ /**
42
+ * Timestamp when this program was closed/terminated
43
+ */
44
+ closedOn: Date;
45
+ /**
46
+ * Student relation
47
+ */
48
+ student: Promise<StudentEntity>;
49
+ /**
50
+ * Driveup program relation
51
+ */
52
+ program: Promise<ProgramEntity>;
53
+ /**
54
+ * Student medical certificates
55
+ * The same certificate can be linked to multiple student programs
56
+ */
57
+ certificates: Promise<StudentMedicalCertificateEntity[]>;
58
+ /**
59
+ * Student licences
60
+ * The same licences can be linked to multiple student programs
61
+ */
62
+ licences: Promise<StudentLicenceEntity[]>;
63
+ /**
64
+ * All trainings linked to this student program
65
+ * The trainings type and progress flow its controled by the driveup country student programs
66
+ */
67
+ trainings: Promise<StudentTrainingEntity[]>;
68
+ /**
69
+ * All training requests linked to this student program
70
+ */
71
+ requestes: Promise<StudentTrainingRequestEntity[]>;
72
+ toModel(): Promise<StudentProgram>;
73
+ toSummary(): Promise<StudentProgram>;
74
+ constructor(props?: Partial<ProgramEntity>);
75
+ getStudent(): Promise<StudentEntity>;
76
+ getProgram(): Promise<ProgramEntity>;
77
+ getActivities(): Promise<Activity[]>;
78
+ }
@@ -0,0 +1,225 @@
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.StudentProgramEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const student_entity_1 = require("../student.entity");
16
+ const program_entity_1 = require("../../../catalog/program/program.entity");
17
+ const certificate_entity_1 = require("./medical/certificate.entity");
18
+ const licence_entity_1 = require("./licence/licence.entity");
19
+ const training_entity_1 = require("./training/training.entity");
20
+ const request_entity_1 = require("./training/request.entity");
21
+ const utils_1 = require("../../../utils");
22
+ let StudentProgramEntity = class StudentProgramEntity extends utils_1.TrackableEntity {
23
+ /**
24
+ * Reference to the student enrolled in this program
25
+ */
26
+ studentId;
27
+ /**
28
+ * Reference to the system program template this enrollment is based on
29
+ */
30
+ programId;
31
+ /**
32
+ * Current status of the student's program enrollment
33
+ * Can be Progress, Completed, or Terminated
34
+ * @default StatusType.Progress
35
+ */
36
+ status;
37
+ /**
38
+ * Date when the student began the program
39
+ */
40
+ startDate;
41
+ /**
42
+ * Date when the student completed or terminated the program
43
+ */
44
+ endDate;
45
+ /**
46
+ * Total program cost
47
+ * Sum of all products linked to the program
48
+ */
49
+ cost;
50
+ /**
51
+ * ID of the user who closed/terminated this program
52
+ */
53
+ closedBy;
54
+ /**
55
+ * Timestamp when this program was closed/terminated
56
+ */
57
+ closedOn;
58
+ /**
59
+ * Student relation
60
+ */
61
+ student;
62
+ /**
63
+ * Driveup program relation
64
+ */
65
+ program;
66
+ /**
67
+ * Student medical certificates
68
+ * The same certificate can be linked to multiple student programs
69
+ */
70
+ certificates;
71
+ /**
72
+ * Student licences
73
+ * The same licences can be linked to multiple student programs
74
+ */
75
+ licences;
76
+ /**
77
+ * All trainings linked to this student program
78
+ * The trainings type and progress flow its controled by the driveup country student programs
79
+ */
80
+ trainings;
81
+ /**
82
+ * All training requests linked to this student program
83
+ */
84
+ requestes;
85
+ async toModel() {
86
+ const program = await (await this.program)?.toSummary();
87
+ const student = await (await this.student)?.toSummary();
88
+ const certificates = await Promise.all((await this.certificates)?.map(t => t.toSummary()));
89
+ const licences = await Promise.all((await this.licences)?.map(t => t.toSummary()));
90
+ const trainings = await Promise.all((await this.trainings)?.map(t => t.toSummary()));
91
+ return new common_1.StudentProgram({
92
+ id: this.id,
93
+ program: program,
94
+ student: student,
95
+ certificates: certificates,
96
+ licences: licences,
97
+ trainings: trainings,
98
+ status: this.status,
99
+ startDate: this.startDate,
100
+ endDate: this.endDate,
101
+ cost: this.cost,
102
+ });
103
+ }
104
+ async toSummary() {
105
+ const program = await (await this.program)?.toSummary();
106
+ const student = await (await this.student)?.toSummary();
107
+ return new common_1.StudentProgram({
108
+ id: this.id,
109
+ program: program,
110
+ student: student,
111
+ status: this.status,
112
+ startDate: this.startDate,
113
+ endDate: this.endDate,
114
+ cost: this.cost,
115
+ });
116
+ }
117
+ constructor(props) {
118
+ super();
119
+ Object.assign(this, props);
120
+ }
121
+ async getStudent() {
122
+ return await this.student;
123
+ }
124
+ async getProgram() {
125
+ return await this.program;
126
+ }
127
+ async getActivities() {
128
+ const activities = [];
129
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
130
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
131
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
132
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
133
+ return activities.filter(a => a);
134
+ }
135
+ };
136
+ exports.StudentProgramEntity = StudentProgramEntity;
137
+ __decorate([
138
+ (0, typeorm_1.Column)(),
139
+ __metadata("design:type", Number)
140
+ ], StudentProgramEntity.prototype, "studentId", void 0);
141
+ __decorate([
142
+ (0, typeorm_1.Column)(),
143
+ __metadata("design:type", Number)
144
+ ], StudentProgramEntity.prototype, "programId", void 0);
145
+ __decorate([
146
+ (0, typeorm_1.Column)({
147
+ type: 'enum',
148
+ enum: [
149
+ common_1.StatusType.Progress,
150
+ common_1.StatusType.Completed,
151
+ common_1.StatusType.Terminated,
152
+ ],
153
+ default: common_1.StatusType.Progress,
154
+ nullable: false
155
+ }),
156
+ __metadata("design:type", String)
157
+ ], StudentProgramEntity.prototype, "status", void 0);
158
+ __decorate([
159
+ (0, typeorm_1.Column)(),
160
+ __metadata("design:type", Date)
161
+ ], StudentProgramEntity.prototype, "startDate", void 0);
162
+ __decorate([
163
+ (0, typeorm_1.Column)({
164
+ nullable: true,
165
+ default: false
166
+ }),
167
+ __metadata("design:type", Date)
168
+ ], StudentProgramEntity.prototype, "endDate", void 0);
169
+ __decorate([
170
+ (0, typeorm_1.Column)({
171
+ type: 'decimal',
172
+ precision: 8,
173
+ scale: 2,
174
+ nullable: false,
175
+ default: 0
176
+ }),
177
+ __metadata("design:type", Number)
178
+ ], StudentProgramEntity.prototype, "cost", void 0);
179
+ __decorate([
180
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
181
+ __metadata("design:type", Number)
182
+ ], StudentProgramEntity.prototype, "closedBy", void 0);
183
+ __decorate([
184
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
185
+ __metadata("design:type", Date)
186
+ ], StudentProgramEntity.prototype, "closedOn", void 0);
187
+ __decorate([
188
+ (0, typeorm_1.ManyToOne)(() => student_entity_1.StudentEntity, student => student.programs),
189
+ __metadata("design:type", Promise)
190
+ ], StudentProgramEntity.prototype, "student", void 0);
191
+ __decorate([
192
+ (0, typeorm_1.ManyToOne)(() => program_entity_1.ProgramEntity, program => program.studentPrograms),
193
+ __metadata("design:type", Promise)
194
+ ], StudentProgramEntity.prototype, "program", void 0);
195
+ __decorate([
196
+ (0, typeorm_1.ManyToMany)(() => certificate_entity_1.StudentMedicalCertificateEntity, (certificate) => certificate.programs, { cascade: true }),
197
+ (0, typeorm_1.JoinTable)({
198
+ name: "studentProgramCertificates", // junction table
199
+ joinColumn: { name: "programId", referencedColumnName: "id" },
200
+ inverseJoinColumn: { name: "certificateId", referencedColumnName: "id" },
201
+ }),
202
+ __metadata("design:type", Promise)
203
+ ], StudentProgramEntity.prototype, "certificates", void 0);
204
+ __decorate([
205
+ (0, typeorm_1.ManyToMany)(() => licence_entity_1.StudentLicenceEntity, licence => licence.programs, { cascade: true }),
206
+ (0, typeorm_1.JoinTable)({
207
+ name: "studentProgramLicences", // junction table
208
+ joinColumn: { name: "programId", referencedColumnName: "id" },
209
+ inverseJoinColumn: { name: "licenceId", referencedColumnName: "id" },
210
+ }),
211
+ __metadata("design:type", Promise)
212
+ ], StudentProgramEntity.prototype, "licences", void 0);
213
+ __decorate([
214
+ (0, typeorm_1.OneToMany)(() => training_entity_1.StudentTrainingEntity, preperation => preperation.program),
215
+ __metadata("design:type", Promise)
216
+ ], StudentProgramEntity.prototype, "trainings", void 0);
217
+ __decorate([
218
+ (0, typeorm_1.OneToMany)(() => request_entity_1.StudentTrainingRequestEntity, preperation => preperation.program),
219
+ __metadata("design:type", Promise)
220
+ ], StudentProgramEntity.prototype, "requestes", void 0);
221
+ exports.StudentProgramEntity = StudentProgramEntity = __decorate([
222
+ (0, typeorm_1.Entity)('studentPrograms'),
223
+ __metadata("design:paramtypes", [Object])
224
+ ], StudentProgramEntity);
225
+ //# sourceMappingURL=program.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.entity.js","sourceRoot":"","sources":["../../../../src/profile/student/program/program.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAsF;AACtF,4CAAqF;AACrF,sDAAkD;AAClD,4EAAwE;AACxE,qEAA+E;AAC/E,6DAAgE;AAChE,gEAAmE;AACnE,8DAAyE;AACzE,0CAA6D;AAGtD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,uBAA+B;IAExE;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,SAAS,CAAS;IAElB;;;;OAIG;IAWH,MAAM,CAAa;IAEnB;;OAEG;IAEH,SAAS,CAAO;IAEhB;;OAEG;IAKH,OAAO,CAAO;IAEd;;;OAGG;IAQH,IAAI,CAAS;IAEb;;OAEG;IAEH,QAAQ,CAAS;IAEjB;;OAEG;IAEH,QAAQ,CAAO;IAEf;;OAEG;IAEH,OAAO,CAAyB;IAEhC;;OAEG;IAEH,OAAO,CAAyB;IAEhC;;;OAGG;IAWH,YAAY,CAA6C;IAEzD;;;OAGG;IAWH,QAAQ,CAAkC;IAE1C;;;OAGG;IAEH,SAAS,CAAmC;IAE5C;;OAEG;IAEH,SAAS,CAA0C;IAEnD,KAAK,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,MAAM,CAAC,M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A,mBAAS,EAAC;QACV,IAAI,EAAE,4BAA4B,EAAE,iBAAiB;QACrD,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE;QAC7D,iBAAiB,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,oBAAoB,EAAE,IAAI,EAAE;KACxE,CAAC;;0DACuD;AAgBzD;IAVC,IAAA,oBAAU,EACV,GAAG,EAAE,CAAC,qCAAoB,EAC1B,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAC3B,EAAE,OAAO,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,mBAAS,EAAC;QACV,IAAI,EAAE,wBAAwB,EAAE,iBAAiB;QACjD,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE;QAC7D,iBAAiB,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE;KACpE,CAAC;;sDACwC;AAO1C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;uDAC/B;AAM5C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,6CAA4B,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;uDAC/B;+BA9HvC,oBAAoB;IADhC,IAAA,gBAAM,EAAC,iBAAiB,CAAC;;GACb,oBAAoB,CAuLhC"}
@@ -0,0 +1,151 @@
1
+ import { Appointment, StatusType, TopicProgress, SkillScore, Note, AppointmentType } from '@driveup/common';
2
+ import { Address, Activity, TrainingSession } from '@driveup/common';
3
+ import { StudentTrainingEntity } from './training.entity';
4
+ import { StudentTrainingLessonEntity } from './lesson.entity';
5
+ import { CompanyCourseAppointmentEntity } from '../../../company/course/appointment.entity';
6
+ import { CompanyInstructorEntity } from '../../../company/instructor/instructor.entity';
7
+ import { StudentTrainingExamEntity } from './exam.entity';
8
+ import { TrackableEntity } from '../../../../utils';
9
+ export declare class StudentTrainingAppointmentEntity extends TrackableEntity<Appointment> {
10
+ /**
11
+ * Reference to the training this appointment belongs to
12
+ */
13
+ trainingId: number;
14
+ /**
15
+ * Student training lesson relation
16
+ * Keep reference to lesson in case by in progress training the lesson is updated or deleted
17
+ * This reference is mandatory only by course training appointments
18
+ */
19
+ lessonId: number;
20
+ /**
21
+ * Only for company course trainings with flexible appointments
22
+ */
23
+ definitionId: number;
24
+ /**
25
+ * Only for student driving trainings
26
+ * Each session appointment can have a different instructor
27
+ */
28
+ instructorId: number;
29
+ /**
30
+ * Ensure consistency with Product.appointmentType
31
+ * Shortcut to avoid joins when fetching student appointments
32
+ */
33
+ type: AppointmentType;
34
+ /**
35
+ * Current status of the appointment (Planned, Completed, or Canceled)
36
+ * @default StatusType.Planned
37
+ */
38
+ status: StatusType;
39
+ /**
40
+ * Appointment date
41
+ */
42
+ startDate: Date;
43
+ /**
44
+ * Appointment end date
45
+ * @description In Flexible courses, this field is set to null, and will be calculated each time based on the appointment duration
46
+ * @description In Fixed courses, this field must have a value, which is equal to the part.endDate
47
+ */
48
+ endDate: Date;
49
+ /**
50
+ * Indicate if the student attended the appointment
51
+ */
52
+ attended: boolean;
53
+ /**
54
+ * Appointment price for the student
55
+ * Currently implemented oonly by driving trainings
56
+ */
57
+ price: number;
58
+ /**
59
+ * Appointment session duration in minutes
60
+ * Currently implemented oonly by driving trainings
61
+ */
62
+ duration: number;
63
+ /**
64
+ * Appointment location
65
+ * Currently implemented oonly by driving trainings
66
+ */
67
+ location: Address;
68
+ /**
69
+ * Indicate if the appointment is an exam
70
+ * Currently implemented oonly by driving trainings
71
+ */
72
+ isExam: boolean;
73
+ /**
74
+ * Whether the student is charged for this appointment or not
75
+ * (used if the appointment is canceled)
76
+ */
77
+ charged: boolean;
78
+ /**
79
+ * Student signature image URL for the appointment
80
+ */
81
+ signatureUrl: string;
82
+ /**
83
+ * Lesson topics invloved in the appointment with scores
84
+ * Currently implemented oonly by driving trainings
85
+ */
86
+ topics: TopicProgress[];
87
+ /**
88
+ * Lesson skills involved in the appointment with scores
89
+ * Currently implemented oonly by driving trainings
90
+ */
91
+ skills: SkillScore[];
92
+ /**
93
+ * Notes related to the appointment
94
+ */
95
+ note: Note;
96
+ /**
97
+ * Timestamp when the student was reminded about this appointment
98
+ */
99
+ remindedOn: Date;
100
+ /**
101
+ * Timestamp when the appointment was last rescheduled
102
+ */
103
+ rescheduledOn: Date;
104
+ /**
105
+ * ID of the user who rescheduled the appointment
106
+ */
107
+ rescheduledBy: number;
108
+ /**
109
+ * Timestamp when the appointment was canceled
110
+ */
111
+ canceledOn: Date;
112
+ /**
113
+ * ID of the user who canceled the appointment
114
+ */
115
+ canceledBy: number;
116
+ /**
117
+ * Student training this appointment belongs to
118
+ */
119
+ training: Promise<StudentTrainingEntity>;
120
+ /**
121
+ * Student training lesson relation
122
+ * Each student training lesson (only for course trainings) will be linked to its appointments
123
+ * For driving trainings this relation will be allways empty
124
+ */
125
+ lesson: Promise<StudentTrainingLessonEntity>;
126
+ /**
127
+ * Company training appointment definition relation
128
+ * Each company training appointment definition (only for course trainings with flexible appointments) will be linked to its student appointments
129
+ * For driving trainings and fixed course trainings this relation will be allways empty
130
+ */
131
+ definition: Promise<CompanyCourseAppointmentEntity>;
132
+ /**
133
+ * Company instructor relation
134
+ */
135
+ instructor: Promise<CompanyInstructorEntity>;
136
+ /**
137
+ * Student training exam relation
138
+ */
139
+ exam: Promise<StudentTrainingExamEntity>;
140
+ constructor(props?: Partial<StudentTrainingAppointmentEntity>);
141
+ toModel(): Promise<Appointment>;
142
+ toSummary(): Appointment;
143
+ /**
144
+ * Student traning session
145
+ * Extended version of appointment with training session details
146
+ * @returns TrainingSession
147
+ */
148
+ toSession(): Promise<TrainingSession>;
149
+ isFixed(): Promise<boolean>;
150
+ getActivities(): Promise<Activity[]>;
151
+ }