@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,104 @@
|
|
|
1
|
+
import { Content, Language, Product, CatalogType, ProductType } from '@driveup/common';
|
|
2
|
+
import { Activity, AppointmentType, ColorContext } from '@driveup/common';
|
|
3
|
+
import { ProductCountryEntity } from './country.entity';
|
|
4
|
+
import { TrackableEntity } from '../../utils';
|
|
5
|
+
/**
|
|
6
|
+
* System products entity representing the master catalog of available products.
|
|
7
|
+
* Products can be enabled/disabled per country through the ProductCountryEntity.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ProductEntity extends TrackableEntity<Product> {
|
|
10
|
+
/**
|
|
11
|
+
* Product catalog type categorization.
|
|
12
|
+
* @default CatalogType.Driving
|
|
13
|
+
*/
|
|
14
|
+
catalog: CatalogType;
|
|
15
|
+
/**
|
|
16
|
+
* Specific product type
|
|
17
|
+
* Must be unique across all products.
|
|
18
|
+
* @default ProductType.DrivingCar
|
|
19
|
+
*/
|
|
20
|
+
type: ProductType;
|
|
21
|
+
/**
|
|
22
|
+
* UI color theme context for displaying the product.
|
|
23
|
+
* @default ColorContext.Primary
|
|
24
|
+
*/
|
|
25
|
+
color: ColorContext;
|
|
26
|
+
/**
|
|
27
|
+
* Addon image
|
|
28
|
+
* Can be rewitten to support multiple images with language codes
|
|
29
|
+
*/
|
|
30
|
+
imageUrl: string;
|
|
31
|
+
/**
|
|
32
|
+
* Product localizations
|
|
33
|
+
*/
|
|
34
|
+
translations: Content[];
|
|
35
|
+
/**
|
|
36
|
+
* Product active status
|
|
37
|
+
* Activating/Deactivating a product will not affect existing customers,
|
|
38
|
+
* but will prevent new customers from purchasing the product in the future.
|
|
39
|
+
* Deactivating must set all country products to enabled=false
|
|
40
|
+
*/
|
|
41
|
+
active: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Sort by product relevance
|
|
44
|
+
*/
|
|
45
|
+
sort: number;
|
|
46
|
+
/**
|
|
47
|
+
* User ID who enabled the product
|
|
48
|
+
*/
|
|
49
|
+
enabledBy: number;
|
|
50
|
+
/**
|
|
51
|
+
* Timestamp when the product was enabled
|
|
52
|
+
*/
|
|
53
|
+
enabledOn: Date;
|
|
54
|
+
/**
|
|
55
|
+
* User ID who disabled the product
|
|
56
|
+
*/
|
|
57
|
+
disabledBy: number;
|
|
58
|
+
/**
|
|
59
|
+
* Timestamp when the product was disabled
|
|
60
|
+
*/
|
|
61
|
+
disabledOn: Date;
|
|
62
|
+
/**
|
|
63
|
+
* Country product definitions and enabling
|
|
64
|
+
*/
|
|
65
|
+
countries: Promise<ProductCountryEntity[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new ProductEntity instance
|
|
68
|
+
* @param props - Partial product properties to initialize the entity
|
|
69
|
+
*/
|
|
70
|
+
constructor(props?: Partial<ProductEntity>);
|
|
71
|
+
/**
|
|
72
|
+
* Converts the entity to a Product model instance
|
|
73
|
+
* @param lang - Optional language for translations
|
|
74
|
+
* @returns Product model with localized content
|
|
75
|
+
*/
|
|
76
|
+
toModel(lang?: Language): Product;
|
|
77
|
+
/**
|
|
78
|
+
* Converts the entity to a Product model instance
|
|
79
|
+
* @param lang - Optional language for translations
|
|
80
|
+
* @returns Promise resolving to Product model with localized content
|
|
81
|
+
*/
|
|
82
|
+
toSummary(lang?: Language): Product;
|
|
83
|
+
/**
|
|
84
|
+
* Gets the localized translation for the product
|
|
85
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
86
|
+
* @returns Content instance with translated title and description
|
|
87
|
+
*/
|
|
88
|
+
getTranslation(lang?: Language): Content;
|
|
89
|
+
/**
|
|
90
|
+
* Gets all available translations for the product
|
|
91
|
+
* @returns Array of Content instances for all languages
|
|
92
|
+
*/
|
|
93
|
+
getTranslations(): Content[];
|
|
94
|
+
/**
|
|
95
|
+
* Retrieves activity history for this product
|
|
96
|
+
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
97
|
+
*/
|
|
98
|
+
getActivities(): Promise<Activity[]>;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the appointment type associated with this product based on its catalog
|
|
101
|
+
* @returns AppointmentType corresponding to the product catalog
|
|
102
|
+
*/
|
|
103
|
+
get appointmentType(): AppointmentType;
|
|
104
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
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.ProductEntity = 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 country_entity_1 = require("./country.entity");
|
|
18
|
+
const staff_entity_1 = require("../../system/staff/staff.entity");
|
|
19
|
+
const utils_1 = require("../../utils");
|
|
20
|
+
/**
|
|
21
|
+
* System products entity representing the master catalog of available products.
|
|
22
|
+
* Products can be enabled/disabled per country through the ProductCountryEntity.
|
|
23
|
+
*/
|
|
24
|
+
let ProductEntity = class ProductEntity extends utils_1.TrackableEntity {
|
|
25
|
+
/**
|
|
26
|
+
* Product catalog type categorization.
|
|
27
|
+
* @default CatalogType.Driving
|
|
28
|
+
*/
|
|
29
|
+
catalog;
|
|
30
|
+
/**
|
|
31
|
+
* Specific product type
|
|
32
|
+
* Must be unique across all products.
|
|
33
|
+
* @default ProductType.DrivingCar
|
|
34
|
+
*/
|
|
35
|
+
type;
|
|
36
|
+
/**
|
|
37
|
+
* UI color theme context for displaying the product.
|
|
38
|
+
* @default ColorContext.Primary
|
|
39
|
+
*/
|
|
40
|
+
color;
|
|
41
|
+
/**
|
|
42
|
+
* Addon image
|
|
43
|
+
* Can be rewitten to support multiple images with language codes
|
|
44
|
+
*/
|
|
45
|
+
imageUrl;
|
|
46
|
+
/**
|
|
47
|
+
* Product localizations
|
|
48
|
+
*/
|
|
49
|
+
translations;
|
|
50
|
+
/**
|
|
51
|
+
* Product active status
|
|
52
|
+
* Activating/Deactivating a product will not affect existing customers,
|
|
53
|
+
* but will prevent new customers from purchasing the product in the future.
|
|
54
|
+
* Deactivating must set all country products to enabled=false
|
|
55
|
+
*/
|
|
56
|
+
active;
|
|
57
|
+
/**
|
|
58
|
+
* Sort by product relevance
|
|
59
|
+
*/
|
|
60
|
+
sort;
|
|
61
|
+
/**
|
|
62
|
+
* User ID who enabled the product
|
|
63
|
+
*/
|
|
64
|
+
enabledBy;
|
|
65
|
+
/**
|
|
66
|
+
* Timestamp when the product was enabled
|
|
67
|
+
*/
|
|
68
|
+
enabledOn;
|
|
69
|
+
/**
|
|
70
|
+
* User ID who disabled the product
|
|
71
|
+
*/
|
|
72
|
+
disabledBy;
|
|
73
|
+
/**
|
|
74
|
+
* Timestamp when the product was disabled
|
|
75
|
+
*/
|
|
76
|
+
disabledOn;
|
|
77
|
+
/**
|
|
78
|
+
* Country product definitions and enabling
|
|
79
|
+
*/
|
|
80
|
+
countries;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new ProductEntity instance
|
|
83
|
+
* @param props - Partial product properties to initialize the entity
|
|
84
|
+
*/
|
|
85
|
+
constructor(props) {
|
|
86
|
+
super();
|
|
87
|
+
Object.assign(this, props);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Converts the entity to a Product model instance
|
|
91
|
+
* @param lang - Optional language for translations
|
|
92
|
+
* @returns Product model with localized content
|
|
93
|
+
*/
|
|
94
|
+
toModel(lang) {
|
|
95
|
+
const translation = this.getTranslation(lang);
|
|
96
|
+
return new common_1.Product({
|
|
97
|
+
id: this.id,
|
|
98
|
+
catalog: this.catalog,
|
|
99
|
+
type: this.type,
|
|
100
|
+
color: this.color,
|
|
101
|
+
title: translation.title,
|
|
102
|
+
description: translation.description,
|
|
103
|
+
imageUrl: translation.imageUrl || this.imageUrl,
|
|
104
|
+
enabled: this.active,
|
|
105
|
+
sort: this.sort
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Converts the entity to a Product model instance
|
|
110
|
+
* @param lang - Optional language for translations
|
|
111
|
+
* @returns Promise resolving to Product model with localized content
|
|
112
|
+
*/
|
|
113
|
+
toSummary(lang) {
|
|
114
|
+
return this.toModel(lang);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Gets the localized translation for the product
|
|
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 || this.imageUrl,
|
|
129
|
+
link: translation?.link,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Gets all available translations for the product
|
|
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 product
|
|
148
|
+
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
149
|
+
*/
|
|
150
|
+
async getActivities() {
|
|
151
|
+
const activities = [];
|
|
152
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
153
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
|
|
154
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
155
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
|
|
156
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledBy, common_2.ActivityType.enabledBy, staff_entity_1.StaffEntity));
|
|
157
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledOn, common_2.ActivityType.enabledOn));
|
|
158
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledBy, common_2.ActivityType.disabledBy, staff_entity_1.StaffEntity));
|
|
159
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledOn, common_2.ActivityType.disabledOn));
|
|
160
|
+
return activities.filter(a => a);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Gets the appointment type associated with this product based on its catalog
|
|
164
|
+
* @returns AppointmentType corresponding to the product catalog
|
|
165
|
+
*/
|
|
166
|
+
get appointmentType() {
|
|
167
|
+
switch (this.catalog) {
|
|
168
|
+
case common_1.CatalogType.Medical:
|
|
169
|
+
// currently only examination products exist in medical catalog
|
|
170
|
+
return common_2.AppointmentType.Medical;
|
|
171
|
+
case common_1.CatalogType.Preperation:
|
|
172
|
+
return common_2.AppointmentType.Course;
|
|
173
|
+
case common_1.CatalogType.Driving:
|
|
174
|
+
return common_2.AppointmentType.Driving;
|
|
175
|
+
case common_1.CatalogType.Completion:
|
|
176
|
+
return common_2.AppointmentType.Course;
|
|
177
|
+
default:
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
exports.ProductEntity = ProductEntity;
|
|
183
|
+
__decorate([
|
|
184
|
+
(0, typeorm_1.Column)({
|
|
185
|
+
type: 'enum',
|
|
186
|
+
enum: common_1.CatalogType,
|
|
187
|
+
default: common_1.CatalogType.Driving,
|
|
188
|
+
nullable: false
|
|
189
|
+
}),
|
|
190
|
+
__metadata("design:type", String)
|
|
191
|
+
], ProductEntity.prototype, "catalog", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, typeorm_1.Column)({
|
|
194
|
+
type: 'enum',
|
|
195
|
+
name: 'productType',
|
|
196
|
+
unique: true,
|
|
197
|
+
enum: common_1.ProductType,
|
|
198
|
+
default: common_1.ProductType.DrivingCar,
|
|
199
|
+
nullable: false
|
|
200
|
+
}),
|
|
201
|
+
__metadata("design:type", String)
|
|
202
|
+
], ProductEntity.prototype, "type", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, typeorm_1.Column)({
|
|
205
|
+
type: 'enum',
|
|
206
|
+
enum: common_2.ColorContext,
|
|
207
|
+
default: common_2.ColorContext.Primary,
|
|
208
|
+
nullable: false
|
|
209
|
+
}),
|
|
210
|
+
__metadata("design:type", String)
|
|
211
|
+
], ProductEntity.prototype, "color", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
(0, typeorm_1.Column)({
|
|
214
|
+
nullable: true,
|
|
215
|
+
default: null
|
|
216
|
+
}),
|
|
217
|
+
__metadata("design:type", String)
|
|
218
|
+
], ProductEntity.prototype, "imageUrl", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
(0, typeorm_1.Column)({
|
|
221
|
+
type: 'simple-json',
|
|
222
|
+
nullable: true,
|
|
223
|
+
default: null
|
|
224
|
+
}),
|
|
225
|
+
__metadata("design:type", Array)
|
|
226
|
+
], ProductEntity.prototype, "translations", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
(0, typeorm_1.Column)({ default: true }),
|
|
229
|
+
__metadata("design:type", Boolean)
|
|
230
|
+
], ProductEntity.prototype, "active", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
(0, typeorm_1.Column)({
|
|
233
|
+
nullable: false,
|
|
234
|
+
default: 1
|
|
235
|
+
}),
|
|
236
|
+
__metadata("design:type", Number)
|
|
237
|
+
], ProductEntity.prototype, "sort", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
240
|
+
__metadata("design:type", Number)
|
|
241
|
+
], ProductEntity.prototype, "enabledBy", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
244
|
+
__metadata("design:type", Date)
|
|
245
|
+
], ProductEntity.prototype, "enabledOn", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
248
|
+
__metadata("design:type", Number)
|
|
249
|
+
], ProductEntity.prototype, "disabledBy", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
252
|
+
__metadata("design:type", Date)
|
|
253
|
+
], ProductEntity.prototype, "disabledOn", void 0);
|
|
254
|
+
__decorate([
|
|
255
|
+
(0, typeorm_1.OneToMany)(() => country_entity_1.ProductCountryEntity, country => country.product),
|
|
256
|
+
__metadata("design:type", Promise)
|
|
257
|
+
], ProductEntity.prototype, "countries", void 0);
|
|
258
|
+
exports.ProductEntity = ProductEntity = __decorate([
|
|
259
|
+
(0, typeorm_1.Entity)('systemProducts'),
|
|
260
|
+
__metadata("design:paramtypes", [Object])
|
|
261
|
+
], ProductEntity);
|
|
262
|
+
//# sourceMappingURL=product.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.entity.js","sourceRoot":"","sources":["../../../src/catalog/product/product.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,6CAA0C;AAC1C,4CAAuF;AACvF,4CAAwF;AACxF,qDAAwD;AACxD,kEAA8D;AAC9D,uCAA0D;AAE1D;;;GAGG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,uBAAwB;IAE1D;;;OAGG;IAOH,OAAO,CAAc;IAErB;;;;OAIG;IASH,IAAI,CAAc;IAElB;;;OAGG;IAOH,KAAK,CAAe;IAEpB;;;OAGG;IAKH,Q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AAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;gDACvB;wBA3G/B,aAAa;IADzB,IAAA,gBAAM,EAAC,gBAAgB,CAAC;;GACZ,aAAa,CAuNzB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Language, ProductType, Program, ProgramType } from '@driveup/common';
|
|
2
|
+
import { Activity, Content } from '@driveup/common';
|
|
3
|
+
import { StudentProgramEntity } from '../../profile/student/program/program.entity';
|
|
4
|
+
import { DrivingCategoryEntity } from '../../system/driving/category.entity';
|
|
5
|
+
import { TrackableEntity } from '../../utils';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a training program in the system.
|
|
8
|
+
* Programs define structured learning paths associated with driving categories.
|
|
9
|
+
* Each program can be linked to multiple products and contains localized content.
|
|
10
|
+
* Programs can be activated/deactivated to control availability for new customers.
|
|
11
|
+
*
|
|
12
|
+
* @extends TrackableEntity<Program>
|
|
13
|
+
*/
|
|
14
|
+
export declare class ProgramEntity extends TrackableEntity<Program> {
|
|
15
|
+
/**
|
|
16
|
+
* Type of program (e.g., Driving, FirstAid)
|
|
17
|
+
* Must be unique across all programs
|
|
18
|
+
* @default ProgramType.Driving
|
|
19
|
+
*/
|
|
20
|
+
type: ProgramType;
|
|
21
|
+
/**
|
|
22
|
+
* List of product types this program applies to
|
|
23
|
+
* @default [ProductType.DrivingCar]
|
|
24
|
+
*/
|
|
25
|
+
products: ProductType[];
|
|
26
|
+
/**
|
|
27
|
+
* Country driving category id
|
|
28
|
+
*/
|
|
29
|
+
categoryId: number;
|
|
30
|
+
/**
|
|
31
|
+
* URL to the program's representative image
|
|
32
|
+
*/
|
|
33
|
+
imageUrl: string;
|
|
34
|
+
/**
|
|
35
|
+
* Program localization
|
|
36
|
+
*/
|
|
37
|
+
translations: Content[];
|
|
38
|
+
/**
|
|
39
|
+
* Product active status
|
|
40
|
+
* Activating/Deactivating a product will not affect existing customers,
|
|
41
|
+
* but will prevent new customers from purchasing the variant.
|
|
42
|
+
* Deactivating must set all country variants to enabled=false
|
|
43
|
+
*/
|
|
44
|
+
active: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Sort order for displaying programs
|
|
47
|
+
* @default 1
|
|
48
|
+
*/
|
|
49
|
+
sort: number;
|
|
50
|
+
/**
|
|
51
|
+
* ID of the staff member who enabled this program
|
|
52
|
+
*/
|
|
53
|
+
enabledBy: number;
|
|
54
|
+
/**
|
|
55
|
+
* Date when the program was enabled
|
|
56
|
+
*/
|
|
57
|
+
enabledOn: Date;
|
|
58
|
+
/**
|
|
59
|
+
* ID of the staff member who disabled this program
|
|
60
|
+
*/
|
|
61
|
+
disabledBy: number;
|
|
62
|
+
/**
|
|
63
|
+
* Date when the program was disabled
|
|
64
|
+
*/
|
|
65
|
+
disabledOn: Date;
|
|
66
|
+
/**
|
|
67
|
+
* Program category
|
|
68
|
+
*/
|
|
69
|
+
category: Promise<DrivingCategoryEntity>;
|
|
70
|
+
/**
|
|
71
|
+
* Binded student programs
|
|
72
|
+
*/
|
|
73
|
+
studentPrograms: Promise<StudentProgramEntity[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a new ProgramEntity instance
|
|
76
|
+
* @param props - Partial properties to initialize the entity
|
|
77
|
+
*/
|
|
78
|
+
constructor(props?: Partial<ProgramEntity>);
|
|
79
|
+
/**
|
|
80
|
+
* Converts the entity to a Program model instance
|
|
81
|
+
* @param lang - Optional language for translations
|
|
82
|
+
* @returns Promise resolving to Program model with localized content
|
|
83
|
+
*/
|
|
84
|
+
toModel(lang?: Language): Promise<Program>;
|
|
85
|
+
/**
|
|
86
|
+
* Converts the entity to a Program model instance
|
|
87
|
+
* @param lang - Optional language for translations
|
|
88
|
+
* @returns Promise resolving to Program model with localized content
|
|
89
|
+
*/
|
|
90
|
+
toSummary(lang?: Language): Promise<Program>;
|
|
91
|
+
/**
|
|
92
|
+
* Gets the localized translation for the program
|
|
93
|
+
* @param lang - Optional language code; defaults to current i18n context
|
|
94
|
+
* @returns Content instance with translated title and description
|
|
95
|
+
*/
|
|
96
|
+
getTranslation(lang?: Language): Content;
|
|
97
|
+
/**
|
|
98
|
+
* Gets all available translations for the program
|
|
99
|
+
* @returns Array of Content instances for all languages
|
|
100
|
+
*/
|
|
101
|
+
getTranslations(): Content[];
|
|
102
|
+
/**
|
|
103
|
+
* Retrieves activity history for this program
|
|
104
|
+
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
105
|
+
*/
|
|
106
|
+
getActivities(): Promise<Activity[]>;
|
|
107
|
+
}
|