@driveup/schema 0.2.6 → 0.2.9

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 (220) hide show
  1. package/lib/catalog/addon/addon.entity.d.ts +3 -3
  2. package/lib/catalog/addon/addon.entity.js +7 -7
  3. package/lib/catalog/addon/addon.entity.js.map +1 -1
  4. package/lib/catalog/addon/country.entity.d.ts +4 -4
  5. package/lib/catalog/addon/country.entity.js +5 -6
  6. package/lib/catalog/addon/country.entity.js.map +1 -1
  7. package/lib/catalog/priceplan/priceplan.entity.d.ts +8 -3
  8. package/lib/catalog/priceplan/priceplan.entity.js +14 -7
  9. package/lib/catalog/priceplan/priceplan.entity.js.map +1 -1
  10. package/lib/catalog/product/country.entity.d.ts +6 -6
  11. package/lib/catalog/product/country.entity.js +9 -10
  12. package/lib/catalog/product/country.entity.js.map +1 -1
  13. package/lib/catalog/product/priceplan.entity.d.ts +9 -4
  14. package/lib/catalog/product/priceplan.entity.js +19 -9
  15. package/lib/catalog/product/priceplan.entity.js.map +1 -1
  16. package/lib/catalog/product/product.entity.d.ts +3 -3
  17. package/lib/catalog/product/product.entity.js +8 -8
  18. package/lib/catalog/product/product.entity.js.map +1 -1
  19. package/lib/catalog/program/program.entity.d.ts +2 -2
  20. package/lib/catalog/program/program.entity.js +7 -7
  21. package/lib/catalog/program/program.entity.js.map +1 -1
  22. package/lib/catalog/seed/assets/asset.entity.d.ts +2 -2
  23. package/lib/catalog/seed/assets/asset.entity.js +6 -6
  24. package/lib/catalog/seed/assets/asset.entity.js.map +1 -1
  25. package/lib/catalog/seed/courses/course.entity.d.ts +4 -4
  26. package/lib/catalog/seed/courses/course.entity.js +9 -9
  27. package/lib/catalog/seed/courses/course.entity.js.map +1 -1
  28. package/lib/catalog/seed/courses/lesson.entity.d.ts +3 -3
  29. package/lib/catalog/seed/courses/lesson.entity.js +7 -7
  30. package/lib/catalog/seed/courses/lesson.entity.js.map +1 -1
  31. package/lib/catalog/seed/courses/topic.entity.d.ts +3 -3
  32. package/lib/catalog/seed/courses/topic.entity.js +8 -8
  33. package/lib/catalog/seed/courses/topic.entity.js.map +1 -1
  34. package/lib/catalog/seed/expense/category.entity.d.ts +2 -2
  35. package/lib/catalog/seed/expense/category.entity.js +6 -6
  36. package/lib/catalog/seed/expense/category.entity.js.map +1 -1
  37. package/lib/index.d.ts +2 -2
  38. package/lib/index.js +2 -2
  39. package/lib/index.js.map +1 -1
  40. package/lib/profile/agent/agent.entity.d.ts +13 -4
  41. package/lib/profile/agent/agent.entity.js +46 -20
  42. package/lib/profile/agent/agent.entity.js.map +1 -1
  43. package/lib/profile/agent/asset.entity.d.ts +1 -1
  44. package/lib/profile/agent/asset.entity.js +2 -2
  45. package/lib/profile/agent/asset.entity.js.map +1 -1
  46. package/lib/profile/agent/payout.entity.d.ts +3 -3
  47. package/lib/profile/agent/payout.entity.js +6 -6
  48. package/lib/profile/agent/payout.entity.js.map +1 -1
  49. package/lib/profile/agent/promotion.entity.d.ts +3 -3
  50. package/lib/profile/agent/promotion.entity.js +6 -6
  51. package/lib/profile/agent/promotion.entity.js.map +1 -1
  52. package/lib/profile/company/company.entity.d.ts +80 -9
  53. package/lib/profile/company/company.entity.js +246 -36
  54. package/lib/profile/company/company.entity.js.map +1 -1
  55. package/lib/profile/company/course/appointment.entity.d.ts +73 -4
  56. package/lib/profile/company/course/appointment.entity.js +247 -0
  57. package/lib/profile/company/course/appointment.entity.js.map +1 -1
  58. package/lib/profile/company/course/course.entity.d.ts +41 -8
  59. package/lib/profile/company/course/course.entity.js +58 -12
  60. package/lib/profile/company/course/course.entity.js.map +1 -1
  61. package/lib/profile/company/course/lesson.entity.d.ts +30 -7
  62. package/lib/profile/company/course/lesson.entity.js +93 -12
  63. package/lib/profile/company/course/lesson.entity.js.map +1 -1
  64. package/lib/profile/company/course/schedule.entity.d.ts +276 -0
  65. package/lib/profile/company/course/schedule.entity.js +744 -0
  66. package/lib/profile/company/course/schedule.entity.js.map +1 -0
  67. package/lib/profile/company/course/topic.entity.d.ts +9 -4
  68. package/lib/profile/company/course/topic.entity.js +14 -7
  69. package/lib/profile/company/course/topic.entity.js.map +1 -1
  70. package/lib/profile/company/finances/billing/bill.entity.d.ts +9 -2
  71. package/lib/profile/company/finances/billing/bill.entity.js +38 -4
  72. package/lib/profile/company/finances/billing/bill.entity.js.map +1 -1
  73. package/lib/profile/company/finances/billing/item.entity.d.ts +8 -3
  74. package/lib/profile/company/finances/billing/item.entity.js +10 -6
  75. package/lib/profile/company/finances/billing/item.entity.js.map +1 -1
  76. package/lib/profile/company/finances/billing/transaction.entity.d.ts +7 -5
  77. package/lib/profile/company/finances/billing/transaction.entity.js +6 -6
  78. package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -1
  79. package/lib/profile/company/finances/expense/category.entity.d.ts +1 -1
  80. package/lib/profile/company/finances/expense/category.entity.js +4 -4
  81. package/lib/profile/company/finances/expense/category.entity.js.map +1 -1
  82. package/lib/profile/company/finances/expense/expense.entity.d.ts +6 -2
  83. package/lib/profile/company/finances/expense/expense.entity.js +32 -4
  84. package/lib/profile/company/finances/expense/expense.entity.js.map +1 -1
  85. package/lib/profile/company/finances/handover/handover.entity.d.ts +3 -3
  86. package/lib/profile/company/finances/handover/handover.entity.js +6 -6
  87. package/lib/profile/company/finances/handover/handover.entity.js.map +1 -1
  88. package/lib/profile/company/finances/invoice/invoice.entity.d.ts +8 -7
  89. package/lib/profile/company/finances/invoice/invoice.entity.js +15 -14
  90. package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -1
  91. package/lib/profile/company/finances/invoice/item.entity.d.ts +2 -2
  92. package/lib/profile/company/finances/invoice/item.entity.js +4 -4
  93. package/lib/profile/company/finances/invoice/item.entity.js.map +1 -1
  94. package/lib/profile/company/finances/payment/method.entity.d.ts +24 -4
  95. package/lib/profile/company/finances/payment/method.entity.js +40 -5
  96. package/lib/profile/company/finances/payment/method.entity.js.map +1 -1
  97. package/lib/profile/company/instructor/activity.entity.js.map +1 -1
  98. package/lib/profile/company/instructor/calendar-state.entity.js.map +1 -1
  99. package/lib/profile/company/instructor/instructor.entity.d.ts +34 -17
  100. package/lib/profile/company/instructor/instructor.entity.js +143 -25
  101. package/lib/profile/company/instructor/instructor.entity.js.map +1 -1
  102. package/lib/profile/company/instructor/task.entity.d.ts +2 -1
  103. package/lib/profile/company/instructor/task.entity.js +9 -4
  104. package/lib/profile/company/instructor/task.entity.js.map +1 -1
  105. package/lib/profile/company/medical/examination.entity.d.ts +4 -4
  106. package/lib/profile/company/medical/examination.entity.js +6 -6
  107. package/lib/profile/company/medical/examination.entity.js.map +1 -1
  108. package/lib/profile/company/medical/product.entity.d.ts +4 -5
  109. package/lib/profile/company/medical/product.entity.js +13 -14
  110. package/lib/profile/company/medical/product.entity.js.map +1 -1
  111. package/lib/profile/company/product/addon.entity.d.ts +3 -3
  112. package/lib/profile/company/product/addon.entity.js +6 -7
  113. package/lib/profile/company/product/addon.entity.js.map +1 -1
  114. package/lib/profile/company/product/priceplan.entity.d.ts +15 -13
  115. package/lib/profile/company/product/priceplan.entity.js +20 -16
  116. package/lib/profile/company/product/priceplan.entity.js.map +1 -1
  117. package/lib/profile/company/product/product.entity.d.ts +34 -8
  118. package/lib/profile/company/product/product.entity.js +70 -12
  119. package/lib/profile/company/product/product.entity.js.map +1 -1
  120. package/lib/profile/company/product/vehicle.entity.d.ts +2 -2
  121. package/lib/profile/company/product/vehicle.entity.js +4 -4
  122. package/lib/profile/company/product/vehicle.entity.js.map +1 -1
  123. package/lib/profile/instructor/instructor.entity.d.ts +6 -3
  124. package/lib/profile/instructor/instructor.entity.js +31 -9
  125. package/lib/profile/instructor/instructor.entity.js.map +1 -1
  126. package/lib/profile/student/program/licence/licence.entity.d.ts +13 -5
  127. package/lib/profile/student/program/licence/licence.entity.js +19 -8
  128. package/lib/profile/student/program/licence/licence.entity.js.map +1 -1
  129. package/lib/profile/student/program/medical/certificate.entity.d.ts +3 -3
  130. package/lib/profile/student/program/medical/certificate.entity.js +6 -6
  131. package/lib/profile/student/program/medical/certificate.entity.js.map +1 -1
  132. package/lib/profile/student/program/medical/examination.entity.d.ts +4 -4
  133. package/lib/profile/student/program/medical/examination.entity.js +14 -14
  134. package/lib/profile/student/program/medical/examination.entity.js.map +1 -1
  135. package/lib/profile/student/program/program.entity.d.ts +4 -4
  136. package/lib/profile/student/program/program.entity.js +8 -13
  137. package/lib/profile/student/program/program.entity.js.map +1 -1
  138. package/lib/profile/student/program/training/appointment.entity.d.ts +32 -9
  139. package/lib/profile/student/program/training/appointment.entity.js +144 -21
  140. package/lib/profile/student/program/training/appointment.entity.js.map +1 -1
  141. package/lib/profile/student/program/training/exam.entity.d.ts +9 -2
  142. package/lib/profile/student/program/training/exam.entity.js +28 -12
  143. package/lib/profile/student/program/training/exam.entity.js.map +1 -1
  144. package/lib/profile/student/program/training/lesson.entity.d.ts +8 -3
  145. package/lib/profile/student/program/training/lesson.entity.js +28 -6
  146. package/lib/profile/student/program/training/lesson.entity.js.map +1 -1
  147. package/lib/profile/student/program/training/request.entity.d.ts +6 -3
  148. package/lib/profile/student/program/training/request.entity.js +26 -5
  149. package/lib/profile/student/program/training/request.entity.js.map +1 -1
  150. package/lib/profile/student/program/training/topic.entity.d.ts +16 -4
  151. package/lib/profile/student/program/training/topic.entity.js +36 -9
  152. package/lib/profile/student/program/training/topic.entity.js.map +1 -1
  153. package/lib/profile/student/program/training/training.entity.d.ts +50 -6
  154. package/lib/profile/student/program/training/training.entity.js +217 -33
  155. package/lib/profile/student/program/training/training.entity.js.map +1 -1
  156. package/lib/profile/student/program/training/transaction.entity.d.ts +8 -3
  157. package/lib/profile/student/program/training/transaction.entity.js +43 -6
  158. package/lib/profile/student/program/training/transaction.entity.js.map +1 -1
  159. package/lib/profile/student/student.entity.d.ts +11 -6
  160. package/lib/profile/student/student.entity.js +59 -11
  161. package/lib/profile/student/student.entity.js.map +1 -1
  162. package/lib/system/campaign/campaign.entity.d.ts +4 -4
  163. package/lib/system/campaign/campaign.entity.js +10 -10
  164. package/lib/system/campaign/campaign.entity.js.map +1 -1
  165. package/lib/system/campaign/gifcode.entity.d.ts +4 -4
  166. package/lib/system/campaign/gifcode.entity.js +8 -8
  167. package/lib/system/campaign/gifcode.entity.js.map +1 -1
  168. package/lib/system/country/country.entity.d.ts +8 -6
  169. package/lib/system/country/country.entity.js +15 -9
  170. package/lib/system/country/country.entity.js.map +1 -1
  171. package/lib/system/currency/currency.entity.d.ts +1 -1
  172. package/lib/system/currency/currency.entity.js +4 -4
  173. package/lib/system/currency/currency.entity.js.map +1 -1
  174. package/lib/system/driving/category.entity.d.ts +7 -7
  175. package/lib/system/driving/category.entity.js +14 -14
  176. package/lib/system/driving/category.entity.js.map +1 -1
  177. package/lib/system/driving/vehicle.entity.d.ts +2 -2
  178. package/lib/system/driving/vehicle.entity.js +4 -4
  179. package/lib/system/driving/vehicle.entity.js.map +1 -1
  180. package/lib/system/event/event.entity.d.ts +2 -2
  181. package/lib/system/event/event.entity.js +4 -4
  182. package/lib/system/event/event.entity.js.map +1 -1
  183. package/lib/system/event/log.entity.d.ts +2 -2
  184. package/lib/system/event/log.entity.js +3 -3
  185. package/lib/system/event/log.entity.js.map +1 -1
  186. package/lib/system/ical/ical.entity.d.ts +63 -0
  187. package/lib/system/ical/ical.entity.js +70 -0
  188. package/lib/system/ical/ical.entity.js.map +1 -0
  189. package/lib/system/policy/policy.entity.d.ts +2 -2
  190. package/lib/system/policy/policy.entity.js +8 -8
  191. package/lib/system/policy/policy.entity.js.map +1 -1
  192. package/lib/system/staff/staff.entity.d.ts +1 -1
  193. package/lib/system/staff/staff.entity.js +5 -4
  194. package/lib/system/staff/staff.entity.js.map +1 -1
  195. package/lib/tsconfig.tsbuildinfo +1 -1
  196. package/lib/user/alert.entity.d.ts +4 -3
  197. package/lib/user/alert.entity.js +11 -4
  198. package/lib/user/alert.entity.js.map +1 -1
  199. package/lib/user/blocked.entity.js +2 -2
  200. package/lib/user/blocked.entity.js.map +1 -1
  201. package/lib/user/device.entity.d.ts +17 -2
  202. package/lib/user/device.entity.js +29 -3
  203. package/lib/user/device.entity.js.map +1 -1
  204. package/lib/user/notification.entity.d.ts +3 -3
  205. package/lib/user/notification.entity.js +8 -8
  206. package/lib/user/notification.entity.js.map +1 -1
  207. package/lib/user/ticket.entity.d.ts +8 -3
  208. package/lib/user/ticket.entity.js +16 -7
  209. package/lib/user/ticket.entity.js.map +1 -1
  210. package/lib/user/user.entity.d.ts +101 -89
  211. package/lib/user/user.entity.js +272 -270
  212. package/lib/user/user.entity.js.map +1 -1
  213. package/lib/user/verification.entity.js +2 -2
  214. package/lib/user/verification.entity.js.map +1 -1
  215. package/lib/utils/activity.helper.d.ts +2 -2
  216. package/lib/utils/activity.helper.js.map +1 -1
  217. package/lib/utils/trackable.d.ts +13 -2
  218. package/lib/utils/trackable.js +55 -0
  219. package/lib/utils/trackable.js.map +1 -1
  220. package/package.json +3 -3
