@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,246 @@
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.AddonCountryEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const country_entity_1 = require("../../system/country/country.entity");
16
+ const staff_entity_1 = require("../../system/staff/staff.entity");
17
+ const addon_entity_1 = require("../../profile/company/product/addon.entity");
18
+ const addon_entity_2 = require("./addon.entity");
19
+ const utils_1 = require("../../utils");
20
+ /**
21
+ * Represents an addon configuration for a specific country.
22
+ * This entity manages the country-specific pricing, availability, and localization
23
+ * of addons within the system. Each addon can have different settings per country.
24
+ *
25
+ * @template T - Type parameter for custom metadata structure
26
+ */
27
+ let AddonCountryEntity = class AddonCountryEntity extends utils_1.TrackableEntity {
28
+ /**
29
+ * Unique identifier for the addon-country relationship
30
+ */
31
+ /**
32
+ * Reference to the addon this configuration belongs to
33
+ */
34
+ addonId;
35
+ /**
36
+ * Reference to the country this configuration applies to
37
+ */
38
+ countryId;
39
+ /**
40
+ * Base price for the addon in the country's currency
41
+ * Precision: 8 digits, Scale: 2 decimal places
42
+ */
43
+ price;
44
+ /**
45
+ * Value Added Tax (VAT) rate applicable to this addon in the specific country
46
+ * Precision: 8 digits, Scale: 2 decimal places
47
+ */
48
+ vat;
49
+ /**
50
+ * Number of free benefits included with the addon
51
+ * Used for promotional purposes or trial periods
52
+ */
53
+ freeBenefits;
54
+ /**
55
+ * Addon active status
56
+ * Activating/deactivating an addon will not affect existing customers
57
+ * but will prevent new customers from purchasing the addon.
58
+ * Deactivating must set all country and company addons to enabled=false
59
+ */
60
+ active;
61
+ /**
62
+ * Sort by country relevance
63
+ */
64
+ sort;
65
+ /**
66
+ * Additional metadata
67
+ */
68
+ metadata;
69
+ /**
70
+ * ID of the administrator who enabled this addon for the country
71
+ */
72
+ enabledBy;
73
+ /**
74
+ * Timestamp when the addon was enabled for the country
75
+ */
76
+ enabledOn;
77
+ /**
78
+ * ID of the administrator who disabled this addon for the country
79
+ */
80
+ disabledBy;
81
+ /**
82
+ * Timestamp when the addon was disabled for the country
83
+ */
84
+ disabledOn;
85
+ /**
86
+ * Addon relation
87
+ */
88
+ addon;
89
+ /**
90
+ * Country relation
91
+ */
92
+ country;
93
+ /**
94
+ * Company addon relation
95
+ * Companies that have this addon assigned
96
+ */
97
+ companyProducts;
98
+ /**
99
+ * Creates an instance of AddonCountryEntity
100
+ * @param props - Partial properties to initialize the entity
101
+ */
102
+ constructor(props) {
103
+ super();
104
+ Object.assign(this, props);
105
+ }
106
+ /**
107
+ * Converts the entity to an Addon model with country-specific pricing and settings
108
+ * @param lang - Language code for localization (defaults to current context language)
109
+ * @returns Addon model instance with country-specific data
110
+ */
111
+ async toModel(lang) {
112
+ const entity = await this.addon;
113
+ const addon = entity.toModel(lang);
114
+ addon.id = this.id;
115
+ addon.vat = this.vat;
116
+ addon.freeBenefits = this.freeBenefits;
117
+ addon.price = this.price;
118
+ addon.active = this.active;
119
+ addon.sort = this.sort;
120
+ addon.metadata = this.getMetadata();
121
+ return addon;
122
+ }
123
+ /**
124
+ * Converts the entity to an Addon model with country-specific pricing and settings
125
+ * @param lang - Language code for localization (defaults to current context language)
126
+ * @returns Addon model instance with country-specific data
127
+ */
128
+ async toSummary(lang) {
129
+ return await this.toModel(lang);
130
+ }
131
+ /**
132
+ * Retrieves metadata as typed Metadata instances
133
+ * @returns Array of Metadata objects
134
+ */
135
+ getMetadata() {
136
+ return this.metadata?.map(m => common_1.Metadata.toInstance(m));
137
+ }
138
+ /**
139
+ * Retrieves all activity records for this addon-country configuration
140
+ * Includes creation, updates, enable/disable actions
141
+ * @returns Array of Activity objects
142
+ */
143
+ async getActivities() {
144
+ const activities = [];
145
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
146
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
147
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
148
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
149
+ activities.push(await (0, utils_1.toActivity)(this.enabledBy, common_1.ActivityType.enabledBy, staff_entity_1.StaffEntity));
150
+ activities.push(await (0, utils_1.toActivity)(this.enabledOn, common_1.ActivityType.enabledOn));
151
+ activities.push(await (0, utils_1.toActivity)(this.disabledBy, common_1.ActivityType.disabledBy, staff_entity_1.StaffEntity));
152
+ activities.push(await (0, utils_1.toActivity)(this.disabledOn, common_1.ActivityType.disabledOn));
153
+ return activities.filter(a => a);
154
+ }
155
+ };
156
+ exports.AddonCountryEntity = AddonCountryEntity;
157
+ __decorate([
158
+ (0, typeorm_1.Column)(),
159
+ __metadata("design:type", Number)
160
+ ], AddonCountryEntity.prototype, "addonId", void 0);
161
+ __decorate([
162
+ (0, typeorm_1.Column)(),
163
+ __metadata("design:type", Number)
164
+ ], AddonCountryEntity.prototype, "countryId", void 0);
165
+ __decorate([
166
+ (0, typeorm_1.Column)({
167
+ type: 'decimal',
168
+ precision: 8,
169
+ scale: 2,
170
+ nullable: true,
171
+ default: null
172
+ }),
173
+ __metadata("design:type", Number)
174
+ ], AddonCountryEntity.prototype, "price", void 0);
175
+ __decorate([
176
+ (0, typeorm_1.Column)({
177
+ type: 'decimal',
178
+ precision: 8,
179
+ scale: 2,
180
+ nullable: true,
181
+ default: null
182
+ }),
183
+ __metadata("design:type", Number)
184
+ ], AddonCountryEntity.prototype, "vat", void 0);
185
+ __decorate([
186
+ (0, typeorm_1.Column)({
187
+ nullable: true,
188
+ default: null
189
+ }),
190
+ __metadata("design:type", Number)
191
+ ], AddonCountryEntity.prototype, "freeBenefits", void 0);
192
+ __decorate([
193
+ (0, typeorm_1.Column)({
194
+ nullable: false,
195
+ default: true
196
+ }),
197
+ __metadata("design:type", Boolean)
198
+ ], AddonCountryEntity.prototype, "active", void 0);
199
+ __decorate([
200
+ (0, typeorm_1.Column)({
201
+ nullable: false,
202
+ default: 1
203
+ }),
204
+ __metadata("design:type", Number)
205
+ ], AddonCountryEntity.prototype, "sort", void 0);
206
+ __decorate([
207
+ (0, typeorm_1.Column)({
208
+ type: 'simple-json',
209
+ nullable: true,
210
+ default: null
211
+ }),
212
+ __metadata("design:type", Array)
213
+ ], AddonCountryEntity.prototype, "metadata", void 0);
214
+ __decorate([
215
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
216
+ __metadata("design:type", Number)
217
+ ], AddonCountryEntity.prototype, "enabledBy", void 0);
218
+ __decorate([
219
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
220
+ __metadata("design:type", Date)
221
+ ], AddonCountryEntity.prototype, "enabledOn", void 0);
222
+ __decorate([
223
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
224
+ __metadata("design:type", Number)
225
+ ], AddonCountryEntity.prototype, "disabledBy", void 0);
226
+ __decorate([
227
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
228
+ __metadata("design:type", Date)
229
+ ], AddonCountryEntity.prototype, "disabledOn", void 0);
230
+ __decorate([
231
+ (0, typeorm_1.ManyToOne)(() => addon_entity_2.AddonEntity, product => product.countries),
232
+ __metadata("design:type", Promise)
233
+ ], AddonCountryEntity.prototype, "addon", void 0);
234
+ __decorate([
235
+ (0, typeorm_1.ManyToOne)(() => country_entity_1.CountryEntity, country => country.addons),
236
+ __metadata("design:type", Promise)
237
+ ], AddonCountryEntity.prototype, "country", void 0);
238
+ __decorate([
239
+ (0, typeorm_1.OneToMany)(() => addon_entity_1.CompanyProductAddonEntity, product => product.addon),
240
+ __metadata("design:type", Promise)
241
+ ], AddonCountryEntity.prototype, "companyProducts", void 0);
242
+ exports.AddonCountryEntity = AddonCountryEntity = __decorate([
243
+ (0, typeorm_1.Entity)('systemAddonCountries'),
244
+ __metadata("design:paramtypes", [Object])
245
+ ], AddonCountryEntity);
246
+ //# sourceMappingURL=country.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country.entity.js","sourceRoot":"","sources":["../../../src/catalog/addon/country.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,4CAAoF;AACpF,wEAAoE;AACpE,kEAA8D;AAC9D,6EAAuF;AACvF,iDAA6C;AAC7C,uCAA0D;AAE1D;;;;;;GAMG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,uBAAsB;IAE7D;;OAEG;IAEH;;OAEG;IAEH,OAAO,CAAS;IAEhB;;OAEG;IAEH,SAAS,CAAS;IAElB;;;OAGG;IAQH,KAAK,CAAS;IAEd;;;OAGG;IAQH,GAAG,CAAS;IAEZ;;;OAGG;IAKH,YAAY,CAAS;IAErB;;;;;OAKG;IAKH,MAAM,CAAU;IAEhB;;OAEG;IAKH,IAAI,CAAS;IAEb;;OAEG;IAMH,QAAQ,CAAa;IAErB;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,SAAS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AC,OAAO,CAAC,SAAS,CAAC;;iDAC/B;AAM5B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8BAAa,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;;mDAC1B;AAOhC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wCAAyB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;;2DACf;6BA9H1C,kBAAkB;IAD9B,IAAA,gBAAM,EAAC,sBAAsB,CAAC;;GAClB,kBAAkB,CA6L9B"}
@@ -0,0 +1,122 @@
1
+ import { DrivingCategory, Language, IMetadata, Content, IContent } from '@driveup/common';
2
+ import { Activity, ColorContext } from '@driveup/common';
3
+ import { CountryEntity } from '../../system/country/country.entity';
4
+ import { ProgramEntity } from '../program/program.entity';
5
+ import { StudentLicenceEntity } from '../../profile/student/program/licence/licence.entity';
6
+ import { StudentMedicalCertificateEntity } from '../../profile/student/program/medical/certificate.entity';
7
+ import { CompanyMedicalProductEntity } from '../../profile/company/medical/product.entity';
8
+ import { CompanyCourseEntity } from '../../profile/company/course/course.entity';
9
+ import { SeedCourseEntity } from '../seed/courses/course.entity';
10
+ import { SeedVehicleEntity } from './vehicle.entity';
11
+ import { TrackableEntity } from '../../utils';
12
+ /**
13
+ * Represents a driving license category in the system.
14
+ * Categories define the type of vehicle or driving qualification (e.g., A, B, C1, C1E).
15
+ * Each category has specific requirements, age limits, and associated training programs.
16
+ *
17
+ * @extends TrackableEntity<DrivingCategory>
18
+ */
19
+ export declare class DrivingCategoryEntity extends TrackableEntity<DrivingCategory> {
20
+ /**
21
+ * ID of the country this category belongs to
22
+ */
23
+ countryId: number;
24
+ /**
25
+ * Category name abbreviation
26
+ * Short representation of the category
27
+ * (e.g., A, B, C1, C1E etc.)
28
+ */
29
+ name: string;
30
+ /**
31
+ * Minimum age requirement for this driving category
32
+ */
33
+ minAge: number;
34
+ /**
35
+ * URL to the category's representative image
36
+ */
37
+ imageUrl: string;
38
+ /**
39
+ * UI color theme context for displaying the category
40
+ * @default ColorContext.Primary
41
+ */
42
+ color: ColorContext;
43
+ /**
44
+ * Additional metadata
45
+ */
46
+ metadata: IMetadata[];
47
+ /**
48
+ * Category active status
49
+ * Activating/Deactivating a category will not affect existing customers,
50
+ * but will prevent new customers from selecting the category.
51
+ * Deactivating must set all company categories to enabled=false
52
+ */
53
+ active: boolean;
54
+ translations: IContent[];
55
+ enabledBy: number;
56
+ enabledOn: Date;
57
+ disabledBy: number;
58
+ disabledOn: Date;
59
+ country: Promise<CountryEntity>;
60
+ /**
61
+ * Company medical product associated with driving category.
62
+ * Example:
63
+ * * Category A: Vision Test, Hearing Test, Reaction Time Test, etc.
64
+ * * Category B: Physical Examination, Cardiovascular Assessment, etc.
65
+ */
66
+ companyMedicalProducts: Promise<CompanyMedicalProductEntity[]>;
67
+ /**
68
+ * Company course products associated with driving category.
69
+ * Example:
70
+ * * Theory Study training for car driving license is associated with Category B
71
+ * * Practical Riding training for motorcycle license is associated with Category A
72
+ */
73
+ companyCourses: Promise<CompanyCourseEntity[]>;
74
+ /**
75
+ * Student medical certificates
76
+ */
77
+ studentCertificates: Promise<StudentMedicalCertificateEntity[]>;
78
+ /**
79
+ * Student licence relation
80
+ */
81
+ studentLicences: Promise<StudentLicenceEntity[]>;
82
+ /**
83
+ * Category programs
84
+ */
85
+ programs: Promise<ProgramEntity[]>;
86
+ /**
87
+ * Seed company courses
88
+ */
89
+ seedCourses: Promise<SeedCourseEntity[]>;
90
+ /**
91
+ * Seed category vehicles
92
+ */
93
+ seedVehicles: Promise<SeedVehicleEntity[]>;
94
+ /**
95
+ * Creates an instance of DrivingCategoryEntity
96
+ * @param props - Partial properties to initialize the entity
97
+ */
98
+ constructor(props?: Partial<DrivingCategoryEntity>);
99
+ /**
100
+ * Converts the entity to a DrivingCategory model with localized content
101
+ * @param lang - Language code for localization (defaults to current context language)
102
+ * @returns DrivingCategory model instance
103
+ */
104
+ toModel(lang?: Language): DrivingCategory;
105
+ /**
106
+ * Retrieves the translation for a specific language
107
+ * @param lang - Language code (defaults to current context language)
108
+ * @returns Content object with localized strings
109
+ */
110
+ getTranslation(lang?: Language): Content;
111
+ /**
112
+ * Retrieves all available translations for this category
113
+ * @returns Array of Content objects for all languages
114
+ */
115
+ getTranslations(): Content[];
116
+ /**
117
+ * Retrieves all activity records for this category
118
+ * Includes creation, updates, enable/disable actions
119
+ * @returns Array of Activity objects
120
+ */
121
+ getActivities(): Promise<Activity[]>;
122
+ }
@@ -0,0 +1,217 @@
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.DrivingCategoryEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const typeorm_2 = require("typeorm");
15
+ const nestjs_i18n_1 = require("nestjs-i18n");
16
+ const common_1 = require("@driveup/common");
17
+ const common_2 = require("@driveup/common");
18
+ const staff_entity_1 = require("../../system/staff/staff.entity");
19
+ const country_entity_1 = require("../../system/country/country.entity");
20
+ const program_entity_1 = require("../program/program.entity");
21
+ const licence_entity_1 = require("../../profile/student/program/licence/licence.entity");
22
+ const certificate_entity_1 = require("../../profile/student/program/medical/certificate.entity");
23
+ const product_entity_1 = require("../../profile/company/medical/product.entity");
24
+ const course_entity_1 = require("../../profile/company/course/course.entity");
25
+ const course_entity_2 = require("../seed/courses/course.entity");
26
+ const vehicle_entity_1 = require("./vehicle.entity");
27
+ const utils_1 = require("../../utils");
28
+ /**
29
+ * Represents a driving license category in the system.
30
+ * Categories define the type of vehicle or driving qualification (e.g., A, B, C1, C1E).
31
+ * Each category has specific requirements, age limits, and associated training programs.
32
+ *
33
+ * @extends TrackableEntity<DrivingCategory>
34
+ */
35
+ let DrivingCategoryEntity = class DrivingCategoryEntity extends utils_1.TrackableEntity {
36
+ /**
37
+ * Creates an instance of DrivingCategoryEntity
38
+ * @param props - Partial properties to initialize the entity
39
+ */
40
+ constructor(props) {
41
+ super();
42
+ Object.assign(this, props);
43
+ }
44
+ /**
45
+ * Converts the entity to a DrivingCategory model with localized content
46
+ * @param lang - Language code for localization (defaults to current context language)
47
+ * @returns DrivingCategory model instance
48
+ */
49
+ toModel(lang) {
50
+ const translation = this.getTranslation(lang);
51
+ return new common_1.DrivingCategory({
52
+ id: this.id,
53
+ title: translation?.title,
54
+ description: translation?.description,
55
+ imageUrl: translation?.imageUrl || this.imageUrl,
56
+ name: this.name,
57
+ minAge: this.minAge,
58
+ color: this.color,
59
+ active: this.active
60
+ });
61
+ }
62
+ /**
63
+ * Retrieves the translation for a specific language
64
+ * @param lang - Language code (defaults to current context language)
65
+ * @returns Content object with localized strings
66
+ */
67
+ getTranslation(lang) {
68
+ const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
69
+ const translation = this.translations?.find(t => t.language === language);
70
+ return new common_1.Content({
71
+ title: translation?.title,
72
+ description: translation?.description,
73
+ content: translation?.content,
74
+ imageUrl: translation?.imageUrl || this.imageUrl,
75
+ link: translation?.link,
76
+ });
77
+ }
78
+ /**
79
+ * Retrieves all available translations for this category
80
+ * @returns Array of Content objects for all languages
81
+ */
82
+ getTranslations() {
83
+ return this.translations?.map(t => new common_1.Content({
84
+ title: t.title,
85
+ description: t.description,
86
+ content: t.content,
87
+ imageUrl: t.imageUrl,
88
+ link: t.link,
89
+ language: t.language
90
+ }));
91
+ }
92
+ /**
93
+ * Retrieves all activity records for this category
94
+ * Includes creation, updates, enable/disable actions
95
+ * @returns Array of Activity objects
96
+ */
97
+ async getActivities() {
98
+ const activities = [];
99
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy, staff_entity_1.StaffEntity));
100
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
101
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy, staff_entity_1.StaffEntity));
102
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
103
+ activities.push(await (0, utils_1.toActivity)(this.enabledBy, common_2.ActivityType.enabledBy, staff_entity_1.StaffEntity));
104
+ activities.push(await (0, utils_1.toActivity)(this.enabledOn, common_2.ActivityType.enabledOn));
105
+ activities.push(await (0, utils_1.toActivity)(this.disabledBy, common_2.ActivityType.disabledBy, staff_entity_1.StaffEntity));
106
+ activities.push(await (0, utils_1.toActivity)(this.disabledOn, common_2.ActivityType.disabledOn));
107
+ return activities.filter(a => !a);
108
+ }
109
+ };
110
+ exports.DrivingCategoryEntity = DrivingCategoryEntity;
111
+ __decorate([
112
+ (0, typeorm_1.Column)(),
113
+ __metadata("design:type", Number)
114
+ ], DrivingCategoryEntity.prototype, "countryId", void 0);
115
+ __decorate([
116
+ (0, typeorm_1.Column)(),
117
+ __metadata("design:type", String)
118
+ ], DrivingCategoryEntity.prototype, "name", void 0);
119
+ __decorate([
120
+ (0, typeorm_1.Column)({
121
+ nullable: true,
122
+ default: null
123
+ }),
124
+ __metadata("design:type", Number)
125
+ ], DrivingCategoryEntity.prototype, "minAge", void 0);
126
+ __decorate([
127
+ (0, typeorm_1.Column)({
128
+ nullable: true,
129
+ default: null
130
+ }),
131
+ __metadata("design:type", String)
132
+ ], DrivingCategoryEntity.prototype, "imageUrl", void 0);
133
+ __decorate([
134
+ (0, typeorm_1.Column)({
135
+ type: 'enum',
136
+ enum: common_2.ColorContext,
137
+ default: common_2.ColorContext.Primary,
138
+ nullable: false
139
+ }),
140
+ __metadata("design:type", String)
141
+ ], DrivingCategoryEntity.prototype, "color", void 0);
142
+ __decorate([
143
+ (0, typeorm_1.Column)({
144
+ type: 'simple-json',
145
+ nullable: true,
146
+ default: null
147
+ }),
148
+ __metadata("design:type", Array)
149
+ ], DrivingCategoryEntity.prototype, "metadata", void 0);
150
+ __decorate([
151
+ (0, typeorm_1.Column)({
152
+ nullable: false,
153
+ default: false
154
+ }),
155
+ __metadata("design:type", Boolean)
156
+ ], DrivingCategoryEntity.prototype, "active", void 0);
157
+ __decorate([
158
+ (0, typeorm_1.Column)({
159
+ type: 'simple-json',
160
+ nullable: true,
161
+ default: null
162
+ }),
163
+ __metadata("design:type", Array)
164
+ ], DrivingCategoryEntity.prototype, "translations", void 0);
165
+ __decorate([
166
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
167
+ __metadata("design:type", Number)
168
+ ], DrivingCategoryEntity.prototype, "enabledBy", void 0);
169
+ __decorate([
170
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
171
+ __metadata("design:type", Date)
172
+ ], DrivingCategoryEntity.prototype, "enabledOn", void 0);
173
+ __decorate([
174
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
175
+ __metadata("design:type", Number)
176
+ ], DrivingCategoryEntity.prototype, "disabledBy", void 0);
177
+ __decorate([
178
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
179
+ __metadata("design:type", Date)
180
+ ], DrivingCategoryEntity.prototype, "disabledOn", void 0);
181
+ __decorate([
182
+ (0, typeorm_2.ManyToOne)(() => country_entity_1.CountryEntity, country => country.drivingCategories),
183
+ __metadata("design:type", Promise)
184
+ ], DrivingCategoryEntity.prototype, "country", void 0);
185
+ __decorate([
186
+ (0, typeorm_2.OneToMany)(() => product_entity_1.CompanyMedicalProductEntity, company => company.category),
187
+ __metadata("design:type", Promise)
188
+ ], DrivingCategoryEntity.prototype, "companyMedicalProducts", void 0);
189
+ __decorate([
190
+ (0, typeorm_2.OneToMany)(() => course_entity_1.CompanyCourseEntity, training => training.category),
191
+ __metadata("design:type", Promise)
192
+ ], DrivingCategoryEntity.prototype, "companyCourses", void 0);
193
+ __decorate([
194
+ (0, typeorm_2.OneToMany)(() => certificate_entity_1.StudentMedicalCertificateEntity, certificate => certificate.category),
195
+ __metadata("design:type", Promise)
196
+ ], DrivingCategoryEntity.prototype, "studentCertificates", void 0);
197
+ __decorate([
198
+ (0, typeorm_2.OneToMany)(() => licence_entity_1.StudentLicenceEntity, licence => licence.category),
199
+ __metadata("design:type", Promise)
200
+ ], DrivingCategoryEntity.prototype, "studentLicences", void 0);
201
+ __decorate([
202
+ (0, typeorm_2.OneToMany)(() => program_entity_1.ProgramEntity, program => program.category),
203
+ __metadata("design:type", Promise)
204
+ ], DrivingCategoryEntity.prototype, "programs", void 0);
205
+ __decorate([
206
+ (0, typeorm_2.OneToMany)(() => course_entity_2.SeedCourseEntity, training => training.category),
207
+ __metadata("design:type", Promise)
208
+ ], DrivingCategoryEntity.prototype, "seedCourses", void 0);
209
+ __decorate([
210
+ (0, typeorm_2.OneToMany)(() => vehicle_entity_1.SeedVehicleEntity, vehicle => vehicle.category),
211
+ __metadata("design:type", Promise)
212
+ ], DrivingCategoryEntity.prototype, "seedVehicles", void 0);
213
+ exports.DrivingCategoryEntity = DrivingCategoryEntity = __decorate([
214
+ (0, typeorm_1.Entity)('systemDrivingCategories'),
215
+ __metadata("design:paramtypes", [Object])
216
+ ], DrivingCategoryEntity);
217
+ //# sourceMappingURL=category.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category.entity.js","sourceRoot":"","sources":["../../../src/catalog/driving/category.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,qCAA+C;AAC/C,6CAA0C;AAC1C,4CAA0F;AAC1F,4CAAuE;AACvE,kEAA8D;AAC9D,wEAAoE;AACpE,8DAA0D;AAC1D,yFAA4F;AAC5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mBAAS,EAAC,GAAG,EAAE,CAAC,kCAAiB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;2DACrB;gCAxI/B,qBAAqB;IADjC,IAAA,gBAAM,EAAC,yBAAyB,CAAC;;GACrB,qBAAqB,CAuNjC"}
@@ -0,0 +1,49 @@
1
+ import { Activity, CarTransmission, Vehicle } from '@driveup/common';
2
+ import { DrivingCategoryEntity } from './category.entity';
3
+ import { TrackableEntity } from '../../utils';
4
+ /**
5
+ * Represents a seed vehicle template in the system.
6
+ * Seed vehicles are predefined vehicle configurations that can be used
7
+ * by companies when setting up their fleet. Each vehicle is associated with
8
+ * a driving category and includes make, model, and transmission type.
9
+ *
10
+ * @extends TrackableEntity<Vehicle>
11
+ */
12
+ export declare class SeedVehicleEntity extends TrackableEntity<Vehicle> {
13
+ /**
14
+ * Reference to the driving category this vehicle belongs to
15
+ */
16
+ categoryId: number;
17
+ /**
18
+ * Vehicle make (e.g. Toyota, Ford)
19
+ */
20
+ make: string;
21
+ /**
22
+ * Vehicle model (e.g. Corolla, Focus)
23
+ */
24
+ model: string;
25
+ /**
26
+ * Type of transmission (Automatic or Manual)
27
+ * @default CarTransmission.Automatic
28
+ */
29
+ transmission: CarTransmission.Automatic;
30
+ /**
31
+ * Associated driving category
32
+ */
33
+ category: Promise<DrivingCategoryEntity>;
34
+ /**
35
+ * Creates a new SeedVehicleEntity instance
36
+ * @param props - Partial properties to initialize the entity
37
+ */
38
+ constructor(props?: Partial<SeedVehicleEntity>);
39
+ /**
40
+ * Converts the entity to a Vehicle model instance
41
+ * @returns Vehicle model with id, make, model, and transmission
42
+ */
43
+ toModel(): Vehicle;
44
+ /**
45
+ * Retrieves activity history for this vehicle
46
+ * @returns Promise resolving to array of Activity instances tracking creation and updates
47
+ */
48
+ getActivities(): Promise<Activity[]>;
49
+ }