@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,112 @@
|
|
|
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.CurrencyEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const country_entity_1 = require("../country/country.entity");
|
|
15
|
+
const common_1 = require("@driveup/common");
|
|
16
|
+
const staff_entity_1 = require("../staff/staff.entity");
|
|
17
|
+
const utils_1 = require("../../utils");
|
|
18
|
+
/**
|
|
19
|
+
* Represents a currency in the system.
|
|
20
|
+
* Currencies define monetary units used in different countries,
|
|
21
|
+
* including their symbols, abbreviations, and exchange rates relative to CHF.
|
|
22
|
+
*
|
|
23
|
+
* @extends TrackableEntity
|
|
24
|
+
*/
|
|
25
|
+
let CurrencyEntity = class CurrencyEntity extends utils_1.TrackableEntity {
|
|
26
|
+
/**
|
|
27
|
+
* Full name of the currency (e.g., "Swiss Franc", "Euro")
|
|
28
|
+
*/
|
|
29
|
+
name;
|
|
30
|
+
/**
|
|
31
|
+
* Currency abbreviation/code (e.g., "CHF", "EUR", "USD")
|
|
32
|
+
*/
|
|
33
|
+
abbr;
|
|
34
|
+
/**
|
|
35
|
+
* Currency symbol (e.g., "₣", "€", "$")
|
|
36
|
+
*/
|
|
37
|
+
symbol;
|
|
38
|
+
/**
|
|
39
|
+
* Exchange rate relative to Swiss Franc (CHF)
|
|
40
|
+
* Used for currency conversion calculations
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
chRate;
|
|
44
|
+
/**
|
|
45
|
+
* Countries using this currency
|
|
46
|
+
*/
|
|
47
|
+
countries;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new CurrencyEntity instance
|
|
50
|
+
* @param props - Partial properties to initialize the entity
|
|
51
|
+
*/
|
|
52
|
+
constructor(props) {
|
|
53
|
+
super();
|
|
54
|
+
Object.assign(this, props);
|
|
55
|
+
}
|
|
56
|
+
toModel() {
|
|
57
|
+
return new common_1.Currency({
|
|
58
|
+
id: this.id,
|
|
59
|
+
name: this.name,
|
|
60
|
+
abbr: this.abbr,
|
|
61
|
+
symbol: this.symbol,
|
|
62
|
+
chRate: this.chRate
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
toSummary() {
|
|
66
|
+
return this.toModel();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves activity history for this currency
|
|
70
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
71
|
+
*/
|
|
72
|
+
async getActivities() {
|
|
73
|
+
const activities = [];
|
|
74
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
75
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
76
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
77
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
78
|
+
return activities.filter(a => a);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.CurrencyEntity = CurrencyEntity;
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)(),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], CurrencyEntity.prototype, "name", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], CurrencyEntity.prototype, "abbr", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], CurrencyEntity.prototype, "symbol", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.Column)({
|
|
96
|
+
type: 'decimal',
|
|
97
|
+
precision: 4,
|
|
98
|
+
scale: 2,
|
|
99
|
+
nullable: false,
|
|
100
|
+
default: 0
|
|
101
|
+
}),
|
|
102
|
+
__metadata("design:type", Number)
|
|
103
|
+
], CurrencyEntity.prototype, "chRate", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, typeorm_1.OneToMany)(() => country_entity_1.CountryEntity, country => country.currency),
|
|
106
|
+
__metadata("design:type", Promise)
|
|
107
|
+
], CurrencyEntity.prototype, "countries", void 0);
|
|
108
|
+
exports.CurrencyEntity = CurrencyEntity = __decorate([
|
|
109
|
+
(0, typeorm_1.Entity)('systemCurrencies'),
|
|
110
|
+
__metadata("design:paramtypes", [Object])
|
|
111
|
+
], CurrencyEntity);
|
|
112
|
+
//# sourceMappingURL=currency.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.entity.js","sourceRoot":"","sources":["../../../src/system/currency/currency.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,8DAA0D;AAC1D,4CAA6E;AAC7E,wDAAoD;AACpD,uCAA0D;AAE1D;;;;;;GAMG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,uBAAyB;IAE5D;;OAEG;IAEH,IAAI,CAAS;IAEb;;OAEG;IAEH,IAAI,CAAS;IAEb;;OAEG;IAEH,MAAM,CAAS;IAEf;;;;OAIG;IAQH,MAAM,CAAS;IAEf;;OAEG;IAEH,SAAS,CAA2B;IAEpC;;;OAGG;IACH,YAAY,KAA+B;QAC1C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO;QACN,OAAO,IAAI,iBAAQ,CAAC;YACnB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf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,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;KACV,CAAC;;8CACa;AAMf;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8BAAa,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;iDACxB;yBAtCxB,cAAc;IAD1B,IAAA,gBAAM,EAAC,kBAAkB,CAAC;;GACd,cAAc,CA2E1B"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { DrivingCategory, Language, Metadata, Content } from '@driveup/common';
|
|
2
|
+
import { Activity, ColorContext } from '@driveup/common';
|
|
3
|
+
import { CountryEntity } from '../country/country.entity';
|
|
4
|
+
import { ProgramEntity } from '../../catalog/program/program.entity';
|
|
5
|
+
import { StudentLicenceEntity } from '../../profile/student/program/licence/licence.entity';
|
|
6
|
+
import { StudentMedicalCertificateEntity } from '../../profile/student/program/medical/certificate.entity';
|
|
7
|
+
import { CompanyMedicalProductEntity } from '../../profile/company/medical/product.entity';
|
|
8
|
+
import { CompanyCourseEntity } from '../../profile/company/course/course.entity';
|
|
9
|
+
import { SeedCourseEntity } from '../../catalog/seed/courses/course.entity';
|
|
10
|
+
import { SeedVehicleEntity } from './vehicle.entity';
|
|
11
|
+
import { TrackableEntity } from '../../utils';
|
|
12
|
+
/**
|
|
13
|
+
* Represents a driving license category in the system.
|
|
14
|
+
* Categories define the type of vehicle or driving qualification (e.g., A, B, C1, C1E).
|
|
15
|
+
* Each category has specific requirements, age limits, and associated training programs.
|
|
16
|
+
*
|
|
17
|
+
* @extends TrackableEntity<DrivingCategory>
|
|
18
|
+
*/
|
|
19
|
+
export declare class DrivingCategoryEntity extends TrackableEntity<DrivingCategory> {
|
|
20
|
+
/**
|
|
21
|
+
* ID of the country this category belongs to
|
|
22
|
+
*/
|
|
23
|
+
countryId: number;
|
|
24
|
+
/**
|
|
25
|
+
* Category name abbreviation
|
|
26
|
+
* Short representation of the category
|
|
27
|
+
* (e.g., A, B, C1, C1E etc.)
|
|
28
|
+
*/
|
|
29
|
+
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* Minimum age requirement for this driving category
|
|
32
|
+
*/
|
|
33
|
+
minAge: number;
|
|
34
|
+
/**
|
|
35
|
+
* URL to the category's representative image
|
|
36
|
+
*/
|
|
37
|
+
imageUrl: string;
|
|
38
|
+
/**
|
|
39
|
+
* UI color theme context for displaying the category
|
|
40
|
+
* @default ColorContext.Primary
|
|
41
|
+
*/
|
|
42
|
+
color: ColorContext;
|
|
43
|
+
/**
|
|
44
|
+
* Additional metadata
|
|
45
|
+
*/
|
|
46
|
+
metadata: Metadata[];
|
|
47
|
+
/**
|
|
48
|
+
* Category active status
|
|
49
|
+
* Activating/Deactivating a category will not affect existing customers,
|
|
50
|
+
* but will prevent new customers from selecting the category.
|
|
51
|
+
* Deactivating must set all company categories to enabled=false
|
|
52
|
+
*/
|
|
53
|
+
active: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Sort order for displaying driving categories
|
|
56
|
+
* @default 1
|
|
57
|
+
*/
|
|
58
|
+
sort: number;
|
|
59
|
+
/**
|
|
60
|
+
* Localized content for the driving category (title, description, etc.) across different languages
|
|
61
|
+
*/
|
|
62
|
+
translations: Content[];
|
|
63
|
+
/**
|
|
64
|
+
* ID of the staff member who enabled this driving category
|
|
65
|
+
*/
|
|
66
|
+
enabledBy: number;
|
|
67
|
+
/**
|
|
68
|
+
* Timestamp when the driving category was enabled
|
|
69
|
+
*/
|
|
70
|
+
enabledOn: Date;
|
|
71
|
+
/**
|
|
72
|
+
* ID of the staff member who disabled this driving category
|
|
73
|
+
*/
|
|
74
|
+
disabledBy: number;
|
|
75
|
+
/**
|
|
76
|
+
* Timestamp when the driving category was disabled
|
|
77
|
+
*/
|
|
78
|
+
disabledOn: Date;
|
|
79
|
+
/**
|
|
80
|
+
* Reference to the country this driving category belongs to
|
|
81
|
+
*/
|
|
82
|
+
country: Promise<CountryEntity>;
|
|
83
|
+
/**
|
|
84
|
+
* Company medical product associated with driving category.
|
|
85
|
+
* Example:
|
|
86
|
+
* * Category A: Vision Test, Hearing Test, Reaction Time Test, etc.
|
|
87
|
+
* * Category B: Physical Examination, Cardiovascular Assessment, etc.
|
|
88
|
+
*/
|
|
89
|
+
companyMedicalProducts: Promise<CompanyMedicalProductEntity[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Company course products associated with driving category.
|
|
92
|
+
* Example:
|
|
93
|
+
* * Theory Study training for car driving license is associated with Category B
|
|
94
|
+
* * Practical Riding training for motorcycle license is associated with Category A
|
|
95
|
+
*/
|
|
96
|
+
companyCourses: Promise<CompanyCourseEntity[]>;
|
|
97
|
+
/**
|
|
98
|
+
* Student medical certificates
|
|
99
|
+
*/
|
|
100
|
+
studentCertificates: Promise<StudentMedicalCertificateEntity[]>;
|
|
101
|
+
/**
|
|
102
|
+
* Student licence relation
|
|
103
|
+
*/
|
|
104
|
+
studentLicences: Promise<StudentLicenceEntity[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Category programs
|
|
107
|
+
*/
|
|
108
|
+
programs: Promise<ProgramEntity[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Seed company courses
|
|
111
|
+
*/
|
|
112
|
+
seedCourses: Promise<SeedCourseEntity[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Seed category vehicles
|
|
115
|
+
*/
|
|
116
|
+
seedVehicles: Promise<SeedVehicleEntity[]>;
|
|
117
|
+
/**
|
|
118
|
+
* Creates an instance of DrivingCategoryEntity
|
|
119
|
+
* @param props - Partial properties to initialize the entity
|
|
120
|
+
*/
|
|
121
|
+
constructor(props?: Partial<DrivingCategoryEntity>);
|
|
122
|
+
/**
|
|
123
|
+
* Converts the entity to a DrivingCategory model with localized content
|
|
124
|
+
* @param lang - Language code for localization (defaults to current context language)
|
|
125
|
+
* @returns DrivingCategory model instance
|
|
126
|
+
*/
|
|
127
|
+
toModel(lang?: Language): DrivingCategory;
|
|
128
|
+
toSummary(lang?: Language): DrivingCategory;
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves the translation for a specific language
|
|
131
|
+
* @param lang - Language code (defaults to current context language)
|
|
132
|
+
* @returns Content object with localized strings
|
|
133
|
+
*/
|
|
134
|
+
getTranslation(lang?: Language): Content;
|
|
135
|
+
/**
|
|
136
|
+
* Retrieves all available translations for this category
|
|
137
|
+
* @returns Array of Content objects for all languages
|
|
138
|
+
*/
|
|
139
|
+
getTranslations(): Content[];
|
|
140
|
+
/**
|
|
141
|
+
* Retrieves all activity records for this category
|
|
142
|
+
* Includes creation, updates, enable/disable actions
|
|
143
|
+
* @returns Array of Activity objects
|
|
144
|
+
*/
|
|
145
|
+
getActivities(): Promise<Activity[]>;
|
|
146
|
+
}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DrivingCategoryEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const typeorm_2 = require("typeorm");
|
|
15
|
+
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
16
|
+
const common_1 = require("@driveup/common");
|
|
17
|
+
const common_2 = require("@driveup/common");
|
|
18
|
+
const staff_entity_1 = require("../staff/staff.entity");
|
|
19
|
+
const country_entity_1 = require("../country/country.entity");
|
|
20
|
+
const program_entity_1 = require("../../catalog/program/program.entity");
|
|
21
|
+
const licence_entity_1 = require("../../profile/student/program/licence/licence.entity");
|
|
22
|
+
const certificate_entity_1 = require("../../profile/student/program/medical/certificate.entity");
|
|
23
|
+
const product_entity_1 = require("../../profile/company/medical/product.entity");
|
|
24
|
+
const course_entity_1 = require("../../profile/company/course/course.entity");
|
|
25
|
+
const course_entity_2 = require("../../catalog/seed/courses/course.entity");
|
|
26
|
+
const vehicle_entity_1 = require("./vehicle.entity");
|
|
27
|
+
const utils_1 = require("../../utils");
|
|
28
|
+
/**
|
|
29
|
+
* Represents a driving license category in the system.
|
|
30
|
+
* Categories define the type of vehicle or driving qualification (e.g., A, B, C1, C1E).
|
|
31
|
+
* Each category has specific requirements, age limits, and associated training programs.
|
|
32
|
+
*
|
|
33
|
+
* @extends TrackableEntity<DrivingCategory>
|
|
34
|
+
*/
|
|
35
|
+
let DrivingCategoryEntity = class DrivingCategoryEntity extends utils_1.TrackableEntity {
|
|
36
|
+
/**
|
|
37
|
+
* ID of the country this category belongs to
|
|
38
|
+
*/
|
|
39
|
+
countryId;
|
|
40
|
+
/**
|
|
41
|
+
* Category name abbreviation
|
|
42
|
+
* Short representation of the category
|
|
43
|
+
* (e.g., A, B, C1, C1E etc.)
|
|
44
|
+
*/
|
|
45
|
+
name;
|
|
46
|
+
/**
|
|
47
|
+
* Minimum age requirement for this driving category
|
|
48
|
+
*/
|
|
49
|
+
minAge;
|
|
50
|
+
/**
|
|
51
|
+
* URL to the category's representative image
|
|
52
|
+
*/
|
|
53
|
+
imageUrl;
|
|
54
|
+
/**
|
|
55
|
+
* UI color theme context for displaying the category
|
|
56
|
+
* @default ColorContext.Primary
|
|
57
|
+
*/
|
|
58
|
+
color;
|
|
59
|
+
/**
|
|
60
|
+
* Additional metadata
|
|
61
|
+
*/
|
|
62
|
+
metadata;
|
|
63
|
+
/**
|
|
64
|
+
* Category active status
|
|
65
|
+
* Activating/Deactivating a category will not affect existing customers,
|
|
66
|
+
* but will prevent new customers from selecting the category.
|
|
67
|
+
* Deactivating must set all company categories to enabled=false
|
|
68
|
+
*/
|
|
69
|
+
active;
|
|
70
|
+
/**
|
|
71
|
+
* Sort order for displaying driving categories
|
|
72
|
+
* @default 1
|
|
73
|
+
*/
|
|
74
|
+
sort;
|
|
75
|
+
/**
|
|
76
|
+
* Localized content for the driving category (title, description, etc.) across different languages
|
|
77
|
+
*/
|
|
78
|
+
translations;
|
|
79
|
+
/**
|
|
80
|
+
* ID of the staff member who enabled this driving category
|
|
81
|
+
*/
|
|
82
|
+
enabledBy;
|
|
83
|
+
/**
|
|
84
|
+
* Timestamp when the driving category was enabled
|
|
85
|
+
*/
|
|
86
|
+
enabledOn;
|
|
87
|
+
/**
|
|
88
|
+
* ID of the staff member who disabled this driving category
|
|
89
|
+
*/
|
|
90
|
+
disabledBy;
|
|
91
|
+
/**
|
|
92
|
+
* Timestamp when the driving category was disabled
|
|
93
|
+
*/
|
|
94
|
+
disabledOn;
|
|
95
|
+
/**
|
|
96
|
+
* Reference to the country this driving category belongs to
|
|
97
|
+
*/
|
|
98
|
+
country;
|
|
99
|
+
/**
|
|
100
|
+
* Company medical product associated with driving category.
|
|
101
|
+
* Example:
|
|
102
|
+
* * Category A: Vision Test, Hearing Test, Reaction Time Test, etc.
|
|
103
|
+
* * Category B: Physical Examination, Cardiovascular Assessment, etc.
|
|
104
|
+
*/
|
|
105
|
+
companyMedicalProducts;
|
|
106
|
+
/**
|
|
107
|
+
* Company course products associated with driving category.
|
|
108
|
+
* Example:
|
|
109
|
+
* * Theory Study training for car driving license is associated with Category B
|
|
110
|
+
* * Practical Riding training for motorcycle license is associated with Category A
|
|
111
|
+
*/
|
|
112
|
+
companyCourses;
|
|
113
|
+
/**
|
|
114
|
+
* Student medical certificates
|
|
115
|
+
*/
|
|
116
|
+
studentCertificates;
|
|
117
|
+
/**
|
|
118
|
+
* Student licence relation
|
|
119
|
+
*/
|
|
120
|
+
studentLicences;
|
|
121
|
+
/**
|
|
122
|
+
* Category programs
|
|
123
|
+
*/
|
|
124
|
+
programs;
|
|
125
|
+
/**
|
|
126
|
+
* Seed company courses
|
|
127
|
+
*/
|
|
128
|
+
seedCourses;
|
|
129
|
+
/**
|
|
130
|
+
* Seed category vehicles
|
|
131
|
+
*/
|
|
132
|
+
seedVehicles;
|
|
133
|
+
/**
|
|
134
|
+
* Creates an instance of DrivingCategoryEntity
|
|
135
|
+
* @param props - Partial properties to initialize the entity
|
|
136
|
+
*/
|
|
137
|
+
constructor(props) {
|
|
138
|
+
super();
|
|
139
|
+
Object.assign(this, props);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Converts the entity to a DrivingCategory model with localized content
|
|
143
|
+
* @param lang - Language code for localization (defaults to current context language)
|
|
144
|
+
* @returns DrivingCategory model instance
|
|
145
|
+
*/
|
|
146
|
+
toModel(lang) {
|
|
147
|
+
const translation = this.getTranslation(lang);
|
|
148
|
+
return new common_1.DrivingCategory({
|
|
149
|
+
id: this.id,
|
|
150
|
+
title: translation?.title,
|
|
151
|
+
description: translation?.description,
|
|
152
|
+
imageUrl: translation?.imageUrl || this.imageUrl,
|
|
153
|
+
name: this.name,
|
|
154
|
+
minAge: this.minAge,
|
|
155
|
+
color: this.color,
|
|
156
|
+
active: this.active
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
toSummary(lang) {
|
|
160
|
+
return this.toModel(lang);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Retrieves the translation for a specific language
|
|
164
|
+
* @param lang - Language code (defaults to current context language)
|
|
165
|
+
* @returns Content object with localized strings
|
|
166
|
+
*/
|
|
167
|
+
getTranslation(lang) {
|
|
168
|
+
const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
|
|
169
|
+
const translation = this.translations?.find(t => t.language === language);
|
|
170
|
+
return new common_1.Content({
|
|
171
|
+
title: translation?.title,
|
|
172
|
+
description: translation?.description,
|
|
173
|
+
content: translation?.content,
|
|
174
|
+
imageUrl: translation?.imageUrl || this.imageUrl,
|
|
175
|
+
link: translation?.link,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Retrieves all available translations for this category
|
|
180
|
+
* @returns Array of Content objects for all languages
|
|
181
|
+
*/
|
|
182
|
+
getTranslations() {
|
|
183
|
+
return this.translations?.map(t => new common_1.Content({
|
|
184
|
+
title: t.title,
|
|
185
|
+
description: t.description,
|
|
186
|
+
content: t.content,
|
|
187
|
+
imageUrl: t.imageUrl,
|
|
188
|
+
link: t.link,
|
|
189
|
+
language: t.language
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Retrieves all activity records for this category
|
|
194
|
+
* Includes creation, updates, enable/disable actions
|
|
195
|
+
* @returns Array of Activity objects
|
|
196
|
+
*/
|
|
197
|
+
async getActivities() {
|
|
198
|
+
const activities = [];
|
|
199
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
200
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
|
|
201
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
202
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
|
|
203
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledBy, common_2.ActivityType.enabledBy, staff_entity_1.StaffEntity));
|
|
204
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledOn, common_2.ActivityType.enabledOn));
|
|
205
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledBy, common_2.ActivityType.disabledBy, staff_entity_1.StaffEntity));
|
|
206
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledOn, common_2.ActivityType.disabledOn));
|
|
207
|
+
return activities.filter(a => a);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
exports.DrivingCategoryEntity = DrivingCategoryEntity;
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, typeorm_1.Column)(),
|
|
213
|
+
__metadata("design:type", Number)
|
|
214
|
+
], DrivingCategoryEntity.prototype, "countryId", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
(0, typeorm_1.Column)(),
|
|
217
|
+
__metadata("design:type", String)
|
|
218
|
+
], DrivingCategoryEntity.prototype, "name", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
(0, typeorm_1.Column)({
|
|
221
|
+
nullable: true,
|
|
222
|
+
default: null
|
|
223
|
+
}),
|
|
224
|
+
__metadata("design:type", Number)
|
|
225
|
+
], DrivingCategoryEntity.prototype, "minAge", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
(0, typeorm_1.Column)({
|
|
228
|
+
nullable: true,
|
|
229
|
+
default: null
|
|
230
|
+
}),
|
|
231
|
+
__metadata("design:type", String)
|
|
232
|
+
], DrivingCategoryEntity.prototype, "imageUrl", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
(0, typeorm_1.Column)({
|
|
235
|
+
type: 'enum',
|
|
236
|
+
enum: common_2.ColorContext,
|
|
237
|
+
default: common_2.ColorContext.Primary,
|
|
238
|
+
nullable: false
|
|
239
|
+
}),
|
|
240
|
+
__metadata("design:type", String)
|
|
241
|
+
], DrivingCategoryEntity.prototype, "color", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
(0, typeorm_1.Column)({
|
|
244
|
+
type: 'simple-json',
|
|
245
|
+
nullable: true,
|
|
246
|
+
default: null
|
|
247
|
+
}),
|
|
248
|
+
__metadata("design:type", Array)
|
|
249
|
+
], DrivingCategoryEntity.prototype, "metadata", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
(0, typeorm_1.Column)({
|
|
252
|
+
nullable: false,
|
|
253
|
+
default: false
|
|
254
|
+
}),
|
|
255
|
+
__metadata("design:type", Boolean)
|
|
256
|
+
], DrivingCategoryEntity.prototype, "active", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
(0, typeorm_1.Column)({ default: 1 }),
|
|
259
|
+
__metadata("design:type", Number)
|
|
260
|
+
], DrivingCategoryEntity.prototype, "sort", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
(0, typeorm_1.Column)({
|
|
263
|
+
type: 'simple-json',
|
|
264
|
+
nullable: true,
|
|
265
|
+
default: null
|
|
266
|
+
}),
|
|
267
|
+
__metadata("design:type", Array)
|
|
268
|
+
], DrivingCategoryEntity.prototype, "translations", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
271
|
+
__metadata("design:type", Number)
|
|
272
|
+
], DrivingCategoryEntity.prototype, "enabledBy", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
275
|
+
__metadata("design:type", Date)
|
|
276
|
+
], DrivingCategoryEntity.prototype, "enabledOn", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
279
|
+
__metadata("design:type", Number)
|
|
280
|
+
], DrivingCategoryEntity.prototype, "disabledBy", void 0);
|
|
281
|
+
__decorate([
|
|
282
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
283
|
+
__metadata("design:type", Date)
|
|
284
|
+
], DrivingCategoryEntity.prototype, "disabledOn", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
(0, typeorm_2.ManyToOne)(() => country_entity_1.CountryEntity, country => country.drivingCategories),
|
|
287
|
+
__metadata("design:type", Promise)
|
|
288
|
+
], DrivingCategoryEntity.prototype, "country", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
(0, typeorm_2.OneToMany)(() => product_entity_1.CompanyMedicalProductEntity, company => company.category),
|
|
291
|
+
__metadata("design:type", Promise)
|
|
292
|
+
], DrivingCategoryEntity.prototype, "companyMedicalProducts", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
(0, typeorm_2.OneToMany)(() => course_entity_1.CompanyCourseEntity, training => training.category),
|
|
295
|
+
__metadata("design:type", Promise)
|
|
296
|
+
], DrivingCategoryEntity.prototype, "companyCourses", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
(0, typeorm_2.OneToMany)(() => certificate_entity_1.StudentMedicalCertificateEntity, certificate => certificate.category),
|
|
299
|
+
__metadata("design:type", Promise)
|
|
300
|
+
], DrivingCategoryEntity.prototype, "studentCertificates", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
(0, typeorm_2.OneToMany)(() => licence_entity_1.StudentLicenceEntity, licence => licence.category),
|
|
303
|
+
__metadata("design:type", Promise)
|
|
304
|
+
], DrivingCategoryEntity.prototype, "studentLicences", void 0);
|
|
305
|
+
__decorate([
|
|
306
|
+
(0, typeorm_2.OneToMany)(() => program_entity_1.ProgramEntity, program => program.category),
|
|
307
|
+
__metadata("design:type", Promise)
|
|
308
|
+
], DrivingCategoryEntity.prototype, "programs", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
(0, typeorm_2.OneToMany)(() => course_entity_2.SeedCourseEntity, training => training.category),
|
|
311
|
+
__metadata("design:type", Promise)
|
|
312
|
+
], DrivingCategoryEntity.prototype, "seedCourses", void 0);
|
|
313
|
+
__decorate([
|
|
314
|
+
(0, typeorm_2.OneToMany)(() => vehicle_entity_1.SeedVehicleEntity, vehicle => vehicle.category),
|
|
315
|
+
__metadata("design:type", Promise)
|
|
316
|
+
], DrivingCategoryEntity.prototype, "seedVehicles", void 0);
|
|
317
|
+
exports.DrivingCategoryEntity = DrivingCategoryEntity = __decorate([
|
|
318
|
+
(0, typeorm_1.Entity)('systemDrivingCategories'),
|
|
319
|
+
__metadata("design:paramtypes", [Object])
|
|
320
|
+
], DrivingCategoryEntity);
|
|
321
|
+
//# sourceMappingURL=category.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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yB,CAAC;;GACrB,qBAAqB,CAoPjC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Activity, CarTransmission, Vehicle } from '@driveup/common';
|
|
2
|
+
import { DrivingCategoryEntity } from './category.entity';
|
|
3
|
+
import { TrackableEntity } from '../../utils';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a seed vehicle template in the system.
|
|
6
|
+
* Seed vehicles are predefined vehicle configurations that can be used
|
|
7
|
+
* by companies when setting up their fleet. Each vehicle is associated with
|
|
8
|
+
* a driving category and includes make, model, and transmission type.
|
|
9
|
+
*
|
|
10
|
+
* @extends TrackableEntity<Vehicle>
|
|
11
|
+
*/
|
|
12
|
+
export declare class SeedVehicleEntity extends TrackableEntity<Vehicle> {
|
|
13
|
+
/**
|
|
14
|
+
* Reference to the driving category this vehicle belongs to
|
|
15
|
+
*/
|
|
16
|
+
categoryId: number;
|
|
17
|
+
/**
|
|
18
|
+
* Vehicle make (e.g. Toyota, Ford)
|
|
19
|
+
*/
|
|
20
|
+
make: string;
|
|
21
|
+
/**
|
|
22
|
+
* Vehicle model (e.g. Corolla, Focus)
|
|
23
|
+
*/
|
|
24
|
+
model: string;
|
|
25
|
+
/**
|
|
26
|
+
* Type of transmission (Automatic or Manual)
|
|
27
|
+
* @default CarTransmission.Automatic
|
|
28
|
+
*/
|
|
29
|
+
transmission: CarTransmission.Automatic;
|
|
30
|
+
/**
|
|
31
|
+
* Associated driving category
|
|
32
|
+
*/
|
|
33
|
+
category: Promise<DrivingCategoryEntity>;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new SeedVehicleEntity instance
|
|
36
|
+
* @param props - Partial properties to initialize the entity
|
|
37
|
+
*/
|
|
38
|
+
constructor(props?: Partial<SeedVehicleEntity>);
|
|
39
|
+
/**
|
|
40
|
+
* Converts the entity to a Vehicle model instance
|
|
41
|
+
* @returns Vehicle model with id, make, model, and transmission
|
|
42
|
+
*/
|
|
43
|
+
toModel(): Vehicle;
|
|
44
|
+
/**
|
|
45
|
+
* Converts the entity to a Vehicle model instance
|
|
46
|
+
* @returns Vehicle model with id, make, model, and transmission
|
|
47
|
+
*/
|
|
48
|
+
toSummary(): Vehicle;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves activity history for this vehicle
|
|
51
|
+
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
52
|
+
*/
|
|
53
|
+
getActivities(): Promise<Activity[]>;
|
|
54
|
+
}
|