@@ -8,26 +8,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var CompanyEntity_1;
11
12
  Object.defineProperty(exports, "__esModule", { value: true });
12
13
  exports.CompanyEntity = void 0;
13
- const typeorm_1 = require("typeorm");
14
- const shared_1 = require("@driveup/shared");
15
14
  const common_1 = require("@driveup/common");
16
- const common_2 = require("@driveup/common");
15
+ const shared_1 = require("@driveup/shared");
16
+ const shared_2 = require("@driveup/shared");
17
+ const luxon_1 = require("luxon");
18
+ const typeorm_1 = require("typeorm");
17
19
  const country_entity_1 = require("../../system/country/country.entity");
18
20
  const log_entity_1 = require("../../system/event/log.entity");
19
- const expense_entity_1 = require("./finances/expense/expense.entity");
21
+ const activity_helper_1 = require("../../utils/activity.helper");
22
+ const trackable_1 = require("../../utils/trackable");
23
+ const promotion_entity_1 = require("../agent/promotion.entity");
24
+ const bill_entity_1 = require("./finances/billing/bill.entity");
25
+ const transaction_entity_1 = require("./finances/billing/transaction.entity");
20
26
  const category_entity_1 = require("./finances/expense/category.entity");
27
+ const expense_entity_1 = require("./finances/expense/expense.entity");
21
28
  const handover_entity_1 = require("./finances/handover/handover.entity");
