@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,150 @@
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.CampaignEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const gifcode_entity_1 = require("./gifcode.entity");
16
+ const common_2 = require("@driveup/common");
17
+ const nestjs_i18n_1 = require("nestjs-i18n");
18
+ const utils_1 = require("../../utils");
19
+ const staff_entity_1 = require("../staff/staff.entity");
20
+ const utils_2 = require("../../utils");
21
+ /**
22
+ * Represents a marketing campaign in the system.
23
+ * Campaigns offer promotional discounts through gift codes that users can redeem.
24
+ * Each campaign targets specific products and has an expiration date.
25
+ * Gift amounts are credited to the user's product wallet upon redemption.
26
+ *
27
+ * @extends TrackableEntity
28
+ */
29
+ let CampaignEntity = class CampaignEntity extends utils_2.TrackableEntity {
30
+ /**
31
+ * Creates a new CampaignEntity instance
32
+ * @param props - Partial properties to initialize the entity
33
+ */
34
+ constructor(props) {
35
+ super();
36
+ Object.assign(this, props);
37
+ }
38
+ /**
39
+ * Converts the entity to a Campaigne model instance
40
+ * @param lang - Optional language for translations
41
+ * @returns Campaigne model with localized content
42
+ */
43
+ toModel(lang) {
44
+ const transaltion = this.getTranslation(lang);
45
+ return new common_1.Campaigne({
46
+ id: this.id,
47
+ title: transaltion.title,
48
+ description: transaltion.description,
49
+ giftAmount: this.giftAmount,
50
+ imageUrl: transaltion.imageUrl || this.imageUrl,
51
+ exipryDate: this.exipryDate,
52
+ });
53
+ }
54
+ /**
55
+ * Retrieves all gift codes for this campaign
56
+ * @returns Promise resolving to array of GiftCode models
57
+ */
58
+ async getCodes() {
59
+ return await Promise.all((await this.giftCodes).map(async (codeEntity) => codeEntity.toModel()));
60
+ }
61
+ /**
62
+ * Gets the localized translation for the campaign
63
+ * @param lang - Optional language code; defaults to current i18n context
64
+ * @returns Content instance with translated title and description
65
+ */
66
+ getTranslation(lang) {
67
+ const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
68
+ const translation = this.translations?.find(t => t.language === language);
69
+ return new common_1.Content({
70
+ title: translation?.title,
71
+ description: translation?.description,
72
+ content: translation?.content,
73
+ imageUrl: translation?.imageUrl,
74
+ link: translation?.link,
75
+ });
76
+ }
77
+ /**
78
+ * Gets all available translations for the campaign
79
+ * @returns Array of Content instances for all languages
80
+ */
81
+ getTranslations() {
82
+ return this.translations?.map(t => new common_1.Content({
83
+ title: t.title,
84
+ description: t.description,
85
+ content: t.content,
86
+ imageUrl: t.imageUrl,
87
+ link: t.link,
88
+ language: t.language
89
+ }));
90
+ }
91
+ async getActivities() {
92
+ const activities = [];
93
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
94
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
95
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
96
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
97
+ return activities.filter(a => !a);
98
+ }
99
+ };
100
+ exports.CampaignEntity = CampaignEntity;
101
+ __decorate([
102
+ (0, typeorm_1.Column)({
103
+ type: 'set',
104
+ enum: common_2.ProductType,
105
+ default: [],
106
+ nullable: false
107
+ }),
108
+ __metadata("design:type", Array)
109
+ ], CampaignEntity.prototype, "products", void 0);
110
+ __decorate([
111
+ (0, typeorm_1.Column)({
112
+ type: 'simple-json',
113
+ nullable: true,
114
+ default: null
115
+ }),
116
+ __metadata("design:type", Array)
117
+ ], CampaignEntity.prototype, "translations", void 0);
118
+ __decorate([
119
+ (0, typeorm_1.Column)({
120
+ nullable: true,
121
+ default: null
122
+ }),
123
+ __metadata("design:type", String)
124
+ ], CampaignEntity.prototype, "imageUrl", void 0);
125
+ __decorate([
126
+ (0, typeorm_1.Column)({
127
+ type: 'decimal',
128
+ precision: 10,
129
+ scale: 2,
130
+ nullable: false,
131
+ default: 0
132
+ }),
133
+ __metadata("design:type", Number)
134
+ ], CampaignEntity.prototype, "giftAmount", void 0);
135
+ __decorate([
136
+ (0, typeorm_1.Column)({
137
+ nullable: true,
138
+ default: null
139
+ }),
140
+ __metadata("design:type", Date)
141
+ ], CampaignEntity.prototype, "exipryDate", void 0);
142
+ __decorate([
143
+ (0, typeorm_1.OneToMany)(() => gifcode_entity_1.CampaignGiftCodeEntity, giftCode => giftCode.campaign),
144
+ __metadata("design:type", Promise)
145
+ ], CampaignEntity.prototype, "giftCodes", void 0);
146
+ exports.CampaignEntity = CampaignEntity = __decorate([
147
+ (0, typeorm_1.Entity)('systemCampaigns'),
148
+ __metadata("design:paramtypes", [Object])
149
+ ], CampaignEntity);
150
+ //# sourceMappingURL=campaign.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaign.entity.js","sourceRoot":"","sources":["../../../src/system/campaign/campaign.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AA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ACnC,CAAC;CACD,CAAA;AAzIY,wCAAc;AAY1B;IANC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,oBAAW;QACjB,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,KAAK;KACf,CAAC;;gDACsB;AAUxB;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;oDACuB;AASzB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;gDACe;AAajB;IAPC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;KACV,CAAC;;kDACiB;AASnB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;8BACU,IAAI;kDAAC;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAsB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;;iDAC1B;yBA3DjC,cAAc;IAD1B,IAAA,gBAAM,EAAC,iBAAiB,CAAC;;GACb,cAAc,CAyI1B"}
@@ -0,0 +1,14 @@
1
+ import { Activity, GiftCode, ProfileType } from '@driveup/common';
2
+ import { CampaignEntity } from './campaign.entity';
3
+ import { TrackableEntity } from '../../utils';
4
+ export declare class CampaignGiftCodeEntity extends TrackableEntity {
5
+ campaignId: number;
6
+ code: string;
7
+ profile: ProfileType;
8
+ registredBy: number;
9
+ registredOn: Date;
10
+ campaign: CampaignEntity;
11
+ constructor(props?: Partial<CampaignGiftCodeEntity>);
12
+ toModel(): GiftCode;
13
+ getActivities(): Promise<Activity[]>;
14
+ }
@@ -0,0 +1,77 @@
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.CampaignGiftCodeEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const campaign_entity_1 = require("./campaign.entity");
16
+ const utils_1 = require("../../utils");
17
+ const staff_entity_1 = require("../staff/staff.entity");
18
+ const utils_2 = require("../../utils");
19
+ let CampaignGiftCodeEntity = class CampaignGiftCodeEntity extends utils_2.TrackableEntity {
20
+ constructor(props) {
21
+ super();
22
+ Object.assign(this, props);
23
+ }
24
+ toModel() {
25
+ return new common_1.GiftCode({
26
+ id: this.id,
27
+ code: this.code
28
+ });
29
+ }
30
+ async getActivities() {
31
+ const activities = [];
32
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
33
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
34
+ activities.push(await (0, utils_1.toActivity)(this.registredBy, common_1.ActivityType.registredBy));
35
+ activities.push(await (0, utils_1.toActivity)(this.registredOn, common_1.ActivityType.registredOn));
36
+ return activities;
37
+ }
38
+ };
39
+ exports.CampaignGiftCodeEntity = CampaignGiftCodeEntity;
40
+ __decorate([
41
+ (0, typeorm_1.Column)(),
42
+ __metadata("design:type", Number)
43
+ ], CampaignGiftCodeEntity.prototype, "campaignId", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({
46
+ nullable: false,
47
+ unique: true,
48
+ length: 8
49
+ }),
50
+ __metadata("design:type", String)
51
+ ], CampaignGiftCodeEntity.prototype, "code", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({
54
+ type: 'enum',
55
+ enum: common_1.ProfileType,
56
+ default: common_1.ProfileType.Company,
57
+ nullable: true,
58
+ }),
59
+ __metadata("design:type", String)
60
+ ], CampaignGiftCodeEntity.prototype, "profile", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
63
+ __metadata("design:type", Number)
64
+ ], CampaignGiftCodeEntity.prototype, "registredBy", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ nullable: true, default: null }),
67
+ __metadata("design:type", Date)
68
+ ], CampaignGiftCodeEntity.prototype, "registredOn", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.ManyToMany)(() => campaign_entity_1.CampaignEntity, campaign => campaign.giftCodes),
71
+ __metadata("design:type", campaign_entity_1.CampaignEntity)
72
+ ], CampaignGiftCodeEntity.prototype, "campaign", void 0);
73
+ exports.CampaignGiftCodeEntity = CampaignGiftCodeEntity = __decorate([
74
+ (0, typeorm_1.Entity)('systemCampaignGiftCodes'),
75
+ __metadata("design:paramtypes", [Object])
76
+ ], CampaignGiftCodeEntity);
77
+ //# sourceMappingURL=gifcode.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gifcode.entity.js","sourceRoot":"","sources":["../../../src/system/campaign/gifcode.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAqD;AACrD,4CAAgF;AAChF,uDAAmD;AACnD,uCAAyC;AACzC,wDAAoD;AACpD,uCAA8C;AAGvC,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,uBAAe;IA6B1D,YAAY,KAAuC;QAClD,KAAK,EAAE,CAAC;QACR,MAAM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AGpB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC7B,IAAI;2DAAC;AAGlB;IADC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;8BACvD,gCAAc;wDAAC;iCA3Bb,sBAAsB;IADlC,IAAA,gBAAM,EAAC,yBAAyB,CAAC;;GACrB,sBAAsB,CAiDlC"}
@@ -0,0 +1,69 @@
1
+ import { Activity, Campaigne, Content, Language } from '@driveup/common';
2
+ import { CampaigneGiftCodeEntity } from './gifcode.entity';
3
+ import { ProductType } from '@driveup/common';
4
+ import { TrackableEntity } from '../../utils';
5
+ /**
6
+ * Represents a marketing campaign in the system.
7
+ * Campaigns offer promotional discounts through gift codes that users can redeem.
8
+ * Each campaign targets specific products and has an expiration date.
9
+ * Gift amounts are credited to the user's product wallet upon redemption.
10
+ *
11
+ * @extends TrackableEntity
12
+ */
13
+ export declare class CampaigneEntity extends TrackableEntity<Campaigne> {
14
+ /**
15
+ * Product types this campaign applies to
16
+ * @default []
17
+ */
18
+ products: ProductType[];
19
+ /**
20
+ * Localized content for the campaign (title, description, etc.)
21
+ */
22
+ translations: Content[];
23
+ /**
24
+ * URL to the campaign's promotional image
25
+ */
26
+ imageUrl: string;
27
+ /**
28
+ * Campaign discount amount
29
+ * This amount will be stored on product credit
30
+ */
31
+ giftAmount: number;
32
+ /**
33
+ * Campaign expiration date - after this date, codes cannot be redeemed
34
+ */
35
+ exipryDate: Date;
36
+ /**
37
+ * Gift codes associated with this campaign
38
+ */
39
+ giftCodes: Promise<CampaigneGiftCodeEntity[]>;
40
+ /**
41
+ * Creates a new CampaignEntity instance
42
+ * @param props - Partial properties to initialize the entity
43
+ */
44
+ constructor(props?: Partial<CampaigneEntity>);
45
+ /**
46
+ * Converts the entity to a Campaigne model instance
47
+ * @param lang - Optional language for translations
48
+ * @returns Campaigne model with localized content
49
+ */
50
+ toModel(lang?: Language): Campaigne;
51
+ toSummary(lang?: Language): Campaigne;
52
+ /**
53
+ * Retrieves all gift codes for this campaign
54
+ * @returns Promise resolving to array of GiftCode models
55
+ */
56
+ getCodes(): Promise<import("@driveup/common").GiftCode[]>;
57
+ /**
58
+ * Gets the localized translation for the campaign
59
+ * @param lang - Optional language code; defaults to current i18n context
60
+ * @returns Content instance with translated title and description
61
+ */
62
+ getTranslation(lang?: Language): Content;
63
+ /**
64
+ * Gets all available translations for the campaign
65
+ * @returns Array of Content instances for all languages
66
+ */
67
+ getTranslations(): Content[];
68
+ getActivities(): Promise<Activity[]>;
69
+ }
@@ -0,0 +1,179 @@
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.CampaigneEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("@driveup/common");
15
+ const gifcode_entity_1 = require("./gifcode.entity");
16
+ const common_2 = require("@driveup/common");
17
+ const nestjs_i18n_1 = require("nestjs-i18n");
18
+ const utils_1 = require("../../utils");
19
+ const staff_entity_1 = require("../staff/staff.entity");
20
+ const utils_2 = require("../../utils");
21
+ /**
22
+ * Represents a marketing campaign in the system.
23
+ * Campaigns offer promotional discounts through gift codes that users can redeem.
24
+ * Each campaign targets specific products and has an expiration date.
25
+ * Gift amounts are credited to the user's product wallet upon redemption.
26
+ *
27
+ * @extends TrackableEntity
28
+ */
29
+ let CampaigneEntity = class CampaigneEntity extends utils_2.TrackableEntity {
30
+ /**
31
+ * Product types this campaign applies to
32
+ * @default []
33
+ */
34
+ products;
35
+ /**
36
+ * Localized content for the campaign (title, description, etc.)
37
+ */
38
+ translations;
39
+ /**
40
+ * URL to the campaign's promotional image
41
+ */
42
+ imageUrl;
43
+ /**
44
+ * Campaign discount amount
45
+ * This amount will be stored on product credit
46
+ */
47
+ giftAmount;
48
+ /**
49
+ * Campaign expiration date - after this date, codes cannot be redeemed
50
+ */
51
+ exipryDate;
52
+ /**
53
+ * Gift codes associated with this campaign
54
+ */
55
+ giftCodes;
56
+ /**
57
+ * Creates a new CampaignEntity instance
58
+ * @param props - Partial properties to initialize the entity
59
+ */
60
+ constructor(props) {
61
+ super();
62
+ Object.assign(this, props);
63
+ }
64
+ /**
65
+ * Converts the entity to a Campaigne model instance
66
+ * @param lang - Optional language for translations
67
+ * @returns Campaigne model with localized content
68
+ */
69
+ toModel(lang) {
70
+ const transaltion = this.getTranslation(lang);
71
+ return new common_1.Campaigne({
72
+ id: this.id,
73
+ title: transaltion.title,
74
+ description: transaltion.description,
75
+ giftAmount: this.giftAmount,
76
+ imageUrl: transaltion.imageUrl || this.imageUrl,
77
+ exipryDate: this.exipryDate,
78
+ });
79
+ }
80
+ toSummary(lang) {
81
+ return this.toModel(lang);
82
+ }
83
+ /**
84
+ * Retrieves all gift codes for this campaign
85
+ * @returns Promise resolving to array of GiftCode models
86
+ */
87
+ async getCodes() {
88
+ return await Promise.all((await this.giftCodes).map(async (codeEntity) => codeEntity.toModel()));
89
+ }
90
+ /**
91
+ * Gets the localized translation for the campaign
92
+ * @param lang - Optional language code; defaults to current i18n context
93
+ * @returns Content instance with translated title and description
94
+ */
95
+ getTranslation(lang) {
96
+ const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
97
+ const translation = this.translations?.find(t => t.language === language);
98
+ return new common_1.Content({
99
+ title: translation?.title,
100
+ description: translation?.description,
101
+ content: translation?.content,
102
+ imageUrl: translation?.imageUrl,
103
+ link: translation?.link,
104
+ });
105
+ }
106
+ /**
107
+ * Gets all available translations for the campaign
108
+ * @returns Array of Content instances for all languages
109
+ */
110
+ getTranslations() {
111
+ return this.translations?.map(t => new common_1.Content({
112
+ title: t.title,
113
+ description: t.description,
114
+ content: t.content,
115
+ imageUrl: t.imageUrl,
116
+ link: t.link,
117
+ language: t.language
118
+ }));
119
+ }
120
+ async getActivities() {
121
+ const activities = [];
122
+ activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
123
+ activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
124
+ activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
125
+ activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
126
+ return activities.filter(a => a);
127
+ }
128
+ };
129
+ exports.CampaigneEntity = CampaigneEntity;
130
+ __decorate([
131
+ (0, typeorm_1.Column)({
132
+ type: 'set',
133
+ enum: common_2.ProductType,
134
+ default: [],
135
+ nullable: false
136
+ }),
137
+ __metadata("design:type", Array)
138
+ ], CampaigneEntity.prototype, "products", void 0);
139
+ __decorate([
140
+ (0, typeorm_1.Column)({
141
+ type: 'simple-json',
142
+ nullable: true,
143
+ default: null
144
+ }),
145
+ __metadata("design:type", Array)
146
+ ], CampaigneEntity.prototype, "translations", void 0);
147
+ __decorate([
148
+ (0, typeorm_1.Column)({
149
+ nullable: true,
150
+ default: null
151
+ }),
152
+ __metadata("design:type", String)
153
+ ], CampaigneEntity.prototype, "imageUrl", void 0);
154
+ __decorate([
155
+ (0, typeorm_1.Column)({
156
+ type: 'decimal',
157
+ precision: 10,
158
+ scale: 2,
159
+ nullable: false,
160
+ default: 0
161
+ }),
162
+ __metadata("design:type", Number)
163
+ ], CampaigneEntity.prototype, "giftAmount", void 0);
164
+ __decorate([
165
+ (0, typeorm_1.Column)({
166
+ nullable: true,
167
+ default: null
168
+ }),
169
+ __metadata("design:type", Date)
170
+ ], CampaigneEntity.prototype, "exipryDate", void 0);
171
+ __decorate([
172
+ (0, typeorm_1.OneToMany)(() => gifcode_entity_1.CampaigneGiftCodeEntity, giftCode => giftCode.campaign),
173
+ __metadata("design:type", Promise)
174
+ ], CampaigneEntity.prototype, "giftCodes", void 0);
175
+ exports.CampaigneEntity = CampaigneEntity = __decorate([
176
+ (0, typeorm_1.Entity)('systemCampaigns'),
177
+ __metadata("design:paramtypes", [Object])
178
+ ], CampaigneEntity);
179
+ //# sourceMappingURL=campaign.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaign.entity.js","sourceRoot":"","sources":["../../../src/system/campaigne/campaign.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,4CAAuF;AACvF,qDAA2D;AAC3D,4CAA8C;AAC9C,6CAA0C;AAC1C,uCAAyC;AACzC,wDAAoD;AACpD,uCAA8C;AAE9C;;;;;;;GAOG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,uBAA0B;IAE9D;;;OAGG;IAOH,QAAQ,CAAgB;IAExB;;OAEG;IAMH,YAAY,CAAY;IAExB;;OAEG;IAKH,QAAQ,CAAS;IAEjB;;;OAGG;IAQH,UAAU,CAAS;IAEnB;;OAEG;IAKH,UAAU,CAAO;IAEjB;;OAEG;IAEH,SAAS,CAAqC;IAE9C;;;OAGG;IACH,YAAY,KAAgC;QAC3C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAe;QACtB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO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,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;iDACe;AAajB;IAPC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;KACV,CAAC;;mDACiB;AASnB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;8BACU,IAAI;mDAAC;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wCAAuB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;;kDAC1B;0BA3DlC,eAAe;IAD3B,IAAA,gBAAM,EAAC,iBAAiB,CAAC;;GACb,eAAe,CA6I3B"}
@@ -0,0 +1,54 @@
1
+ import { Activity, GiftCode, ProfileType } from '@driveup/common';
2
+ import { CampaigneEntity } from './campaign.entity';
3
+ import { TrackableEntity } from '../../utils';
4
+ /**
5
+ * Campaign gift code entity representing promotional codes for campaigns.
6
+ * Extends TrackableEntity to track creation and update information.
7
+ */
8
+ export declare class CampaigneGiftCodeEntity extends TrackableEntity<GiftCode> {
9
+ /**
10
+ * The ID of the campaign this gift code belongs to
11
+ */
12
+ campaignId: number;
13
+ /**
14
+ * Unique 8-character gift code
15
+ */
16
+ code: string;
17
+ /**
18
+ * Profile type that can use this gift code (Company, Student, Agent)
19
+ */
20
+ profile: ProfileType;
21
+ /**
22
+ * ID of the user who registered/used this gift code
23
+ */
24
+ registredBy: number;
25
+ /**
26
+ * Timestamp when this gift code was registered/used
27
+ */
28
+ registredOn: Date;
29
+ /**
30
+ * The campaign associated with this gift code
31
+ */
32
+ campaign: CampaigneEntity;
33
+ /**
34
+ * Creates a new CampaigneGiftCodeEntity instance
35
+ * @param props - Partial properties to initialize the entity with
36
+ */
37
+ constructor(props?: Partial<CampaigneGiftCodeEntity>);
38
+ /**
39
+ * Converts the entity to a GiftCode model instance
40
+ * @returns GiftCode model with basic gift code information
41
+ */
42
+ toModel(): GiftCode;
43
+ /**
44
+ * Returns a summary representation of the gift code
45
+ * @returns GiftCode model instance (same as toModel())
46
+ */
47
+ toSummary(): GiftCode;
48
+ /**
49
+ * Retrieves all tracked activities for this gift code
50
+ * Includes creation, registration timestamps and associated staff members
51
+ * @returns Array of Activity objects
52
+ */
53
+ getActivities(): Promise<Activity[]>;
54
+ }