@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,216 @@
|
|
|
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.SeedCourseEntity = 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 staff_entity_1 = require("../../../system/staff/staff.entity");
|
|
17
|
+
const category_entity_1 = require("../../../system/driving/category.entity");
|
|
18
|
+
const lesson_entity_1 = require("./lesson.entity");
|
|
19
|
+
const country_entity_1 = require("../../product/country.entity");
|
|
20
|
+
const utils_1 = require("../../../utils");
|
|
21
|
+
/**
|
|
22
|
+
* Represents a seed course template in the system.
|
|
23
|
+
* Seed courses are predefined training programs that companies can use
|
|
24
|
+
* when offering education products. Each course is linked to a product
|
|
25
|
+
* and optionally to a driving category, and contains multiple lessons.
|
|
26
|
+
*
|
|
27
|
+
* @extends TrackableEntity<Course>
|
|
28
|
+
*/
|
|
29
|
+
let SeedCourseEntity = class SeedCourseEntity extends utils_1.TrackableEntity {
|
|
30
|
+
/**
|
|
31
|
+
* Country product
|
|
32
|
+
*/
|
|
33
|
+
productId;
|
|
34
|
+
/**
|
|
35
|
+
* Country driving catregory
|
|
36
|
+
*/
|
|
37
|
+
categoryId;
|
|
38
|
+
/**
|
|
39
|
+
* Localized content for the course (title, description, etc.) across different languages
|
|
40
|
+
*/
|
|
41
|
+
translations;
|
|
42
|
+
/**
|
|
43
|
+
* URL to the course's representative image
|
|
44
|
+
*/
|
|
45
|
+
imageUrl;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum number of students for each appointment
|
|
48
|
+
* Used only by course tranings
|
|
49
|
+
*/
|
|
50
|
+
maxStudents;
|
|
51
|
+
/**
|
|
52
|
+
* Indicates whether the training has a fixed schedule or flexible timing
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
isFixed;
|
|
56
|
+
/**
|
|
57
|
+
* Reference to the country product this course belongs to
|
|
58
|
+
*/
|
|
59
|
+
product;
|
|
60
|
+
/**
|
|
61
|
+
* Optional reference to the driving category for driving-related courses
|
|
62
|
+
*/
|
|
63
|
+
category;
|
|
64
|
+
/**
|
|
65
|
+
* Lessons contained in this course
|
|
66
|
+
*/
|
|
67
|
+
lessons;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new SeedCourseEntity instance
|
|
70
|
+
* @param props - Partial properties to initialize the entity
|
|
71
|
+
*/
|
|
72
|
+
constructor(props) {
|
|
73
|
+
super();
|
|
74
|
+
Object.assign(this, props);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Converts the entity to a Course model instance
|
|
78
|
+
* @param lang - Optional language for translations
|
|
79
|
+
* @returns Course model with localized content
|
|
80
|
+
*/
|
|
81
|
+
toModel(lang) {
|
|
82
|
+
const transaltion = this.getTranslation(lang);
|
|
83
|
+
return new common_1.Course({
|
|
84
|
+
id: this.id,
|
|
85
|
+
title: transaltion?.title,
|
|
86
|
+
description: transaltion?.description,
|
|
87
|
+
imageUrl: transaltion?.imageUrl || this.imageUrl,
|
|
88
|
+
maxStudents: this.maxStudents,
|
|
89
|
+
isFixed: this.isFixed
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Converts the entity to a Course model instance
|
|
94
|
+
* @param lang - Optional language for translations
|
|
95
|
+
* @returns Course model with localized content
|
|
96
|
+
*/
|
|
97
|
+
toSummary(lang) {
|
|
98
|
+
return this.toModel(lang);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves the associated product
|
|
102
|
+
* @param lang - Optional language for translations
|
|
103
|
+
* @returns Promise resolving to the Product model
|
|
104
|
+
*/
|
|
105
|
+
async toProduct(lang) {
|
|
106
|
+
return (await this.product).toModel(lang);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Retrieves the associated driving category
|
|
110
|
+
* @param lang - Optional language for translations
|
|
111
|
+
* @returns Promise resolving to the DrivingCategory model
|
|
112
|
+
*/
|
|
113
|
+
async toCategory(lang) {
|
|
114
|
+
return (await this.category).toModel(lang);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Gets the localized translation for the course
|
|
118
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
119
|
+
* @returns Content instance with translated title and description
|
|
120
|
+
*/
|
|
121
|
+
getTranslation(lang) {
|
|
122
|
+
const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
|
|
123
|
+
const translation = this.translations?.find(t => t.language === language);
|
|
124
|
+
return new common_1.Content({
|
|
125
|
+
title: translation?.title,
|
|
126
|
+
description: translation?.description,
|
|
127
|
+
content: translation?.content,
|
|
128
|
+
imageUrl: translation?.imageUrl,
|
|
129
|
+
link: translation?.link,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Gets all available translations for the course
|
|
134
|
+
* @returns Array of Content instances for all languages
|
|
135
|
+
*/
|
|
136
|
+
getTranslations() {
|
|
137
|
+
return this.translations?.map(t => new common_1.Content({
|
|
138
|
+
title: t.title,
|
|
139
|
+
description: t.description,
|
|
140
|
+
content: t.content,
|
|
141
|
+
imageUrl: t.imageUrl,
|
|
142
|
+
link: t.link,
|
|
143
|
+
language: t.language
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Retrieves activity history for this course
|
|
148
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
149
|
+
*/
|
|
150
|
+
async getActivities() {
|
|
151
|
+
const activities = [];
|
|
152
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
153
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
154
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
155
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
156
|
+
return activities.filter(a => a);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
exports.SeedCourseEntity = SeedCourseEntity;
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, typeorm_1.Column)(),
|
|
162
|
+
__metadata("design:type", Number)
|
|
163
|
+
], SeedCourseEntity.prototype, "productId", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, typeorm_1.Column)({
|
|
166
|
+
nullable: true,
|
|
167
|
+
default: null
|
|
168
|
+
}),
|
|
169
|
+
__metadata("design:type", Number)
|
|
170
|
+
], SeedCourseEntity.prototype, "categoryId", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, typeorm_1.Column)({
|
|
173
|
+
type: 'simple-json',
|
|
174
|
+
nullable: true,
|
|
175
|
+
default: null
|
|
176
|
+
}),
|
|
177
|
+
__metadata("design:type", Array)
|
|
178
|
+
], SeedCourseEntity.prototype, "translations", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
(0, typeorm_1.Column)({
|
|
181
|
+
nullable: true,
|
|
182
|
+
default: null
|
|
183
|
+
}),
|
|
184
|
+
__metadata("design:type", String)
|
|
185
|
+
], SeedCourseEntity.prototype, "imageUrl", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
(0, typeorm_1.Column)({
|
|
188
|
+
nullable: false,
|
|
189
|
+
default: 1
|
|
190
|
+
}),
|
|
191
|
+
__metadata("design:type", Number)
|
|
192
|
+
], SeedCourseEntity.prototype, "maxStudents", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, typeorm_1.Column)({
|
|
195
|
+
nullable: false,
|
|
196
|
+
default: false
|
|
197
|
+
}),
|
|
198
|
+
__metadata("design:type", Boolean)
|
|
199
|
+
], SeedCourseEntity.prototype, "isFixed", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, typeorm_1.ManyToOne)(() => country_entity_1.ProductCountryEntity, product => product.seedCourses),
|
|
202
|
+
__metadata("design:type", Promise)
|
|
203
|
+
], SeedCourseEntity.prototype, "product", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
(0, typeorm_1.ManyToOne)(() => category_entity_1.DrivingCategoryEntity, category => category.seedCourses),
|
|
206
|
+
__metadata("design:type", Promise)
|
|
207
|
+
], SeedCourseEntity.prototype, "category", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, typeorm_1.OneToMany)(() => lesson_entity_1.SeedCourseLessonEntity, lesson => lesson.course),
|
|
210
|
+
__metadata("design:type", Promise)
|
|
211
|
+
], SeedCourseEntity.prototype, "lessons", void 0);
|
|
212
|
+
exports.SeedCourseEntity = SeedCourseEntity = __decorate([
|
|
213
|
+
(0, typeorm_1.Entity)('seedCourses'),
|
|
214
|
+
__metadata("design:paramtypes", [Object])
|
|
215
|
+
], SeedCourseEntity);
|
|
216
|
+
//# sourceMappingURL=course.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"course.entity.js","sourceRoot":"","sources":["../../../../src/catalog/seed/courses/course.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAC/D,6CAA0C;AAC1C,4CAAoF;AACpF,qEAAiE;AACjE,6EAAgF;AAChF,mDAAyD;AACzD,iEAAoE;AACpE,0CAA6D;AAE7D;;;;;;;GAOG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,uBAAuB;IAE5D;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAKH,UAAU,CAAS;IAEnB;;OAEG;IAMH,YAAY,CAAY;IAExB;;OAEG;IAKH,QAAQ,CAAS;IAEjB;;;OAGG;IAKH,WAAW,CAAS;IAEpB;;;OAGG;IAKH,OAAO,CAAU;IAEjB;;OAEG;I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;QAC1E,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;CACD,CAAA;AA3KY,4CAAgB;AAM5B;IADC,IAAA,gBAAM,GAAE;;mDACS;AASlB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;oDACiB;AAUnB;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;sDACsB;AASxB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;kDACe;AAUjB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;KACV,CAAC;;qDACkB;AAUpB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;KACd,CAAC;;iDACe;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;;iDAC/B;AAMvC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;;kDAChC;AAMzC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sCAAsB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;;iDACtB;2BAxE/B,gBAAgB;IAD5B,IAAA,gBAAM,EAAC,aAAa,CAAC;;GACT,gBAAgB,CA2K5B"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Activity, Content } from '@driveup/common';
|
|
2
|
+
import { Language, Lesson, Picture } from '@driveup/common';
|
|
3
|
+
import { SeedCourseEntity } from './course.entity';
|
|
4
|
+
import { SeedCourseTopicEntity } from './topic.entity';
|
|
5
|
+
import { TrackableEntity } from '../../../utils';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a lesson within a seed course.
|
|
8
|
+
* Lessons are structured learning units that contain topics, have a specific
|
|
9
|
+
* duration, and can include multimedia content through galleries.
|
|
10
|
+
* Each lesson belongs to a course and contains multiple topics.
|
|
11
|
+
*
|
|
12
|
+
* @extends TrackableEntity<Lesson>
|
|
13
|
+
*/
|
|
14
|
+
export declare class SeedCourseLessonEntity extends TrackableEntity<Lesson> {
|
|
15
|
+
/**
|
|
16
|
+
* Reference to the course this lesson belongs to
|
|
17
|
+
*/
|
|
18
|
+
courseId: number;
|
|
19
|
+
/**
|
|
20
|
+
* Localized content for the lesson (title, description, etc.)
|
|
21
|
+
*/
|
|
22
|
+
translations: Content[];
|
|
23
|
+
/**
|
|
24
|
+
* URL to the lesson's representative image
|
|
25
|
+
*/
|
|
26
|
+
imageUrl: string;
|
|
27
|
+
/**
|
|
28
|
+
* Collection of images for the lesson gallery
|
|
29
|
+
*/
|
|
30
|
+
gallery: Picture[];
|
|
31
|
+
/**
|
|
32
|
+
* Lesson number/sequence within the course
|
|
33
|
+
*/
|
|
34
|
+
number: number;
|
|
35
|
+
/**
|
|
36
|
+
* Estimated duration of the lesson in minutes
|
|
37
|
+
*/
|
|
38
|
+
duration: number;
|
|
39
|
+
/**
|
|
40
|
+
* Sort order for displaying lessons within a course
|
|
41
|
+
*/
|
|
42
|
+
sort: number;
|
|
43
|
+
/**
|
|
44
|
+
* Company training relation
|
|
45
|
+
*/
|
|
46
|
+
course: Promise<SeedCourseEntity>;
|
|
47
|
+
/**
|
|
48
|
+
* Lesson topics relation
|
|
49
|
+
*/
|
|
50
|
+
topics: Promise<SeedCourseTopicEntity[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new SeedCourseLessonEntity instance
|
|
53
|
+
* @param props - Partial properties to initialize the entity
|
|
54
|
+
*/
|
|
55
|
+
constructor(props?: Partial<SeedCourseLessonEntity>);
|
|
56
|
+
/**
|
|
57
|
+
* Converts the entity to a Lesson model instance
|
|
58
|
+
* @param lang - Optional language for translations
|
|
59
|
+
* @returns Lesson model with localized content
|
|
60
|
+
*/
|
|
61
|
+
toModel(lang?: Language): Lesson;
|
|
62
|
+
/**
|
|
63
|
+
* Converts the entity to a Lesson model instance
|
|
64
|
+
* @param lang - Optional language for translations
|
|
65
|
+
* @returns Lesson model with localized content
|
|
66
|
+
*/
|
|
67
|
+
toSummary(lang?: Language): Lesson;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the localized translation for the lesson
|
|
70
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
71
|
+
* @returns Content instance with translated title and description
|
|
72
|
+
*/
|
|
73
|
+
getTranslation(lang?: Language): Content;
|
|
74
|
+
/**
|
|
75
|
+
* Gets all available translations for the lesson
|
|
76
|
+
* @returns Array of Content instances for all languages
|
|
77
|
+
*/
|
|
78
|
+
getTranslations(): Content[];
|
|
79
|
+
/**
|
|
80
|
+
* Gets the gallery images for the lesson, optionally filtered by language
|
|
81
|
+
* @param lang - Optional language code to filter images
|
|
82
|
+
* @returns Array of Picture instances
|
|
83
|
+
*/
|
|
84
|
+
getGallery(lang?: Language): Picture[];
|
|
85
|
+
/**
|
|
86
|
+
* Retrieves activity history for this lesson
|
|
87
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
88
|
+
*/
|
|
89
|
+
getActivities(): Promise<Activity[]>;
|
|
90
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
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.SeedCourseLessonEntity = 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 course_entity_1 = require("./course.entity");
|
|
20
|
+
const topic_entity_1 = require("./topic.entity");
|
|
21
|
+
const utils_1 = require("../../../utils");
|
|
22
|
+
/**
|
|
23
|
+
* Represents a lesson within a seed course.
|
|
24
|
+
* Lessons are structured learning units that contain topics, have a specific
|
|
25
|
+
* duration, and can include multimedia content through galleries.
|
|
26
|
+
* Each lesson belongs to a course and contains multiple topics.
|
|
27
|
+
*
|
|
28
|
+
* @extends TrackableEntity<Lesson>
|
|
29
|
+
*/
|
|
30
|
+
let SeedCourseLessonEntity = class SeedCourseLessonEntity extends utils_1.TrackableEntity {
|
|
31
|
+
/**
|
|
32
|
+
* Reference to the course this lesson belongs to
|
|
33
|
+
*/
|
|
34
|
+
courseId;
|
|
35
|
+
/**
|
|
36
|
+
* Localized content for the lesson (title, description, etc.)
|
|
37
|
+
*/
|
|
38
|
+
translations;
|
|
39
|
+
/**
|
|
40
|
+
* URL to the lesson's representative image
|
|
41
|
+
*/
|
|
42
|
+
imageUrl;
|
|
43
|
+
/**
|
|
44
|
+
* Collection of images for the lesson gallery
|
|
45
|
+
*/
|
|
46
|
+
gallery;
|
|
47
|
+
/**
|
|
48
|
+
* Lesson number/sequence within the course
|
|
49
|
+
*/
|
|
50
|
+
number;
|
|
51
|
+
/**
|
|
52
|
+
* Estimated duration of the lesson in minutes
|
|
53
|
+
*/
|
|
54
|
+
duration;
|
|
55
|
+
/**
|
|
56
|
+
* Sort order for displaying lessons within a course
|
|
57
|
+
*/
|
|
58
|
+
sort;
|
|
59
|
+
/**
|
|
60
|
+
* Company training relation
|
|
61
|
+
*/
|
|
62
|
+
course;
|
|
63
|
+
/**
|
|
64
|
+
* Lesson topics relation
|
|
65
|
+
*/
|
|
66
|
+
topics;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new SeedCourseLessonEntity instance
|
|
69
|
+
* @param props - Partial properties to initialize the entity
|
|
70
|
+
*/
|
|
71
|
+
constructor(props) {
|
|
72
|
+
super();
|
|
73
|
+
Object.assign(this, props);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Converts the entity to a Lesson model instance
|
|
77
|
+
* @param lang - Optional language for translations
|
|
78
|
+
* @returns Lesson model with localized content
|
|
79
|
+
*/
|
|
80
|
+
toModel(lang) {
|
|
81
|
+
const translation = this.getTranslation(lang);
|
|
82
|
+
return new common_2.Lesson({
|
|
83
|
+
id: this.id,
|
|
84
|
+
title: translation?.title,
|
|
85
|
+
description: translation?.description,
|
|
86
|
+
imageUrl: translation?.imageUrl || this.imageUrl,
|
|
87
|
+
number: this.number,
|
|
88
|
+
duration: this.duration,
|
|
89
|
+
sort: this.sort
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Converts the entity to a Lesson model instance
|
|
94
|
+
* @param lang - Optional language for translations
|
|
95
|
+
* @returns Lesson model with localized content
|
|
96
|
+
*/
|
|
97
|
+
toSummary(lang) {
|
|
98
|
+
return this.toModel(lang);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets the localized translation for the lesson
|
|
102
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
103
|
+
* @returns Content instance with translated title and description
|
|
104
|
+
*/
|
|
105
|
+
getTranslation(lang) {
|
|
106
|
+
const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
|
|
107
|
+
const translation = this.translations?.find(t => t.language === language);
|
|
108
|
+
return new common_1.Content({
|
|
109
|
+
title: translation?.title,
|
|
110
|
+
description: translation?.description,
|
|
111
|
+
content: translation?.content,
|
|
112
|
+
imageUrl: translation?.imageUrl,
|
|
113
|
+
link: translation?.link,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Gets all available translations for the lesson
|
|
118
|
+
* @returns Array of Content instances for all languages
|
|
119
|
+
*/
|
|
120
|
+
getTranslations() {
|
|
121
|
+
return this.translations?.map(t => new common_1.Content({
|
|
122
|
+
title: t.title,
|
|
123
|
+
description: t.description,
|
|
124
|
+
content: t.content,
|
|
125
|
+
imageUrl: t.imageUrl,
|
|
126
|
+
link: t.link,
|
|
127
|
+
language: t.language
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Gets the gallery images for the lesson, optionally filtered by language
|
|
132
|
+
* @param lang - Optional language code to filter images
|
|
133
|
+
* @returns Array of Picture instances
|
|
134
|
+
*/
|
|
135
|
+
getGallery(lang) {
|
|
136
|
+
const galleryImages = lang ? this.gallery?.filter(i => i.language === lang) : this.gallery;
|
|
137
|
+
return galleryImages?.map(m => common_2.Picture.toInstance(m));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Retrieves activity history for this lesson
|
|
141
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
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
|
+
return activities.filter(a => a);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
exports.SeedCourseLessonEntity = SeedCourseLessonEntity;
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, typeorm_1.Column)(),
|
|
155
|
+
__metadata("design:type", Number)
|
|
156
|
+
], SeedCourseLessonEntity.prototype, "courseId", 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
|
+
], SeedCourseLessonEntity.prototype, "translations", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, typeorm_1.Column)({
|
|
167
|
+
nullable: true,
|
|
168
|
+
default: null
|
|
169
|
+
}),
|
|
170
|
+
__metadata("design:type", String)
|
|
171
|
+
], SeedCourseLessonEntity.prototype, "imageUrl", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, typeorm_1.Column)({
|
|
174
|
+
type: 'simple-json',
|
|
175
|
+
nullable: true,
|
|
176
|
+
default: null
|
|
177
|
+
}),
|
|
178
|
+
__metadata("design:type", Array)
|
|
179
|
+
], SeedCourseLessonEntity.prototype, "gallery", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, typeorm_1.Column)({
|
|
182
|
+
nullable: true,
|
|
183
|
+
default: null
|
|
184
|
+
}),
|
|
185
|
+
__metadata("design:type", Number)
|
|
186
|
+
], SeedCourseLessonEntity.prototype, "number", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
(0, typeorm_1.Column)({
|
|
189
|
+
nullable: true,
|
|
190
|
+
default: null
|
|
191
|
+
}),
|
|
192
|
+
__metadata("design:type", Number)
|
|
193
|
+
], SeedCourseLessonEntity.prototype, "duration", void 0);
|
|
194
|
+
__decorate([
|
|
195
|
+
(0, typeorm_1.Column)({
|
|
196
|
+
type: 'tinyint',
|
|
197
|
+
nullable: true,
|
|
198
|
+
default: null
|
|
199
|
+
}),
|
|
200
|
+
__metadata("design:type", Number)
|
|
201
|
+
], SeedCourseLessonEntity.prototype, "sort", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
(0, typeorm_2.ManyToOne)(() => course_entity_1.SeedCourseEntity, course => course.lessons),
|
|
204
|
+
__metadata("design:type", Promise)
|
|
205
|
+
], SeedCourseLessonEntity.prototype, "course", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
(0, typeorm_2.OneToMany)(() => topic_entity_1.SeedCourseTopicEntity, topic => topic.lesson),
|
|
208
|
+
__metadata("design:type", Promise)
|
|
209
|
+
], SeedCourseLessonEntity.prototype, "topics", void 0);
|
|
210
|
+
exports.SeedCourseLessonEntity = SeedCourseLessonEntity = __decorate([
|
|
211
|
+
(0, typeorm_1.Entity)('seedCourseLessons'),
|
|
212
|
+
__metadata("design:paramtypes", [Object])
|
|
213
|
+
], SeedCourseLessonEntity);
|
|
214
|
+
//# sourceMappingURL=lesson.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lesson.entity.js","sourceRoot":"","sources":["../../../../src/catalog/seed/courses/lesson.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,qCAA+C;AAC/C,6CAA0C;AAC1C,4CAAkE;AAClE,4CAA4D;AAC5D,qEAAiE;AACjE,mDAAmD;AACnD,iDAAuD;AACvD,0CAA6D;AAE7D;;;;;;;GAOG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,uBAAuB;IAElE;;OAEG;IAEH,QAAQ,CAAS;IAEjB;;OAEG;IAMH,YAAY,CAAY;IAExB;;OAEG;IAKH,QAAQ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AM,CAAC;;sDACrB;iCA3E7B,sBAAsB;IADlC,IAAA,gBAAM,EAAC,mBAAmB,CAAC;;GACf,sBAAsB,CAuKlC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Activity, Content } from '@driveup/common';
|
|
2
|
+
import { Language, Skill, Topic } from '@driveup/common';
|
|
3
|
+
import { SeedCourseLessonEntity } from './lesson.entity';
|
|
4
|
+
import { TrackableEntity } from '../../../utils';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a topic within a lesson.
|
|
7
|
+
* Topics are the smallest learning units that define specific skills and knowledge areas.
|
|
8
|
+
* Each topic belongs to a lesson and can include multiple skills that students will acquire.
|
|
9
|
+
*
|
|
10
|
+
* @extends TrackableEntity<Topic>
|
|
11
|
+
*/
|
|
12
|
+
export declare class SeedCourseTopicEntity extends TrackableEntity<Topic> {
|
|
13
|
+
/**
|
|
14
|
+
* Reference to the lesson this topic belongs to
|
|
15
|
+
*/
|
|
16
|
+
lessonId: number;
|
|
17
|
+
/**
|
|
18
|
+
* Localized content for the topic (title, description, etc.)
|
|
19
|
+
*/
|
|
20
|
+
translations: Content[];
|
|
21
|
+
/**
|
|
22
|
+
* URL to the topic's representative image
|
|
23
|
+
*/
|
|
24
|
+
imageUrl: string;
|
|
25
|
+
/**
|
|
26
|
+
* List of skills covered in this topic
|
|
27
|
+
* Skills define what students will learn and can be localized
|
|
28
|
+
*/
|
|
29
|
+
skills: Skill[];
|
|
30
|
+
/**
|
|
31
|
+
* Sort order for displaying topics within a lesson
|
|
32
|
+
*/
|
|
33
|
+
sort: number;
|
|
34
|
+
/**
|
|
35
|
+
* Reference to the parent lesson
|
|
36
|
+
*/
|
|
37
|
+
lesson: Promise<SeedCourseLessonEntity>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new SeedCourseTopicEntity instance
|
|
40
|
+
* @param props - Partial properties to initialize the entity
|
|
41
|
+
*/
|
|
42
|
+
constructor(props?: Partial<SeedCourseTopicEntity>);
|
|
43
|
+
/**
|
|
44
|
+
* Converts the entity to a Topic model instance
|
|
45
|
+
* @param lang - Optional language for translations
|
|
46
|
+
* @returns Topic model with localized content
|
|
47
|
+
*/
|
|
48
|
+
toModel(lang?: Language): Topic;
|
|
49
|
+
/**
|
|
50
|
+
* Converts the entity to a Topic model instance
|
|
51
|
+
* @param lang - Optional language for translations
|
|
52
|
+
* @returns Topic model with localized content
|
|
53
|
+
*/
|
|
54
|
+
toSummary(lang?: Language): Topic;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the localized skills for this topic
|
|
57
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
58
|
+
* @returns Array of Skill instances filtered by language
|
|
59
|
+
*/
|
|
60
|
+
getSkills(lang?: Language): Skill[];
|
|
61
|
+
/**
|
|
62
|
+
* Gets the localized translation for the topic
|
|
63
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
64
|
+
* @returns Content instance with translated title and description
|
|
65
|
+
*/
|
|
66
|
+
getTranslation(lang?: Language): Content;
|
|
67
|
+
/**
|
|
68
|
+
* Gets all available translations for the topic
|
|
69
|
+
* @returns Array of Content instances for all languages
|
|
70
|
+
*/
|
|
71
|
+
getTranslations(): Content[];
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves activity history for this topic
|
|
74
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
75
|
+
*/
|
|
76
|
+
getActivities(): Promise<Activity[]>;
|
|
77
|
+
}
|