22
29
  const invoice_entity_1 = require("./finances/invoice/invoice.entity");
23
30
  const method_entity_1 = require("./finances/payment/method.entity");
24
- const bill_entity_1 = require("./finances/billing/bill.entity");
25
- const product_entity_1 = require("./product/product.entity");
26
31
  const instructor_entity_1 = require("./instructor/instructor.entity");
27
- const promotion_entity_1 = require("../agent/promotion.entity");
28
- const trackable_1 = require("../../utils/trackable");
29
- const activity_helper_1 = require("../../utils/activity.helper");
30
32
  const addon_entity_1 = require("./product/addon.entity");
33
+ const product_entity_1 = require("./product/product.entity");
31
34
  /**
32
35
  * Represents a driving school company in the system.
33
36
  * Companies offer training products, manage instructors and students,
@@ -36,7 +39,7 @@ const addon_entity_1 = require("./product/addon.entity");
36
39
  *
37
40
  * @extends TrackableEntity<Company>
38
41
  */
39
- let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
42
+ let CompanyEntity = CompanyEntity_1 = class CompanyEntity extends trackable_1.TrackableEntity {
40
43
  /**
41
44
  * Creates a new CompanyEntity instance
42
45
  * @param props - Partial properties to initialize the entity
@@ -83,17 +86,17 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
83
86
  */
84
87
  toModelWithDetails() {
85
88
  const company = this.toModel();
86
- company.address = common_1.Address.toInstance(this.address);
87
- company.bankAccount = common_2.BankAccount.toInstance(this.bankAccount);
88
- company.tax = common_2.Tax.toInstance(this.tax);
89
+ company.address = shared_1.Address.toInstance(this.address);
90
+ company.bankAccount = shared_1.BankAccount.toInstance(this.bankAccount);
91
+ company.tax = shared_1.Tax.toInstance(this.tax);
89
92
  company.email = this.email;
90
93
  company.homepage = this.homepage;
91
94
  company.rating = this.rating;
92
95
  company.links = this.links;
93
- company.workingHours = this.workingHours?.map(common_1.WorkingHours.toInstance);
94
- company.holidays = this.holidays?.map(common_1.Holiday.toInstance);
95
- company.locations = this.locations?.map(common_1.Address.toInstance);
96
- company.preferences = this.preferences?.map(common_2.Preference.toInstance);
96
+ company.workingHours = this.workingHours?.map(shared_1.WorkingHours.toInstance);
97
+ company.holidays = this.holidays?.map(shared_1.Holiday.toInstance);
98
+ company.locations = this.locations?.map(shared_1.Address.toInstance);
99
+ company.preferences = this.preferences?.map(shared_1.Preference.toInstance);
97
100
  return company;
98
101
  }
99
102
  /**
@@ -101,11 +104,11 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
101
104
  * @returns Customer model with company information
102
105
  */
103
106
  toCustomer() {
104
- return new common_2.Customer({
107
+ return new shared_1.Person({
105
108
  id: this.id,
106
109
  name: this.name,
107
110
  imageUrl: this.logoUrl,
108
- address: common_1.Address.toInstance(this.address),
111
+ address: shared_1.Address.toInstance(this.address),
109
112
  phone: this.phone,
110
113
  email: this.email,
111
114
  });
@@ -117,7 +120,7 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
117
120
  async getOwner() {
118
121
  return await instructor_entity_1.CompanyInstructorEntity.findOneBy({
119
122
  companyId: this.id,
120
- role: shared_1.Role.Owner
123
+ role: shared_2.Role.Owner
121
124
  });
122
125
  }
123
126
  /**
@@ -127,7 +130,7 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
127
130
  */
128
131
  async getInstructors(active = true) {
129
132
  const instructors = (await this.instructors) || [];
130
- return active ? instructors.filter(i => i.status === shared_1.AccountStatus.Active) : instructors;
133
+ return active ? instructors.filter(i => i.status === shared_2.AccountStatus.Active) : instructors;
131
134
  }
132
135
  /**
133
136
  * Retrieves all managers (owners and managers) associated with this company
@@ -136,7 +139,7 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
136
139
  */
137
140
  async getManagers(active = true) {
138
141
  const instructors = await this.getInstructors(active);
139
- const managerRoles = [shared_1.Role.Owner, shared_1.Role.Manager];
142
+ const managerRoles = [shared_2.Role.Owner, shared_2.Role.Manager];
140
143
  return instructors?.filter(i => managerRoles.includes(i.role));
141
144
  }
142
145
  /**
@@ -156,7 +159,7 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
156
159
  async getAgentEarning() {
157
160
  return await bill_entity_1.CompanyBillEntity.sum('agentProfit', {
158
161
  companyId: this.id,
159
- status: shared_1.BillStatus.Paid
162
+ status: shared_2.BillStatus.Paid
160
163
  });
161
164
  }
162
165
  /**
@@ -169,15 +172,120 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
169
172
  const zipCode = this.address?.zipCode || '';
170
173
  return `${location}, ${address} - ${zipCode}`.trim();
171
174
  }
175
+ /**
176
+ * Retrieves the active payment method for the company
177
+ * @returns CompanyPaymentMethodEntity - the active company payment method
178
+ */
179
+ async getActivePaymentMethod() {
180
+ return await method_entity_1.CompanyPaymentMethodEntity.findOneBy({
181
+ companyId: this.id,
182
+ active: true
183
+ });
184
+ }
185
+ /**
186
+ * Retrieves the active payment method for the company
187
+ * @returns CompanyPaymentMethodEntity - the active company payment method
188
+ */
189
+ async getPendingPaymentMethod() {
190
+ // TODO: check with admir if the conditions bellow are correct
191
+ return await method_entity_1.CompanyPaymentMethodEntity.findOne({
192
+ where: {
193
+ companyId: this.id,
194
+ active: false,
195
+ confirmed: false
196
+ },
197
+ order: { createdOn: 'DESC' }
198
+ });
199
+ }
200
+ /**
201
+ * Finds if there are any failed payments (unpaid bills) for the company
202
+ */
203
+ async hasFailedTransactions() {
204
+ return await transaction_entity_1.CompanyBillTransactionEntity.createQueryBuilder('ct') // company transaction
205
+ .innerJoin('ct.bill', 'cb') // company bill
206
+ .where('cb.companyId = :companyId', { companyId: this.id })
207
+ .andWhere('cb.status = :unpaidStatus', { unpaidStatus: shared_2.BillStatus.Unpaid })
208
+ .andWhere('ct.status = :failedStatus', { failedStatus: shared_2.StatusType.Failed })
209
+ .getExists();
210
+ }
211
+ getHolidays(period) {
212
+ period.startDate = new Date(period.startDate);
213
+ period.endDate = new Date(period.endDate);
214
+ let companyHolidays = this.holidays || [];
215
+ companyHolidays = companyHolidays.map(i => {
216
+ i.period.startDate = new Date(i.period.startDate);
217
+ i.period.endDate = new Date(i.period.endDate);
218
+ return i;
219
+ });
220
+ const companyHolidaysInPeriod = companyHolidays.filter(i => period.startDate < i.period.endDate && period.endDate > i.period.startDate);
221
+ return companyHolidaysInPeriod;
222
+ }
223
+ /**
224
+ * Check if a given period collides with any of the company's holidays
225
+ * @param Period
226
+ * @returns boolean - true if the period collides with any of the company's holidays
227
+ */
228
+ collidesWithHolidays(period) {
229
+ if (!this.holidays?.length)
230
+ return false;
231
+ return this.holidays.some(i => period.collidesWith(new shared_1.Period({
232
+ startDate: new Date(i.period.startDate),
233
+ endDate: new Date(i.period.endDate)
234
+ })));
235
+ }
236
+ getNonWorkingHours(period) {
237
+ const result = [];
238
+ const periodStart = luxon_1.DateTime.fromJSDate(new Date(period.startDate));
239
+ const periodEnd = luxon_1.DateTime.fromJSDate(new Date(period.endDate));
240
+ let currentDay = periodStart;
241
+ let lastEnd = periodStart;
242
+ while (currentDay < periodEnd) {
243
+ const workdayDefinition = this.workingHours.find(i => common_1.DateHelper.getWeekdayNumber(i.weekday) === currentDay.weekday);
244
+ if (!workdayDefinition?.periods?.length) {
245
+ currentDay = currentDay.plus({ days: 1 }).startOf('day');
246
+ continue;
247
+ }
248
+ const workingHours = workdayDefinition.periods.sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime());
249
+ for (const working of workingHours) {
250
+ const workingStart = luxon_1.DateTime.fromJSDate(new Date(working.startDate)).set({
251
+ year: currentDay.year,
252
+ month: currentDay.month,
253
+ day: currentDay.day
254
+ });
255
+ const workingEnd = luxon_1.DateTime.fromJSDate(new Date(working.endDate)).set({
256
+ year: currentDay.year,
257
+ month: currentDay.month,
258
+ day: currentDay.day
259
+ });
260
+ if (lastEnd < workingStart) {
261
+ const nonWorking = new shared_1.Period({
262
+ startDate: lastEnd.toJSDate(),
263
+ endDate: workingStart.toJSDate()
264
+ });
265
+ result.push(nonWorking);
266
+ }
267
+ lastEnd = workingEnd;
268
+ }
269
+ currentDay = currentDay.plus({ days: 1 }).startOf('day');
270
+ }
271
+ if (lastEnd < periodEnd) {
272
+ const nonWorking = new shared_1.Period({
273
+ startDate: lastEnd.toJSDate(),
274
+ endDate: periodEnd.toJSDate()
275
+ });
276
+ result.push(nonWorking);
277
+ }
278
+ return result;
279
+ }
172
280
  /**
173
281
  * Retrieves activity history for this company
174
282
  * @returns Promise resolving to array of Activity instances tracking creation, updates, and closure
175
283
  */
176
284
  async getActivities() {
177
285
  const activities = [];
178
- activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_1.ActivityType.created));
179
- activities.push(await (0, activity_helper_1.toActivity)(this.updatedBy, this.updatedOn, shared_1.ActivityType.updated));
180
- activities.push(await (0, activity_helper_1.toActivity)(this.closedBy, this.closedOn, shared_1.ActivityType.updated));
286
+ activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_2.ActivityType.created));
287
+ activities.push(await (0, activity_helper_1.toActivity)(this.updatedBy, this.updatedOn, shared_2.ActivityType.updated));
288
+ activities.push(await (0, activity_helper_1.toActivity)(this.closedBy, this.closedOn, shared_2.ActivityType.updated));
181
289
  return activities.filter(a => a);
