@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.
- package/README.md +174 -0
- package/lib/catalog/addon/addon.entity.d.ts +109 -0
- package/lib/catalog/addon/addon.entity.js +260 -0
- package/lib/catalog/addon/addon.entity.js.map +1 -0
- package/lib/catalog/addon/country.entity.d.ts +112 -0
- package/lib/catalog/addon/country.entity.js +246 -0
- package/lib/catalog/addon/country.entity.js.map +1 -0
- package/lib/catalog/driving/category.entity.d.ts +122 -0
- package/lib/catalog/driving/category.entity.js +217 -0
- package/lib/catalog/driving/category.entity.js.map +1 -0
- package/lib/catalog/driving/vehicle.entity.d.ts +49 -0
- package/lib/catalog/driving/vehicle.entity.js +97 -0
- package/lib/catalog/driving/vehicle.entity.js.map +1 -0
- package/lib/catalog/priceplan/priceplan.entity.d.ts +123 -0
- package/lib/catalog/priceplan/priceplan.entity.js +288 -0
- package/lib/catalog/priceplan/priceplan.entity.js.map +1 -0
- package/lib/catalog/product/country.entity.d.ts +109 -0
- package/lib/catalog/product/country.entity.js +233 -0
- package/lib/catalog/product/country.entity.js.map +1 -0
- package/lib/catalog/product/priceplan.entity.d.ts +113 -0
- package/lib/catalog/product/priceplan.entity.js +251 -0
- package/lib/catalog/product/priceplan.entity.js.map +1 -0
- package/lib/catalog/product/product.entity.d.ts +104 -0
- package/lib/catalog/product/product.entity.js +262 -0
- package/lib/catalog/product/product.entity.js.map +1 -0
- package/lib/catalog/program/program.entity.d.ts +107 -0
- package/lib/catalog/program/program.entity.js +247 -0
- package/lib/catalog/program/program.entity.js.map +1 -0
- package/lib/catalog/seed/assets/asset.entity.d.ts +68 -0
- package/lib/catalog/seed/assets/asset.entity.js +163 -0
- package/lib/catalog/seed/assets/asset.entity.js.map +1 -0
- package/lib/catalog/seed/courses/course.entity.d.ts +98 -0
- package/lib/catalog/seed/courses/course.entity.js +216 -0
- package/lib/catalog/seed/courses/course.entity.js.map +1 -0
- package/lib/catalog/seed/courses/lesson.entity.d.ts +90 -0
- package/lib/catalog/seed/courses/lesson.entity.js +214 -0
- package/lib/catalog/seed/courses/lesson.entity.js.map +1 -0
- package/lib/catalog/seed/courses/topic.entity.d.ts +77 -0
- package/lib/catalog/seed/courses/topic.entity.js +185 -0
- package/lib/catalog/seed/courses/topic.entity.js.map +1 -0
- package/lib/catalog/seed/expense/category.entity.d.ts +61 -0
- package/lib/catalog/seed/expense/category.entity.js +153 -0
- package/lib/catalog/seed/expense/category.entity.js.map +1 -0
- package/lib/index.d.ts +67 -0
- package/lib/index.js +89 -0
- package/lib/index.js.map +1 -0
- package/lib/profile/agent/agent.entity.d.ts +95 -0
- package/lib/profile/agent/agent.entity.js +223 -0
- package/lib/profile/agent/agent.entity.js.map +1 -0
- package/lib/profile/agent/payout.entity.d.ts +70 -0
- package/lib/profile/agent/payout.entity.js +160 -0
- package/lib/profile/agent/payout.entity.js.map +1 -0
- package/lib/profile/agent/promotion.entity.d.ts +82 -0
- package/lib/profile/agent/promotion.entity.js +174 -0
- package/lib/profile/agent/promotion.entity.js.map +1 -0
- package/lib/profile/company/company.entity.d.ts +234 -0
- package/lib/profile/company/company.entity.js +558 -0
- package/lib/profile/company/company.entity.js.map +1 -0
- package/lib/profile/company/course/appointment.entity.d.ts +111 -0
- package/lib/profile/company/course/appointment.entity.js +240 -0
- package/lib/profile/company/course/appointment.entity.js.map +1 -0
- package/lib/profile/company/course/course.entity.d.ts +156 -0
- package/lib/profile/company/course/course.entity.js +365 -0
- package/lib/profile/company/course/course.entity.js.map +1 -0
- package/lib/profile/company/course/lesson.entity.d.ts +123 -0
- package/lib/profile/company/course/lesson.entity.js +288 -0
- package/lib/profile/company/course/lesson.entity.js.map +1 -0
- package/lib/profile/company/course/topic.entity.d.ts +55 -0
- package/lib/profile/company/course/topic.entity.js +147 -0
- package/lib/profile/company/course/topic.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/bill.entity.d.ts +145 -0
- package/lib/profile/company/finances/billing/bill.entity.js +338 -0
- package/lib/profile/company/finances/billing/bill.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/item.entity.d.ts +75 -0
- package/lib/profile/company/finances/billing/item.entity.js +219 -0
- package/lib/profile/company/finances/billing/item.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/transaction.entity.d.ts +44 -0
- package/lib/profile/company/finances/billing/transaction.entity.js +158 -0
- package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -0
- package/lib/profile/company/finances/expense/category.entity.d.ts +55 -0
- package/lib/profile/company/finances/expense/category.entity.js +117 -0
- package/lib/profile/company/finances/expense/category.entity.js.map +1 -0
- package/lib/profile/company/finances/expense/expense.entity.d.ts +48 -0
- package/lib/profile/company/finances/expense/expense.entity.js +171 -0
- package/lib/profile/company/finances/expense/expense.entity.js.map +1 -0
- package/lib/profile/company/finances/handover/handover.entity.d.ts +44 -0
- package/lib/profile/company/finances/handover/handover.entity.js +202 -0
- package/lib/profile/company/finances/handover/handover.entity.js.map +1 -0
- package/lib/profile/company/finances/invoice/invoice.entity.d.ts +65 -0
- package/lib/profile/company/finances/invoice/invoice.entity.js +296 -0
- package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -0
- package/lib/profile/company/finances/invoice/item.entity.d.ts +25 -0
- package/lib/profile/company/finances/invoice/item.entity.js +148 -0
- package/lib/profile/company/finances/invoice/item.entity.js.map +1 -0
- package/lib/profile/company/finances/payment/method.entity.d.ts +35 -0
- package/lib/profile/company/finances/payment/method.entity.js +143 -0
- package/lib/profile/company/finances/payment/method.entity.js.map +1 -0
- package/lib/profile/company/finances/peyment/method.entity.d.ts +35 -0
- package/lib/profile/company/finances/peyment/method.entity.js +143 -0
- package/lib/profile/company/finances/peyment/method.entity.js.map +1 -0
- package/lib/profile/company/finances/peyment-method/payment-method.d.ts +34 -0
- package/lib/profile/company/finances/peyment-method/payment-method.js +118 -0
- package/lib/profile/company/finances/peyment-method/payment-method.js.map +1 -0
- package/lib/profile/company/instructor/instructor.entity.d.ts +85 -0
- package/lib/profile/company/instructor/instructor.entity.js +254 -0
- package/lib/profile/company/instructor/instructor.entity.js.map +1 -0
- package/lib/profile/company/instructor/task.entity.d.ts +60 -0
- package/lib/profile/company/instructor/task.entity.js +133 -0
- package/lib/profile/company/instructor/task.entity.js.map +1 -0
- package/lib/profile/company/medical/examination.entity.d.ts +59 -0
- package/lib/profile/company/medical/examination.entity.js +175 -0
- package/lib/profile/company/medical/examination.entity.js.map +1 -0
- package/lib/profile/company/medical/product.entity.d.ts +99 -0
- package/lib/profile/company/medical/product.entity.js +270 -0
- package/lib/profile/company/medical/product.entity.js.map +1 -0
- package/lib/profile/company/metrics/company.metric.d.ts +21 -0
- package/lib/profile/company/metrics/company.metric.js +122 -0
- package/lib/profile/company/metrics/company.metric.js.map +1 -0
- package/lib/profile/company/product/addon.entity.d.ts +93 -0
- package/lib/profile/company/product/addon.entity.js +234 -0
- package/lib/profile/company/product/addon.entity.js.map +1 -0
- package/lib/profile/company/product/priceplan.entity.d.ts +57 -0
- package/lib/profile/company/product/priceplan.entity.js +167 -0
- package/lib/profile/company/product/priceplan.entity.js.map +1 -0
- package/lib/profile/company/product/product.entity.d.ts +171 -0
- package/lib/profile/company/product/product.entity.js +383 -0
- package/lib/profile/company/product/product.entity.js.map +1 -0
- package/lib/profile/company/product/vehicle.entity.d.ts +46 -0
- package/lib/profile/company/product/vehicle.entity.js +144 -0
- package/lib/profile/company/product/vehicle.entity.js.map +1 -0
- package/lib/profile/instructor/instructor.entity.d.ts +80 -0
- package/lib/profile/instructor/instructor.entity.js +186 -0
- package/lib/profile/instructor/instructor.entity.js.map +1 -0
- package/lib/profile/student/program/licence/licence.entity.d.ts +66 -0
- package/lib/profile/student/program/licence/licence.entity.js +187 -0
- package/lib/profile/student/program/licence/licence.entity.js.map +1 -0
- package/lib/profile/student/program/medical/certificate.entity.d.ts +84 -0
- package/lib/profile/student/program/medical/certificate.entity.js +244 -0
- package/lib/profile/student/program/medical/certificate.entity.js.map +1 -0
- package/lib/profile/student/program/medical/examination.model.d.ts +65 -0
- package/lib/profile/student/program/medical/examination.model.js +209 -0
- package/lib/profile/student/program/medical/examination.model.js.map +1 -0
- package/lib/profile/student/program/program.entity.d.ts +78 -0
- package/lib/profile/student/program/program.entity.js +225 -0
- package/lib/profile/student/program/program.entity.js.map +1 -0
- package/lib/profile/student/program/training/appointment.entity.d.ts +151 -0
- package/lib/profile/student/program/training/appointment.entity.js +441 -0
- package/lib/profile/student/program/training/appointment.entity.js.map +1 -0
- package/lib/profile/student/program/training/exam.entity.d.ts +41 -0
- package/lib/profile/student/program/training/exam.entity.js +141 -0
- package/lib/profile/student/program/training/exam.entity.js.map +1 -0
- package/lib/profile/student/program/training/lesson.entity.d.ts +84 -0
- package/lib/profile/student/program/training/lesson.entity.js +221 -0
- package/lib/profile/student/program/training/lesson.entity.js.map +1 -0
- package/lib/profile/student/program/training/request.entity.d.ts +56 -0
- package/lib/profile/student/program/training/request.entity.js +159 -0
- package/lib/profile/student/program/training/request.entity.js.map +1 -0
- package/lib/profile/student/program/training/topic.entity.d.ts +109 -0
- package/lib/profile/student/program/training/topic.entity.js +255 -0
- package/lib/profile/student/program/training/topic.entity.js.map +1 -0
- package/lib/profile/student/program/training/training.entity.d.ts +167 -0
- package/lib/profile/student/program/training/training.entity.js +501 -0
- package/lib/profile/student/program/training/training.entity.js.map +1 -0
- package/lib/profile/student/program/training/transaction.entity.d.ts +111 -0
- package/lib/profile/student/program/training/transaction.entity.js +266 -0
- package/lib/profile/student/program/training/transaction.entity.js.map +1 -0
- package/lib/profile/student/student.entity.d.ts +89 -0
- package/lib/profile/student/student.entity.js +183 -0
- package/lib/profile/student/student.entity.js.map +1 -0
- package/lib/system/campaign/campaign.entity.d.ts +68 -0
- package/lib/system/campaign/campaign.entity.js +150 -0
- package/lib/system/campaign/campaign.entity.js.map +1 -0
- package/lib/system/campaign/gifcode.entity.d.ts +14 -0
- package/lib/system/campaign/gifcode.entity.js +77 -0
- package/lib/system/campaign/gifcode.entity.js.map +1 -0
- package/lib/system/campaigne/campaign.entity.d.ts +69 -0
- package/lib/system/campaigne/campaign.entity.js +179 -0
- package/lib/system/campaigne/campaign.entity.js.map +1 -0
- package/lib/system/campaigne/gifcode.entity.d.ts +54 -0
- package/lib/system/campaigne/gifcode.entity.js +126 -0
- package/lib/system/campaigne/gifcode.entity.js.map +1 -0
- package/lib/system/country/country.entity.d.ts +121 -0
- package/lib/system/country/country.entity.js +284 -0
- package/lib/system/country/country.entity.js.map +1 -0
- package/lib/system/country/country.metric.d.ts +12 -0
- package/lib/system/country/country.metric.js +68 -0
- package/lib/system/country/country.metric.js.map +1 -0
- package/lib/system/currency/currency.entity.d.ts +46 -0
- package/lib/system/currency/currency.entity.js +112 -0
- package/lib/system/currency/currency.entity.js.map +1 -0
- package/lib/system/driving/category.entity.d.ts +146 -0
- package/lib/system/driving/category.entity.js +321 -0
- package/lib/system/driving/category.entity.js.map +1 -0
- package/lib/system/driving/vehicle.entity.d.ts +54 -0
- package/lib/system/driving/vehicle.entity.js +130 -0
- package/lib/system/driving/vehicle.entity.js.map +1 -0
- package/lib/system/event/business.entity.d.ts +75 -0
- package/lib/system/event/business.entity.js +170 -0
- package/lib/system/event/business.entity.js.map +1 -0
- package/lib/system/event/log.entity.d.ts +103 -0
- package/lib/system/event/log.entity.js +202 -0
- package/lib/system/event/log.entity.js.map +1 -0
- package/lib/system/policy/policy.entity.d.ts +90 -0
- package/lib/system/policy/policy.entity.js +226 -0
- package/lib/system/policy/policy.entity.js.map +1 -0
- package/lib/system/staff/staff.entity.d.ts +72 -0
- package/lib/system/staff/staff.entity.js +186 -0
- package/lib/system/staff/staff.entity.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/user/alert.entity.d.ts +95 -0
- package/lib/user/alert.entity.js +223 -0
- package/lib/user/alert.entity.js.map +1 -0
- package/lib/user/blocked.entity.d.ts +42 -0
- package/lib/user/blocked.entity.js +83 -0
- package/lib/user/blocked.entity.js.map +1 -0
- package/lib/user/device.entity.d.ts +72 -0
- package/lib/user/device.entity.js +182 -0
- package/lib/user/device.entity.js.map +1 -0
- package/lib/user/notification.entity.d.ts +87 -0
- package/lib/user/notification.entity.js +219 -0
- package/lib/user/notification.entity.js.map +1 -0
- package/lib/user/ticket.entity.d.ts +85 -0
- package/lib/user/ticket.entity.js +231 -0
- package/lib/user/ticket.entity.js.map +1 -0
- package/lib/user/user.entity.d.ts +235 -0
- package/lib/user/user.entity.js +573 -0
- package/lib/user/user.entity.js.map +1 -0
- package/lib/user/verification.entity.d.ts +75 -0
- package/lib/user/verification.entity.js +142 -0
- package/lib/user/verification.entity.js.map +1 -0
- package/lib/utils/activity.helper.d.ts +26 -0
- package/lib/utils/activity.helper.js +39 -0
- package/lib/utils/activity.helper.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +21 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/json-metrics.transform.d.ts +35 -0
- package/lib/utils/json-metrics.transform.js +83 -0
- package/lib/utils/json-metrics.transform.js.map +1 -0
- package/lib/utils/numeric.transform.d.ts +38 -0
- package/lib/utils/numeric.transform.js +74 -0
- package/lib/utils/numeric.transform.js.map +1 -0
- package/lib/utils/trackable.entity.d.ts +82 -0
- package/lib/utils/trackable.entity.js +100 -0
- package/lib/utils/trackable.entity.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,247 @@
|
|
|
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.ProgramEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
15
|
+
const common_1 = require("@driveup/common");
|
|
16
|
+
const common_2 = require("@driveup/common");
|
|
17
|
+
const staff_entity_1 = require("../../system/staff/staff.entity");
|
|
18
|
+
const program_entity_1 = require("../../profile/student/program/program.entity");
|
|
19
|
+
const category_entity_1 = require("../../system/driving/category.entity");
|
|
20
|
+
const utils_1 = require("../../utils");
|
|
21
|
+
/**
|
|
22
|
+
* Represents a training program in the system.
|
|
23
|
+
* Programs define structured learning paths associated with driving categories.
|
|
24
|
+
* Each program can be linked to multiple products and contains localized content.
|
|
25
|
+
* Programs can be activated/deactivated to control availability for new customers.
|
|
26
|
+
*
|
|
27
|
+
* @extends TrackableEntity<Program>
|
|
28
|
+
*/
|
|
29
|
+
let ProgramEntity = class ProgramEntity extends utils_1.TrackableEntity {
|
|
30
|
+
/**
|
|
31
|
+
* Type of program (e.g., Driving, FirstAid)
|
|
32
|
+
* Must be unique across all programs
|
|
33
|
+
* @default ProgramType.Driving
|
|
34
|
+
*/
|
|
35
|
+
type;
|
|
36
|
+
/**
|
|
37
|
+
* List of product types this program applies to
|
|
38
|
+
* @default [ProductType.DrivingCar]
|
|
39
|
+
*/
|
|
40
|
+
products;
|
|
41
|
+
/**
|
|
42
|
+
* Country driving category id
|
|
43
|
+
*/
|
|
44
|
+
categoryId;
|
|
45
|
+
/**
|
|
46
|
+
* URL to the program's representative image
|
|
47
|
+
*/
|
|
48
|
+
imageUrl;
|
|
49
|
+
/**
|
|
50
|
+
* Program localization
|
|
51
|
+
*/
|
|
52
|
+
translations;
|
|
53
|
+
/**
|
|
54
|
+
* Product active status
|
|
55
|
+
* Activating/Deactivating a product will not affect existing customers,
|
|
56
|
+
* but will prevent new customers from purchasing the variant.
|
|
57
|
+
* Deactivating must set all country variants to enabled=false
|
|
58
|
+
*/
|
|
59
|
+
active;
|
|
60
|
+
/**
|
|
61
|
+
* Sort order for displaying programs
|
|
62
|
+
* @default 1
|
|
63
|
+
*/
|
|
64
|
+
sort;
|
|
65
|
+
/**
|
|
66
|
+
* ID of the staff member who enabled this program
|
|
67
|
+
*/
|
|
68
|
+
enabledBy;
|
|
69
|
+
/**
|
|
70
|
+
* Date when the program was enabled
|
|
71
|
+
*/
|
|
72
|
+
enabledOn;
|
|
73
|
+
/**
|
|
74
|
+
* ID of the staff member who disabled this program
|
|
75
|
+
*/
|
|
76
|
+
disabledBy;
|
|
77
|
+
/**
|
|
78
|
+
* Date when the program was disabled
|
|
79
|
+
*/
|
|
80
|
+
disabledOn;
|
|
81
|
+
/**
|
|
82
|
+
* Program category
|
|
83
|
+
*/
|
|
84
|
+
category;
|
|
85
|
+
/**
|
|
86
|
+
* Binded student programs
|
|
87
|
+
*/
|
|
88
|
+
studentPrograms;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new ProgramEntity instance
|
|
91
|
+
* @param props - Partial properties to initialize the entity
|
|
92
|
+
*/
|
|
93
|
+
constructor(props) {
|
|
94
|
+
super();
|
|
95
|
+
Object.assign(this, props);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Converts the entity to a Program model instance
|
|
99
|
+
* @param lang - Optional language for translations
|
|
100
|
+
* @returns Promise resolving to Program model with localized content
|
|
101
|
+
*/
|
|
102
|
+
async toModel(lang) {
|
|
103
|
+
const translation = this.getTranslation(lang);
|
|
104
|
+
const category = (await this.category).toModel(lang);
|
|
105
|
+
return new common_1.Program({
|
|
106
|
+
id: this.id,
|
|
107
|
+
category: category,
|
|
108
|
+
title: translation.title,
|
|
109
|
+
description: translation.description,
|
|
110
|
+
imageUrl: translation.imageUrl || this.imageUrl,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Converts the entity to a Program model instance
|
|
115
|
+
* @param lang - Optional language for translations
|
|
116
|
+
* @returns Promise resolving to Program model with localized content
|
|
117
|
+
*/
|
|
118
|
+
async toSummary(lang) {
|
|
119
|
+
return await this.toModel(lang);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Gets the localized translation for the program
|
|
123
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
124
|
+
* @returns Content instance with translated title and description
|
|
125
|
+
*/
|
|
126
|
+
getTranslation(lang) {
|
|
127
|
+
const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
|
|
128
|
+
const translation = this.translations?.find(t => t.language === language);
|
|
129
|
+
return new common_2.Content({
|
|
130
|
+
title: translation?.title,
|
|
131
|
+
description: translation?.description,
|
|
132
|
+
content: translation?.content,
|
|
133
|
+
imageUrl: translation?.imageUrl || this.imageUrl,
|
|
134
|
+
link: translation?.link,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Gets all available translations for the program
|
|
139
|
+
* @returns Array of Content instances for all languages
|
|
140
|
+
*/
|
|
141
|
+
getTranslations() {
|
|
142
|
+
return this.translations?.map(t => new common_2.Content({
|
|
143
|
+
title: t.title,
|
|
144
|
+
description: t.description,
|
|
145
|
+
content: t.content,
|
|
146
|
+
imageUrl: t.imageUrl,
|
|
147
|
+
link: t.link,
|
|
148
|
+
language: t.language
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Retrieves activity history for this program
|
|
153
|
+
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
154
|
+
*/
|
|
155
|
+
async getActivities() {
|
|
156
|
+
const activities = [];
|
|
157
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
158
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
|
|
159
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
160
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
|
|
161
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledBy, common_2.ActivityType.enabledBy, staff_entity_1.StaffEntity));
|
|
162
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledOn, common_2.ActivityType.createdOn));
|
|
163
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledBy, common_2.ActivityType.disabledBy, staff_entity_1.StaffEntity));
|
|
164
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledOn, common_2.ActivityType.disabledOn));
|
|
165
|
+
return activities.filter(a => a);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
exports.ProgramEntity = ProgramEntity;
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, typeorm_1.Column)({
|
|
171
|
+
type: 'enum',
|
|
172
|
+
name: 'programType',
|
|
173
|
+
unique: true,
|
|
174
|
+
enum: common_1.ProgramType,
|
|
175
|
+
default: common_1.ProgramType.Driving,
|
|
176
|
+
nullable: false
|
|
177
|
+
}),
|
|
178
|
+
__metadata("design:type", String)
|
|
179
|
+
], ProgramEntity.prototype, "type", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, typeorm_1.Column)({
|
|
182
|
+
type: 'set',
|
|
183
|
+
enum: common_1.ProductType,
|
|
184
|
+
default: [common_1.ProductType.DrivingCar],
|
|
185
|
+
nullable: false
|
|
186
|
+
}),
|
|
187
|
+
__metadata("design:type", Array)
|
|
188
|
+
], ProgramEntity.prototype, "products", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
(0, typeorm_1.Column)(),
|
|
191
|
+
__metadata("design:type", Number)
|
|
192
|
+
], ProgramEntity.prototype, "categoryId", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, typeorm_1.Column)({
|
|
195
|
+
nullable: true,
|
|
196
|
+
default: null
|
|
197
|
+
}),
|
|
198
|
+
__metadata("design:type", String)
|
|
199
|
+
], ProgramEntity.prototype, "imageUrl", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, typeorm_1.Column)({
|
|
202
|
+
type: 'simple-json',
|
|
203
|
+
nullable: true,
|
|
204
|
+
default: null
|
|
205
|
+
}),
|
|
206
|
+
__metadata("design:type", Array)
|
|
207
|
+
], ProgramEntity.prototype, "translations", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, typeorm_1.Column)({ default: true }),
|
|
210
|
+
__metadata("design:type", Boolean)
|
|
211
|
+
], ProgramEntity.prototype, "active", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
(0, typeorm_1.Column)({
|
|
214
|
+
nullable: false,
|
|
215
|
+
default: 1
|
|
216
|
+
}),
|
|
217
|
+
__metadata("design:type", Number)
|
|
218
|
+
], ProgramEntity.prototype, "sort", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
221
|
+
__metadata("design:type", Number)
|
|
222
|
+
], ProgramEntity.prototype, "enabledBy", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
225
|
+
__metadata("design:type", Date)
|
|
226
|
+
], ProgramEntity.prototype, "enabledOn", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
229
|
+
__metadata("design:type", Number)
|
|
230
|
+
], ProgramEntity.prototype, "disabledBy", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
233
|
+
__metadata("design:type", Date)
|
|
234
|
+
], ProgramEntity.prototype, "disabledOn", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
(0, typeorm_1.ManyToMany)(() => category_entity_1.DrivingCategoryEntity, category => category.programs),
|
|
237
|
+
__metadata("design:type", Promise)
|
|
238
|
+
], ProgramEntity.prototype, "category", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
(0, typeorm_1.OneToMany)(() => program_entity_1.StudentProgramEntity, product => product.program),
|
|
241
|
+
__metadata("design:type", Promise)
|
|
242
|
+
], ProgramEntity.prototype, "studentPrograms", void 0);
|
|
243
|
+
exports.ProgramEntity = ProgramEntity = __decorate([
|
|
244
|
+
(0, typeorm_1.Entity)('systemPrograms'),
|
|
245
|
+
__metadata("design:paramtypes", [Object])
|
|
246
|
+
], ProgramEntity);
|
|
247
|
+
//# sourceMappingURL=program.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.entity.js","sourceRoot":"","sources":["../../../src/catalog/program/program.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgE;AAChE,6CAA0C;AAC1C,4CAA8E;AAC9E,4CAAkE;AAClE,kEAA8D;AAC9D,iFAAoF;AACpF,0EAA6E;AAC7E,uCAA0D;AAE1D;;;;;;;GAOG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,uBAAwB;IAE1D;;;;OAIG;IASH,IAAI,CAAc;IAElB;;;OAGG;IAOH,QAAQ,CAAgB;IAExB;;OAEG;IAEH,UAAU,CAAS;IAEnB;;OAEG;IAKH,QAAQ,CAAS;IAEjB;;OAEG;IAMH,YAAY,CAAY;IAExB;;;;;OAKG;IAEH,MAAM,CAAU;IAEhB;;;OAGG;IAKH,IAAI,CAAS;IAEb;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,SAAS,CAAO;IAEhB;;OAEG;IAEH,UAAU,CAAS;IAEnB;;OAEG;IAEH,UAAU,CAAO;IAEjB;;OAEG;IAEH,QAAQ,CAAgC;IAExC;;OAEG;IAEH,eAAe,CAAkC;IAEjD;;;OAGG;IACH,YAAY,KAA8B;QACzC,KAAK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,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC/B,IAAI;gDAAC;AAMhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACvB;AAMnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC9B,IAAI;iDAAC;AAMjB;IADC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;;+CAC/B;AAMxC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;sDACjB;wBA3GrC,aAAa;IADzB,IAAA,gBAAM,EAAC,gBAAgB,CAAC;;GACZ,aAAa,CAgMzB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Language, Content, Activity } from '@driveup/common';
|
|
2
|
+
import { AssetType, AssetScope, Asset } from '@driveup/common';
|
|
3
|
+
import { TrackableEntity } from '../../../utils';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a catalog asset (image, video, document) for promotional or educational purposes.
|
|
6
|
+
* Assets are country-specific and can have multiple localized versions.
|
|
7
|
+
* Used for marketing materials, training content, and system-wide resources.
|
|
8
|
+
*
|
|
9
|
+
* @extends TrackableEntity<Asset>
|
|
10
|
+
*/
|
|
11
|
+
export declare class CatalogAgentAssetEntity extends TrackableEntity<Asset> {
|
|
12
|
+
/**
|
|
13
|
+
* Reference to the country this asset belongs to
|
|
14
|
+
*/
|
|
15
|
+
countryId: number;
|
|
16
|
+
/**
|
|
17
|
+
* Scope/category of the asset (e.g., DriveupPromotion, Training)
|
|
18
|
+
* @default AssetScope.DriveupPromotion
|
|
19
|
+
*/
|
|
20
|
+
scope: AssetScope;
|
|
21
|
+
/**
|
|
22
|
+
* MIME type of the asset (Image, Video, Document)
|
|
23
|
+
* @default AssetType.Image
|
|
24
|
+
*/
|
|
25
|
+
type: AssetType;
|
|
26
|
+
/**
|
|
27
|
+
* Asset title
|
|
28
|
+
* Used for console administration only
|
|
29
|
+
*/
|
|
30
|
+
url: string;
|
|
31
|
+
/**
|
|
32
|
+
* Localized titles and urls
|
|
33
|
+
*/
|
|
34
|
+
translations: Content[];
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new CatalogAgentAssetEntity instance
|
|
37
|
+
* @param props - Partial properties to initialize the entity
|
|
38
|
+
*/
|
|
39
|
+
constructor(props?: Partial<CatalogAgentAssetEntity>);
|
|
40
|
+
/**
|
|
41
|
+
* Converts the entity to an Asset model instance
|
|
42
|
+
* @param lang - Optional language for translations
|
|
43
|
+
* @returns Asset model with localized content
|
|
44
|
+
*/
|
|
45
|
+
toModel(lang?: Language): Asset;
|
|
46
|
+
/**
|
|
47
|
+
* Converts the entity to an Asset model instance
|
|
48
|
+
* @param lang - Optional language for translations
|
|
49
|
+
* @returns Asset model with localized content
|
|
50
|
+
*/
|
|
51
|
+
toSummary(lang?: Language): Asset;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the localized translation for the asset
|
|
54
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
55
|
+
* @returns Content instance with translated title and description
|
|
56
|
+
*/
|
|
57
|
+
getTranslation(lang?: Language): Content;
|
|
58
|
+
/**
|
|
59
|
+
* Gets all available translations for the asset
|
|
60
|
+
* @returns Array of Content instances for all languages
|
|
61
|
+
*/
|
|
62
|
+
getTranslations(): Content[];
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves activity history for this asset
|
|
65
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
66
|
+
*/
|
|
67
|
+
getActivities(): Promise<Activity[]>;
|
|
68
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
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.CatalogAgentAssetEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
15
|
+
const common_1 = require("@driveup/common");
|
|
16
|
+
const common_2 = require("@driveup/common");
|
|
17
|
+
const staff_entity_1 = require("../../../system/staff/staff.entity");
|
|
18
|
+
const utils_1 = require("../../../utils");
|
|
19
|
+
/**
|
|
20
|
+
* Represents a catalog asset (image, video, document) for promotional or educational purposes.
|
|
21
|
+
* Assets are country-specific and can have multiple localized versions.
|
|
22
|
+
* Used for marketing materials, training content, and system-wide resources.
|
|
23
|
+
*
|
|
24
|
+
* @extends TrackableEntity<Asset>
|
|
25
|
+
*/
|
|
26
|
+
let CatalogAgentAssetEntity = class CatalogAgentAssetEntity extends utils_1.TrackableEntity {
|
|
27
|
+
/**
|
|
28
|
+
* Reference to the country this asset belongs to
|
|
29
|
+
*/
|
|
30
|
+
countryId;
|
|
31
|
+
/**
|
|
32
|
+
* Scope/category of the asset (e.g., DriveupPromotion, Training)
|
|
33
|
+
* @default AssetScope.DriveupPromotion
|
|
34
|
+
*/
|
|
35
|
+
scope;
|
|
36
|
+
/**
|
|
37
|
+
* MIME type of the asset (Image, Video, Document)
|
|
38
|
+
* @default AssetType.Image
|
|
39
|
+
*/
|
|
40
|
+
type;
|
|
41
|
+
/**
|
|
42
|
+
* Asset title
|
|
43
|
+
* Used for console administration only
|
|
44
|
+
*/
|
|
45
|
+
url;
|
|
46
|
+
/**
|
|
47
|
+
* Localized titles and urls
|
|
48
|
+
*/
|
|
49
|
+
translations;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new CatalogAgentAssetEntity instance
|
|
52
|
+
* @param props - Partial properties to initialize the entity
|
|
53
|
+
*/
|
|
54
|
+
constructor(props) {
|
|
55
|
+
super();
|
|
56
|
+
Object.assign(this, props);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Converts the entity to an Asset model instance
|
|
60
|
+
* @param lang - Optional language for translations
|
|
61
|
+
* @returns Asset model with localized content
|
|
62
|
+
*/
|
|
63
|
+
toModel(lang) {
|
|
64
|
+
const transaltion = this.getTranslation(lang);
|
|
65
|
+
return new common_2.Asset({
|
|
66
|
+
scope: this.scope,
|
|
67
|
+
type: this.type,
|
|
68
|
+
url: this.url,
|
|
69
|
+
title: transaltion?.title,
|
|
70
|
+
description: transaltion?.description
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Converts the entity to an Asset model instance
|
|
75
|
+
* @param lang - Optional language for translations
|
|
76
|
+
* @returns Asset model with localized content
|
|
77
|
+
*/
|
|
78
|
+
toSummary(lang) {
|
|
79
|
+
return this.toModel(lang);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets the localized translation for the asset
|
|
83
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
84
|
+
* @returns Content instance with translated title and description
|
|
85
|
+
*/
|
|
86
|
+
getTranslation(lang) {
|
|
87
|
+
const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
|
|
88
|
+
const translation = this.translations?.find(t => t.language === language);
|
|
89
|
+
return new common_1.Content({
|
|
90
|
+
title: translation?.title,
|
|
91
|
+
description: translation?.description,
|
|
92
|
+
content: translation?.content,
|
|
93
|
+
link: translation?.link,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Gets all available translations for the asset
|
|
98
|
+
* @returns Array of Content instances for all languages
|
|
99
|
+
*/
|
|
100
|
+
getTranslations() {
|
|
101
|
+
return this.translations?.map(t => new common_1.Content({
|
|
102
|
+
title: t.title,
|
|
103
|
+
description: t.description,
|
|
104
|
+
content: t.content,
|
|
105
|
+
imageUrl: t.imageUrl,
|
|
106
|
+
link: t.link,
|
|
107
|
+
language: t.language
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Retrieves activity history for this asset
|
|
112
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
113
|
+
*/
|
|
114
|
+
async getActivities() {
|
|
115
|
+
const activities = [];
|
|
116
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
117
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
118
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
119
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
120
|
+
return activities.filter(a => a);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
exports.CatalogAgentAssetEntity = CatalogAgentAssetEntity;
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, typeorm_1.Column)(),
|
|
126
|
+
__metadata("design:type", Number)
|
|
127
|
+
], CatalogAgentAssetEntity.prototype, "countryId", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
(0, typeorm_1.Column)({
|
|
130
|
+
type: 'enum',
|
|
131
|
+
enum: common_2.AssetScope,
|
|
132
|
+
default: common_2.AssetScope.DriveupPromotion,
|
|
133
|
+
nullable: false
|
|
134
|
+
}),
|
|
135
|
+
__metadata("design:type", String)
|
|
136
|
+
], CatalogAgentAssetEntity.prototype, "scope", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
(0, typeorm_1.Column)({
|
|
139
|
+
type: 'enum',
|
|
140
|
+
name: 'assetType',
|
|
141
|
+
enum: common_2.AssetType,
|
|
142
|
+
default: common_2.AssetType.Image,
|
|
143
|
+
nullable: false
|
|
144
|
+
}),
|
|
145
|
+
__metadata("design:type", String)
|
|
146
|
+
], CatalogAgentAssetEntity.prototype, "type", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, typeorm_1.Column)(),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], CatalogAgentAssetEntity.prototype, "url", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, typeorm_1.Column)({
|
|
153
|
+
type: 'simple-json',
|
|
154
|
+
nullable: true,
|
|
155
|
+
default: null
|
|
156
|
+
}),
|
|
157
|
+
__metadata("design:type", Array)
|
|
158
|
+
], CatalogAgentAssetEntity.prototype, "translations", void 0);
|
|
159
|
+
exports.CatalogAgentAssetEntity = CatalogAgentAssetEntity = __decorate([
|
|
160
|
+
(0, typeorm_1.Entity)('systemCatalogAssets'),
|
|
161
|
+
__metadata("design:paramtypes", [Object])
|
|
162
|
+
], CatalogAgentAssetEntity);
|
|
163
|
+
//# sourceMappingURL=asset.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset.entity.js","sourceRoot":"","sources":["../../../../src/catalog/seed/assets/asset.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,6CAA0C;AAC1C,4CAA4E;AAC5E,4CAA+D;AAC/D,qEAAiE;AACjE,0CAA6D;AAE7D;;;;;;GAMG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,uBAAsB;IAElE;;OAEG;IAEH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AAC;QACP,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,kBAAS;QACf,OAAO,EAAE,kBAAS,CAAC,KAAK;QACxB,QAAQ,EAAE,KAAK;KACf,CAAC;;qDACc;AAOhB;IADC,IAAA,gBAAM,GAAE;;oDACG;AAUZ;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;6DACsB;kCAhDZ,uBAAuB;IADnC,IAAA,gBAAM,EAAC,qBAAqB,CAAC;;GACjB,uBAAuB,CA+HnC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Activity, Content, Course, Language } from '@driveup/common';
|
|
2
|
+
import { DrivingCategoryEntity } from '../../../system/driving/category.entity';
|
|
3
|
+
import { SeedCourseLessonEntity } from './lesson.entity';
|
|
4
|
+
import { ProductCountryEntity } from '../../product/country.entity';
|
|
5
|
+
import { TrackableEntity } from '../../../utils';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a seed course template in the system.
|
|
8
|
+
* Seed courses are predefined training programs that companies can use
|
|
9
|
+
* when offering education products. Each course is linked to a product
|
|
10
|
+
* and optionally to a driving category, and contains multiple lessons.
|
|
11
|
+
*
|
|
12
|
+
* @extends TrackableEntity<Course>
|
|
13
|
+
*/
|
|
14
|
+
export declare class SeedCourseEntity extends TrackableEntity<Course> {
|
|
15
|
+
/**
|
|
16
|
+
* Country product
|
|
17
|
+
*/
|
|
18
|
+
productId: number;
|
|
19
|
+
/**
|
|
20
|
+
* Country driving catregory
|
|
21
|
+
*/
|
|
22
|
+
categoryId: number;
|
|
23
|
+
/**
|
|
24
|
+
* Localized content for the course (title, description, etc.) across different languages
|
|
25
|
+
*/
|
|
26
|
+
translations: Content[];
|
|
27
|
+
/**
|
|
28
|
+
* URL to the course's representative image
|
|
29
|
+
*/
|
|
30
|
+
imageUrl: string;
|
|
31
|
+
/**
|
|
32
|
+
* Maximum number of students for each appointment
|
|
33
|
+
* Used only by course tranings
|
|
34
|
+
*/
|
|
35
|
+
maxStudents: number;
|
|
36
|
+
/**
|
|
37
|
+
* Indicates whether the training has a fixed schedule or flexible timing
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
isFixed: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Reference to the country product this course belongs to
|
|
43
|
+
*/
|
|
44
|
+
product: Promise<ProductCountryEntity>;
|
|
45
|
+
/**
|
|
46
|
+
* Optional reference to the driving category for driving-related courses
|
|
47
|
+
*/
|
|
48
|
+
category: Promise<DrivingCategoryEntity>;
|
|
49
|
+
/**
|
|
50
|
+
* Lessons contained in this course
|
|
51
|
+
*/
|
|
52
|
+
lessons: Promise<SeedCourseLessonEntity[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new SeedCourseEntity instance
|
|
55
|
+
* @param props - Partial properties to initialize the entity
|
|
56
|
+
*/
|
|
57
|
+
constructor(props?: Partial<SeedCourseEntity>);
|
|
58
|
+
/**
|
|
59
|
+
* Converts the entity to a Course model instance
|
|
60
|
+
* @param lang - Optional language for translations
|
|
61
|
+
* @returns Course model with localized content
|
|
62
|
+
*/
|
|
63
|
+
toModel(lang?: Language): Course;
|
|
64
|
+
/**
|
|
65
|
+
* Converts the entity to a Course model instance
|
|
66
|
+
* @param lang - Optional language for translations
|
|
67
|
+
* @returns Course model with localized content
|
|
68
|
+
*/
|
|
69
|
+
toSummary(lang?: Language): Course;
|
|
70
|
+
/**
|
|
71
|
+
* Retrieves the associated product
|
|
72
|
+
* @param lang - Optional language for translations
|
|
73
|
+
* @returns Promise resolving to the Product model
|
|
74
|
+
*/
|
|
75
|
+
toProduct(lang?: Language): Promise<import("@driveup/common").Product>;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieves the associated driving category
|
|
78
|
+
* @param lang - Optional language for translations
|
|
79
|
+
* @returns Promise resolving to the DrivingCategory model
|
|
80
|
+
*/
|
|
81
|
+
toCategory(lang?: Language): Promise<import("@driveup/common").DrivingCategory>;
|
|
82
|
+
/**
|
|
83
|
+
* Gets the localized translation for the course
|
|
84
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
85
|
+
* @returns Content instance with translated title and description
|
|
86
|
+
*/
|
|
87
|
+
getTranslation(lang?: Language): Content;
|
|
88
|
+
/**
|
|
89
|
+
* Gets all available translations for the course
|
|
90
|
+
* @returns Array of Content instances for all languages
|
|
91
|
+
*/
|
|
92
|
+
getTranslations(): Content[];
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves activity history for this course
|
|
95
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
96
|
+
*/
|
|
97
|
+
getActivities(): Promise<Activity[]>;
|
|
98
|
+
}
|