182
290
  }
183
291
  /**
@@ -187,8 +295,8 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
187
295
  */
188
296
  async log(event, metadata) {
189
297
  await log_entity_1.LogEntity.from({
190
- type: shared_1.LogType.Company,
191
- profile: shared_1.ProfileType.Company,
298
+ type: shared_2.LogType.Company,
299
+ profile: shared_2.ProfileType.Company,
192
300
  event: event,
193
301
  entityId: this.id,
194
302
  content: log_entity_1.LogEntity.toCompanyContent(event, this.language, metadata)
@@ -198,6 +306,87 @@ let CompanyEntity = class CompanyEntity extends trackable_1.TrackableEntity {
198
306
  const addons = await this.addons;
199
307
  return addons?.find(i => i.type === type);
200
308
  }
309
+ getPreferences() {
310
+ if (!this.preferences)
311
+ return;
312
+ return this.preferences.map(shared_1.Preference.toInstance);
313
+ }
314
+ async setPreference(name, value, scope) {
315
+ this.preferences = this.preferences || [];
316
+ this.preferences = this.preferences.filter(p => p.name !== name);
317
+ this.preferences.push(new shared_1.Preference({
318
+ scope: scope,
319
+ name: name,
320
+ value: value
321
+ }));
322
+ await CompanyEntity_1.save(this);
323
+ return this.preferences;
324
+ }
325
+ async removePreference(name) {
326
+ this.preferences = this.preferences || [];
327
+ this.preferences = this.preferences.filter(p => p.name !== name);
328
+ await CompanyEntity_1.save(this);
329
+ return this.preferences;
330
+ }
331
+ /**
332
+ * Get the one company bill with the status "open"
333
+ */
334
+ async getCurrentBill(manager) {
335
+ const repoManager = manager ?? bill_entity_1.CompanyBillEntity.getRepository().manager;
336
+ return repoManager.findOne(bill_entity_1.CompanyBillEntity, {
337
+ where: {
338
+ status: shared_2.BillStatus.Open,
339
+ companyId: this.id
340
+ }
341
+ });
342
+ }
343
+ /**
344
+ * Checks if there are any company bills with the status "unpaid"
345
+ */
346
+ async hasUnpaidBills() {
347
+ return bill_entity_1.CompanyBillEntity.existsBy({
348
+ status: shared_2.BillStatus.Unpaid,
349
+ companyId: this.id
350
+ });
351
+ }
352
+ /**
353
+ * Gets all unpaid bills of the company, INCLUDING current month's bill
354
+ * @returns CompanyBillEntity[] - All bills that are active, or have not been paid yet (both current month's bill and bill for which the payment has failed)
355
+ */
356
+ async getUnpaidBills() {
357
+ return await bill_entity_1.CompanyBillEntity.findBy({
358
+ companyId: this.id,
359
+ status: (0, typeorm_1.Not)(shared_2.BillStatus.Paid)
360
+ });
361
+ }
362
+ /**
363
+ * Gets the total amount of unpaid bills subTotalPrice (sum of all unpaid bills' subTotalPrice)
364
+ * @param manager EntityManager - Used with transactions to ensure data integrity
365
+ * @returns number - Total amount of unpaid bills
366
+ */
367
+ async getTotalUnpaidAmount(manager) {
368
+ const billManager = manager ?? bill_entity_1.CompanyBillEntity.getRepository().manager;
369
+ return await billManager.sum(bill_entity_1.CompanyBillEntity, 'subtotalPrice', {
370
+ companyId: this.id,
371
+ status: (0, typeorm_1.Not)(shared_2.BillStatus.Paid)
372
+ });
373
+ }
374
+ /**
375
+ * * Remaining company credit calculation steps
376
+ * 1. Get all unpaid bills (bills which are active or unpaid)
377
+ * 2. If there are no unpaid bills (which is frankly impossible), remainingCredit = company.credit
378
+ * 3. Sum the subtotal prices of all unpaid bills to get totalUnpaidAmount
379
+ * 4. If company credit is less than totalUnpaidAmount, remainingCredit is 0
380
+ * 5. Otherwise, remainingCredit = company.credit - totalUnpaidAmount
381
+ * @returns number - Remaining company credit
382
+ */
383
+ async getRemainingCredit(manager) {
384
+ const totalUnpaidAmount = await this.getTotalUnpaidAmount(manager);
385
+ if (this.credit < totalUnpaidAmount) {
386
+ return 0;
387
+ }
388
+ return Number(this.credit) - Number(totalUnpaidAmount);
389
+ }
201
390
  };
202
391
  exports.CompanyEntity = CompanyEntity;
203
392
  __decorate([
@@ -212,8 +401,8 @@ __decorate([
212
401
  __decorate([
213
402
  (0, typeorm_1.Column)({
214
403
  type: 'enum',
215
- enum: shared_1.AccountStatus,
216
- default: shared_1.AccountStatus.Pending,
404
+ enum: shared_2.AccountStatus,
405
+ default: shared_2.AccountStatus.Pending,
217
406
  nullable: false
218
407
  }),
219
408
  __metadata("design:type", String)
@@ -235,8 +424,8 @@ __decorate([
235
424
  __decorate([
236
425
  (0, typeorm_1.Column)({
237
426
  type: 'enum',
238
- enum: shared_1.Language,
239
- default: shared_1.Language.De,
427
+ enum: shared_2.Language,
428
+ default: shared_2.Language.De,
240
429
  nullable: true
241
430
  }),
242
431
  __metadata("design:type", String)
@@ -268,7 +457,7 @@ __decorate([
268
457
  nullable: true,
269
458
  default: null
270
459
  }),
271
- __metadata("design:type", common_1.Address)
460
+ __metadata("design:type", shared_1.Address)
272
461
  ], CompanyEntity.prototype, "address", void 0);
273
462
  __decorate([
274
463
  (0, typeorm_1.Column)({
@@ -276,7 +465,7 @@ __decorate([
276
465
  nullable: true,
277
466
  default: null
278
467
  }),
279
- __metadata("design:type", common_2.BankAccount)
468
+ __metadata("design:type", shared_1.BankAccount)
280
469
  ], CompanyEntity.prototype, "bankAccount", void 0);
281
470
  __decorate([
282
471
  (0, typeorm_1.Column)({
@@ -341,14 +530,35 @@ __decorate([
341
530
  }),
342
531
  __metadata("design:type", Number)
343
532
  ], CompanyEntity.prototype, "credit", void 0);
533
+ __decorate([
534
+ (0, typeorm_1.Column)({
535
+ type: 'decimal',
536
+ precision: 10,
537
+ scale: 2,
538
+ nullable: false,
539
+ default: 0
540
+ }),
541
+ __metadata("design:type", Number)
542
+ ], CompanyEntity.prototype, "balance", void 0);
543
+ __decorate([
544
+ (0, typeorm_1.Column)({}),
545
+ __metadata("design:type", Number)
546
+ ], CompanyEntity.prototype, "freeBenefits", void 0);
344
547
  __decorate([
345
548
  (0, typeorm_1.Column)({
346
549
  type: 'simple-json',
347
550
  nullable: true,
348
551
  default: null
349
552
  }),
350
- __metadata("design:type", common_2.Tax)
553
+ __metadata("design:type", shared_1.Tax)
351
554
  ], CompanyEntity.prototype, "tax", void 0);
555
+ __decorate([
556
+ (0, typeorm_1.Column)({
557
+ nullable: true,
558
+ default: 0
559
+ }),
560
+ __metadata("design:type", Number)
561
+ ], CompanyEntity.prototype, "obligationPeriod", void 0);
352
562
  __decorate([
353
563
  (0, typeorm_1.Column)({
354
564
  type: 'simple-json',
@@ -425,7 +635,7 @@ __decorate([
425
635
  (0, typeorm_1.OneToMany)(() => promotion_entity_1.AgentPromotionEntity, promotion => promotion.company),
426
636
  __metadata("design:type", Promise)
427
637
  ], CompanyEntity.prototype, "agentPromotions", void 0);
428
- exports.CompanyEntity = CompanyEntity = __decorate([
638
+ exports.CompanyEntity = CompanyEntity = CompanyEntity_1 = __decorate([
429
639
  (0, typeorm_1.Entity)('companies'),
430
640
  __metadata("design:paramtypes", [Object])
431
641
  ], CompanyEntity);
@@ -1 +1 @@
1
- {"version":3,"file":"company.entity.js","sourceRoot":"","sources":["../../../src/profile/company/company.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0E;AAC1E,4CAA2H;AAC3H,4CAAoF;AACpF,4CAA+E;AAC/E,wEAAoE;AACpE,8DAA0D;AAC1D,sEAAyE;AACzE,wEAAkF;AAClF,yEAA4E;AAC5E,sEAAyE;AACzE,oEAA8E;AAC9E,gEAAmE;AACnE,6DAAgE;AAChE,sEAAyE;AACzE,gEAAiE;AACjE,qDAAwD;AACxD,iEAAyD;AACzD,yDAA4D;AAE5D;;;;;;;GAOG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,2BAAwB;IAgT1D;;;OAGG;IACH,YAAY,KAA8B;QACzC,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAAO,IAAI,gBAAO,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;SACnB,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,SAAS;QACR,OAAO,IAAI,gBAAO,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,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AE,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC;;wDAC/B;AAM3D;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;;gDACzB;AAM5C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;+CACxB;AAM1C;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAoB,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;sDACrB;wBAhVrC,aAAa;IADzB,IAAA,gBAAM,EAAC,WAAW,CAAC;;GACP,aAAa,CA4tBzB"}
@@ -114,6 +114,44 @@ export declare class CompanyCourseScheduleEntity extends TrackableEntity<Recurri
114
114
  getCourse(): Promise<import("./course.entity").CompanyCourseEntity>;
115
115
  getInstructor(): Promise<CompanyInstructorEntity>;
116
116
  getInstructorByDate(date: Date): Promise<CompanyInstructorEntity>;
117
+ /************************* Manage student appointments *************************/
118
+ /**
119
+ * Get list of related student training appointments, which's training is not terminated
120
+ * @param date Date - defaulted to this.startDate - Must be provided for flexible course appointments
121
+ * @returns StudentTrainingAppointmentEntity[]
122
+ */
123
+ getStudentAppointments(date?: Date): Promise<StudentTrainingAppointmentEntity[]>;
124
+ /**
125
+ * Get total number of students who attended the appointment in the given date
126
+ * @param date Date - defaulted to this.startDate - Must be provided for flexible course appointments
127
+ */
128
+ getTotalAttended(date?: Date): Promise<number>;
129
+ /**
130
+ * Get total number of students who where absent in the appointment in the given date
131
+ * @param date Date - defaulted to this.startDate - Must be provided for flexible course appointments
132
+ */
133
+ getTotalAbsent(date?: Date): Promise<number>;
134
+ /**
135
+ * Get the count of taken seats for this appointment
136
+ * - Only applicable for preparation catalog type courses. Returns null for other catalog types.
137
+ * @param startDate Date - Optional - Only send for flexible courses to specify the desired appointment's startDate
138
+ * @returns number - count of registered student appointments for this appointment
139
+ */
140
+ getTakenSeats(startDate?: Date): Promise<number>;
141
+ /**
142
+ * Get the count of present students for this appointment
143
+ * - Only applicable for preparation catalog type courses. Returns null for other catalog types.
144
+ * @param startDate Date - Optional - Only send for flexible courses to specify the desired appointment's startDate
145
+ * @returns number - count of attended student appointments for this appointment
146
+ */
147
+ getTotalPresentStudents(startDate?: Date): Promise<number>;
148
+ /************************* Flexible courses *************************/
149
+ /**
150
+ * Finds if there is an appointment in the given date (checking all of the updates), and returning it if is found
151
+ * @param date Date - the date to check if belongs to an existing appointment
152
+ * @returns Appointment if an appointment is found in the given date, null otherwise
153
+ */
154
+ getAppointment(date: Date): Promise<Appointment>;
117
155
  /**
118
156
  * Load all appointments of the definition within the given period
119
157
  * @description currently only works for flexible course schedules, and will return an empty array if the related course is fixed. but can and must be extended in the future to return the entire appointment list of the schedule, even if the appointment is fixed, or for another product type entirely.
@@ -123,6 +161,13 @@ export declare class CompanyCourseScheduleEntity extends TrackableEntity<Recurri
123
161
  * @returns All appointments of the definition within the given period, filtered by instructorId if provided
124
162
  */
125
163
  getAppointments(period: Period, instructorIds?: number[], searchPhrase?: string): Promise<Appointment[]>;
164
+ /**
165
+ * Check if there is one appointment with empty seats
166
+ *
167
+ * If the definition has no appointments in the given period, returns true.
168
+ * Since the functions is supposed to return wether any of the definition's appointments have empty seats
169
+ */
170
+ hasAppointmentWithEmptySeats(period: Period): Promise<boolean>;
126
171
  /**
127
172
  *
128
173
  * @param period Period
@@ -143,14 +188,14 @@ export declare class CompanyCourseScheduleEntity extends TrackableEntity<Recurri
143
188
  * @param date DateTime - original date of the appointment (default return value, if no date updates are found)
144
189
  * @returns DateTime - final date of the appointment
145
190
  */
146
- private getUpdatedDate;
191
+ getUpdatedDate(date: DateTime): DateTime;
147
192
  /**
148
193
  * @description Only for repeted definitions (repetition = true)
149
194
  * @description Checks wether or not the appointment related to the given date has been removed from schedule (pushed in the skippedDates array)
150
195
  * @param date DateTime - date of the appointment
151
196
  * @returns DateTime - true if the appointment is skipped, false otherwise
152
197
  */
153
- private isDateSkipped;
198
+ isDateSkipped(date: DateTime): boolean;
154
199
  /**
155
200
  * @description Only for repeted definitions (repetition = true)
156
201
  * @description Finds the final duration of the appointment, considering any duration updates
@@ -172,7 +217,7 @@ export declare class CompanyCourseScheduleEntity extends TrackableEntity<Recurri
172
217
  * @description Doesn't check for the definition's endDate, or updates and skippedDates
173
218
  * @returns the next appointment based on repetition logic and weekdays assigned
174
219
  */
175
- private getNextAppointmentDate;
220
+ getNextAppointmentDate(date: DateTime): DateTime;
176
221
  /**
177
222
  * Get the instructor registered for the appointment (works for repeated and single appointments)
178
223
  * @param date Date - the date of the appointment
@@ -198,5 +243,29 @@ export declare class CompanyCourseScheduleEntity extends TrackableEntity<Recurri
198
243
  * @param id instructor id
199
244
  * @returns Object - For the MVP it returns an object mapped like CompanyInstructorMapper.toSimple with the same interface. should be replaced with Person model in the future
200
245
  */
201
- private getInstructorById;
246
+ getInstructorById(id: number): Promise<{
247
+ id: number;
248
+ name: string;
249
+ image: string;
250
+ phone: string;
251
+ role: import("@driveup/shared").Role;
252
+ status: import("@driveup/shared").AccountStatus;
253
+ canReinstate: boolean;
254
+ calendarLinks: import("@driveup/common").Link[];
255
+ }>;
256
+ /**
257
+ * Get total number of appointments that have any update (duration/instructor/date) after the given date
258
+ * @param from Date - if null, from definition start date
259
+ * @returns number - total updated appointments
260
+ */
261
+ getTotalUpdatedAppointments(from: Date): number;
262
+ getRemainingSeats(date: Date): Promise<number>;
263
+ /**
264
+ * This method must be called anytime when definition's endDate is changed to a value other than null/undefined
265
+ *
266
+ * Removes all 'updates', 'skippedDates', 'instructors' and 'durations' after the definition's endDate
267
+ *
268
+ * - Does not save the definition
269
+ */
270
+ removeUpdatesAfterEndDate(): boolean;
202
271
  }