@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,233 @@
|
|
|
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.ProductCountryEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const typeorm_2 = require("typeorm");
|
|
15
|
+
const common_1 = require("@driveup/common");
|
|
16
|
+
const common_2 = require("@driveup/common");
|
|
17
|
+
const country_entity_1 = require("../../system/country/country.entity");
|
|
18
|
+
const staff_entity_1 = require("../../system/staff/staff.entity");
|
|
19
|
+
const priceplan_entity_1 = require("./priceplan.entity");
|
|
20
|
+
const product_entity_1 = require("./product.entity");
|
|
21
|
+
const product_entity_2 = require("../../profile/company/product/product.entity");
|
|
22
|
+
const course_entity_1 = require("../seed/courses/course.entity");
|
|
23
|
+
const utils_1 = require("../../utils");
|
|
24
|
+
/**
|
|
25
|
+
* Represents a product configuration for a specific country.
|
|
26
|
+
* This entity manages country-specific settings for products including
|
|
27
|
+
* VAT rates, availability, and metadata that companies will inherit.
|
|
28
|
+
* Each product can have different configurations per country.
|
|
29
|
+
*
|
|
30
|
+
* @extends TrackableEntity<Product>
|
|
31
|
+
*/
|
|
32
|
+
let ProductCountryEntity = class ProductCountryEntity extends utils_1.TrackableEntity {
|
|
33
|
+
/**
|
|
34
|
+
* Driveup product reference
|
|
35
|
+
* Each country product is linked to a specific product
|
|
36
|
+
*/
|
|
37
|
+
productId;
|
|
38
|
+
/**
|
|
39
|
+
* Country reference
|
|
40
|
+
*/
|
|
41
|
+
countryId;
|
|
42
|
+
/**
|
|
43
|
+
* Country dependent product vat
|
|
44
|
+
*/
|
|
45
|
+
vat;
|
|
46
|
+
/**
|
|
47
|
+
* Country product active status
|
|
48
|
+
* Activating/Deactivating a product will not affect existing customers,
|
|
49
|
+
* but will prevent new customers from purchasing the variant.
|
|
50
|
+
* Deactivating must set all country products to enabled=false
|
|
51
|
+
*/
|
|
52
|
+
active;
|
|
53
|
+
/**
|
|
54
|
+
* Sort by country relevance
|
|
55
|
+
*/
|
|
56
|
+
sort;
|
|
57
|
+
/**
|
|
58
|
+
* Additional product metadata to seed company product
|
|
59
|
+
*/
|
|
60
|
+
metadata;
|
|
61
|
+
/**
|
|
62
|
+
* ID of the staff member who enabled this product in the country
|
|
63
|
+
*/
|
|
64
|
+
enabledBy;
|
|
65
|
+
/**
|
|
66
|
+
* Date when the product was enabled in the country
|
|
67
|
+
*/
|
|
68
|
+
enabledOn;
|
|
69
|
+
/**
|
|
70
|
+
* ID of the staff member who disabled this product in the country
|
|
71
|
+
*/
|
|
72
|
+
disabledBy;
|
|
73
|
+
/**
|
|
74
|
+
* Date when the product was disabled in the country
|
|
75
|
+
*/
|
|
76
|
+
disabledOn;
|
|
77
|
+
/**
|
|
78
|
+
* Reference to the system product
|
|
79
|
+
*/
|
|
80
|
+
product;
|
|
81
|
+
/**
|
|
82
|
+
* Reference to the country
|
|
83
|
+
*/
|
|
84
|
+
country;
|
|
85
|
+
/**
|
|
86
|
+
* Available price plans for country product
|
|
87
|
+
*/
|
|
88
|
+
pricePlans;
|
|
89
|
+
/**
|
|
90
|
+
* Company products relation
|
|
91
|
+
*/
|
|
92
|
+
companies;
|
|
93
|
+
/**
|
|
94
|
+
* Seed courses associated with this country product
|
|
95
|
+
*/
|
|
96
|
+
seedCourses;
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new ProductCountryEntity instance
|
|
99
|
+
* @param props - Partial properties to initialize the entity
|
|
100
|
+
*/
|
|
101
|
+
constructor(props) {
|
|
102
|
+
super();
|
|
103
|
+
Object.assign(this, props);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Converts the entity to a Product model instance
|
|
107
|
+
* @param lang - Optional language for translations
|
|
108
|
+
* @returns Promise resolving to Product model with localized content
|
|
109
|
+
*/
|
|
110
|
+
async toModel(lang) {
|
|
111
|
+
const entity = await this.product;
|
|
112
|
+
const product = entity.toModel(lang);
|
|
113
|
+
product.id = this.id;
|
|
114
|
+
product.status = common_1.ProductStatus.Inactive;
|
|
115
|
+
product.vat = this.vat;
|
|
116
|
+
product.sort = this.sort;
|
|
117
|
+
product.metadata = this.getMetadata();
|
|
118
|
+
return product;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Converts the entity to a Product model instance
|
|
122
|
+
* @param lang - Optional language for translations
|
|
123
|
+
* @returns Promise resolving to Product model with localized content
|
|
124
|
+
*/
|
|
125
|
+
async toSummary(lang) {
|
|
126
|
+
return await this.toModel(lang);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Gets the metadata as Metadata instances
|
|
130
|
+
* @returns Array of Metadata instances
|
|
131
|
+
*/
|
|
132
|
+
getMetadata() {
|
|
133
|
+
return this.metadata?.map(m => common_2.Metadata.toInstance(m));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Retrieves activity history for this country product
|
|
137
|
+
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
138
|
+
*/
|
|
139
|
+
async getActivities() {
|
|
140
|
+
const activities = [];
|
|
141
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
142
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
|
|
143
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
144
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
|
|
145
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledBy, common_2.ActivityType.enabledBy, staff_entity_1.StaffEntity));
|
|
146
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledOn, common_2.ActivityType.createdOn));
|
|
147
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledBy, common_2.ActivityType.disabledBy, staff_entity_1.StaffEntity));
|
|
148
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledOn, common_2.ActivityType.disabledOn));
|
|
149
|
+
return activities.filter(a => a);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
exports.ProductCountryEntity = ProductCountryEntity;
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, typeorm_1.Column)(),
|
|
155
|
+
__metadata("design:type", Number)
|
|
156
|
+
], ProductCountryEntity.prototype, "productId", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, typeorm_1.Column)(),
|
|
159
|
+
__metadata("design:type", Number)
|
|
160
|
+
], ProductCountryEntity.prototype, "countryId", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, typeorm_1.Column)({
|
|
163
|
+
type: 'decimal',
|
|
164
|
+
precision: 8,
|
|
165
|
+
scale: 2,
|
|
166
|
+
nullable: true,
|
|
167
|
+
default: null
|
|
168
|
+
}),
|
|
169
|
+
__metadata("design:type", Number)
|
|
170
|
+
], ProductCountryEntity.prototype, "vat", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, typeorm_1.Column)({
|
|
173
|
+
nullable: false,
|
|
174
|
+
default: false
|
|
175
|
+
}),
|
|
176
|
+
__metadata("design:type", Boolean)
|
|
177
|
+
], ProductCountryEntity.prototype, "active", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, typeorm_1.Column)({
|
|
180
|
+
nullable: false,
|
|
181
|
+
default: 1
|
|
182
|
+
}),
|
|
183
|
+
__metadata("design:type", Number)
|
|
184
|
+
], ProductCountryEntity.prototype, "sort", void 0);
|
|
185
|
+
__decorate([
|
|
186
|
+
(0, typeorm_1.Column)({
|
|
187
|
+
type: 'simple-json',
|
|
188
|
+
nullable: true,
|
|
189
|
+
default: null
|
|
190
|
+
}),
|
|
191
|
+
__metadata("design:type", Array)
|
|
192
|
+
], ProductCountryEntity.prototype, "metadata", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
195
|
+
__metadata("design:type", Number)
|
|
196
|
+
], ProductCountryEntity.prototype, "enabledBy", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
199
|
+
__metadata("design:type", Date)
|
|
200
|
+
], ProductCountryEntity.prototype, "enabledOn", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
203
|
+
__metadata("design:type", Number)
|
|
204
|
+
], ProductCountryEntity.prototype, "disabledBy", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
207
|
+
__metadata("design:type", Date)
|
|
208
|
+
], ProductCountryEntity.prototype, "disabledOn", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
(0, typeorm_2.ManyToOne)(() => product_entity_1.ProductEntity, product => product.countries),
|
|
211
|
+
__metadata("design:type", Promise)
|
|
212
|
+
], ProductCountryEntity.prototype, "product", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
(0, typeorm_2.ManyToOne)(() => country_entity_1.CountryEntity, country => country.products),
|
|
215
|
+
__metadata("design:type", Promise)
|
|
216
|
+
], ProductCountryEntity.prototype, "country", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
(0, typeorm_1.OneToMany)(() => priceplan_entity_1.ProductPricePlanEntity, plan => plan.product),
|
|
219
|
+
__metadata("design:type", Promise)
|
|
220
|
+
], ProductCountryEntity.prototype, "pricePlans", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
(0, typeorm_1.OneToMany)(() => product_entity_2.CompanyProductEntity, product => product.product),
|
|
223
|
+
__metadata("design:type", Promise)
|
|
224
|
+
], ProductCountryEntity.prototype, "companies", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
(0, typeorm_1.OneToMany)(() => course_entity_1.SeedCourseEntity, course => course.product),
|
|
227
|
+
__metadata("design:type", Promise)
|
|
228
|
+
], ProductCountryEntity.prototype, "seedCourses", void 0);
|
|
229
|
+
exports.ProductCountryEntity = ProductCountryEntity = __decorate([
|
|
230
|
+
(0, typeorm_1.Entity)('systemProductCountries'),
|
|
231
|
+
__metadata("design:paramtypes", [Object])
|
|
232
|
+
], ProductCountryEntity);
|
|
233
|
+
//# sourceMappingURL=country.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.entity.js","sourceRoot":"","sources":["../../../src/catalog/product/country.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,qCAAoC;AACpC,4CAAmE;AACnE,4CAAmE;AACnE,wEAAoE;AACpE,kEAA8D;AAC9D,yDAA4D;AAC5D,qDAAiD;AACjD,iFAAoF;AACpF,iEAAiE;AACjE,uCAA0D;AAE1D;;;;;;;GAOG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,uBAAwB;IAEjE;;;OAGG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAQH,GAAG,CAAS;IAEZ;;;;;OAKG;IAKH,MAAM,CAAU;IAEhB;;OAEG;IAKH,IAAI,CAAS;IAEb;;OAEG;IAMH,QAAQ,CAAa;IAErB;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,SAAS,CAAO;IAEhB;;OAEG;IAEH,UAAU,CAAS;IAEnB;;OAEG;IAEH,UAAU,CAAO;IAEjB;;OAEG;IAEH,OAAO,CAAyB;IAEhC;;OAEG;IAEH,OAAO,CAAyB;IAEhC;;OAEG;IAEH,UAAU,CAAoC;IAE9C;;OAEG;IAEH,SAAS,CAAkC;IAE3C;;OAEG;IAEH,WAAW,CAA8B;IAEzC;;;OAGG;IACH,YAAY,KAAqC;QAChD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,C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adata, Activity, PricePlan } from '@driveup/common';
|
|
2
|
+
import { PricePlanEntity } from '../priceplan/priceplan.entity';
|
|
3
|
+
import { ProductCountryEntity } from './country.entity';
|
|
4
|
+
import { CompanyProductPricePlanEntity } from '../../profile/company/product/priceplan.entity';
|
|
5
|
+
import { TrackableEntity } from '../../utils';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a price plan configuration for a specific country product.
|
|
8
|
+
* This entity links price plans to country products with country-specific
|
|
9
|
+
* pricing, starting credit, free benefits, and featured status.
|
|
10
|
+
* Companies inherit these configurations when setting up their products.
|
|
11
|
+
*
|
|
12
|
+
* @extends TrackableEntity<PricePlan>
|
|
13
|
+
*/
|
|
14
|
+
export declare class ProductPricePlanEntity extends TrackableEntity<PricePlan> {
|
|
15
|
+
/**
|
|
16
|
+
* Driveup price plan
|
|
17
|
+
* Each country product price plan is linked to a specific driveup price plan
|
|
18
|
+
*/
|
|
19
|
+
pricePlanId: number;
|
|
20
|
+
/**
|
|
21
|
+
* Country product
|
|
22
|
+
* Each price plan is linked to a specific country product
|
|
23
|
+
*/
|
|
24
|
+
productId: number;
|
|
25
|
+
/**
|
|
26
|
+
* Country based product price
|
|
27
|
+
*/
|
|
28
|
+
price: number;
|
|
29
|
+
/**
|
|
30
|
+
* Country based product start credit
|
|
31
|
+
*/
|
|
32
|
+
startCredit: number;
|
|
33
|
+
/**
|
|
34
|
+
* Number of free benefits included with this price plan
|
|
35
|
+
*/
|
|
36
|
+
freeBenefits: number;
|
|
37
|
+
/**
|
|
38
|
+
* Featured badge or label for marketing purposes
|
|
39
|
+
*/
|
|
40
|
+
featured: string;
|
|
41
|
+
/**
|
|
42
|
+
* Country product active status
|
|
43
|
+
* Activating/Deactivating a product will not affect existing customers,
|
|
44
|
+
* but will prevent new customers from purchasing the variant.
|
|
45
|
+
* Deactivating must set all country price plans to enabled=false
|
|
46
|
+
*/
|
|
47
|
+
active: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Price plan localizations
|
|
50
|
+
*/
|
|
51
|
+
metadata: Metadata[];
|
|
52
|
+
/**
|
|
53
|
+
* ID of the staff member who enabled this price plan for the product
|
|
54
|
+
*/
|
|
55
|
+
enabledBy: number;
|
|
56
|
+
/**
|
|
57
|
+
* Date when the price plan was enabled for the product
|
|
58
|
+
*/
|
|
59
|
+
enabledOn: Date;
|
|
60
|
+
/**
|
|
61
|
+
* ID of the staff member who disabled this price plan for the product
|
|
62
|
+
*/
|
|
63
|
+
disabledBy: number;
|
|
64
|
+
/**
|
|
65
|
+
* Date when the price plan was disabled for the product
|
|
66
|
+
*/
|
|
67
|
+
disabledOn: Date;
|
|
68
|
+
/**
|
|
69
|
+
* Driveup price plan relation
|
|
70
|
+
*/
|
|
71
|
+
pricePlan: Promise<PricePlanEntity>;
|
|
72
|
+
/**
|
|
73
|
+
* Country product relation
|
|
74
|
+
*/
|
|
75
|
+
product: Promise<ProductCountryEntity>;
|
|
76
|
+
/**
|
|
77
|
+
* Company medical price plan relation
|
|
78
|
+
*/
|
|
79
|
+
companies: Promise<CompanyProductPricePlanEntity[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new ProductPricePlanEntity instance
|
|
82
|
+
* @param props - Partial properties to initialize the entity
|
|
83
|
+
*/
|
|
84
|
+
constructor(props?: Partial<ProductPricePlanEntity>);
|
|
85
|
+
/**
|
|
86
|
+
* Converts the entity to a PricePlan model instance
|
|
87
|
+
* @param lang - Optional language for translations
|
|
88
|
+
* @returns Promise resolving to PricePlan model with pricing details
|
|
89
|
+
*/
|
|
90
|
+
toModel(lang?: Language): Promise<PricePlan>;
|
|
91
|
+
/**
|
|
92
|
+
* Converts the entity to a Product model instance
|
|
93
|
+
* @param lang - Optional language for translations
|
|
94
|
+
* @returns Promise resolving to Product model with localized content
|
|
95
|
+
*/
|
|
96
|
+
toSummary(lang?: Language): Promise<PricePlan>;
|
|
97
|
+
/**
|
|
98
|
+
* Retrieves the associated product for this price plan
|
|
99
|
+
* @param lang - Optional language for translations
|
|
100
|
+
* @returns Promise resolving to the Product model
|
|
101
|
+
*/
|
|
102
|
+
toProduct(lang?: Language): Promise<import("@driveup/common").Product>;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the metadata as Metadata instances
|
|
105
|
+
* @returns Array of Metadata instances
|
|
106
|
+
*/
|
|
107
|
+
getMetadata(): Metadata<any>[];
|
|
108
|
+
/**
|
|
109
|
+
* Retrieves activity history for this price plan
|
|
110
|
+
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
111
|
+
*/
|
|
112
|
+
getActivities(): Promise<Activity[]>;
|
|
113
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
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.ProductPricePlanEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const typeorm_2 = require("typeorm");
|
|
15
|
+
const common_1 = require("@driveup/common");
|
|
16
|
+
const staff_entity_1 = require("../../system/staff/staff.entity");
|
|
17
|
+
const priceplan_entity_1 = require("../priceplan/priceplan.entity");
|
|
18
|
+
const country_entity_1 = require("./country.entity");
|
|
19
|
+
const priceplan_entity_2 = require("../../profile/company/product/priceplan.entity");
|
|
20
|
+
const utils_1 = require("../../utils");
|
|
21
|
+
/**
|
|
22
|
+
* Represents a price plan configuration for a specific country product.
|
|
23
|
+
* This entity links price plans to country products with country-specific
|
|
24
|
+
* pricing, starting credit, free benefits, and featured status.
|
|
25
|
+
* Companies inherit these configurations when setting up their products.
|
|
26
|
+
*
|
|
27
|
+
* @extends TrackableEntity<PricePlan>
|
|
28
|
+
*/
|
|
29
|
+
let ProductPricePlanEntity = class ProductPricePlanEntity extends utils_1.TrackableEntity {
|
|
30
|
+
/**
|
|
31
|
+
* Driveup price plan
|
|
32
|
+
* Each country product price plan is linked to a specific driveup price plan
|
|
33
|
+
*/
|
|
34
|
+
pricePlanId;
|
|
35
|
+
/**
|
|
36
|
+
* Country product
|
|
37
|
+
* Each price plan is linked to a specific country product
|
|
38
|
+
*/
|
|
39
|
+
productId;
|
|
40
|
+
/**
|
|
41
|
+
* Country based product price
|
|
42
|
+
*/
|
|
43
|
+
price;
|
|
44
|
+
/**
|
|
45
|
+
* Country based product start credit
|
|
46
|
+
*/
|
|
47
|
+
startCredit;
|
|
48
|
+
/**
|
|
49
|
+
* Number of free benefits included with this price plan
|
|
50
|
+
*/
|
|
51
|
+
freeBenefits;
|
|
52
|
+
/**
|
|
53
|
+
* Featured badge or label for marketing purposes
|
|
54
|
+
*/
|
|
55
|
+
featured;
|
|
56
|
+
/**
|
|
57
|
+
* Country product active status
|
|
58
|
+
* Activating/Deactivating a product will not affect existing customers,
|
|
59
|
+
* but will prevent new customers from purchasing the variant.
|
|
60
|
+
* Deactivating must set all country price plans to enabled=false
|
|
61
|
+
*/
|
|
62
|
+
active;
|
|
63
|
+
/**
|
|
64
|
+
* Price plan localizations
|
|
65
|
+
*/
|
|
66
|
+
metadata;
|
|
67
|
+
/**
|
|
68
|
+
* ID of the staff member who enabled this price plan for the product
|
|
69
|
+
*/
|
|
70
|
+
enabledBy;
|
|
71
|
+
/**
|
|
72
|
+
* Date when the price plan was enabled for the product
|
|
73
|
+
*/
|
|
74
|
+
enabledOn;
|
|
75
|
+
/**
|
|
76
|
+
* ID of the staff member who disabled this price plan for the product
|
|
77
|
+
*/
|
|
78
|
+
disabledBy;
|
|
79
|
+
/**
|
|
80
|
+
* Date when the price plan was disabled for the product
|
|
81
|
+
*/
|
|
82
|
+
disabledOn;
|
|
83
|
+
/**
|
|
84
|
+
* Driveup price plan relation
|
|
85
|
+
*/
|
|
86
|
+
pricePlan;
|
|
87
|
+
/**
|
|
88
|
+
* Country product relation
|
|
89
|
+
*/
|
|
90
|
+
product;
|
|
91
|
+
/**
|
|
92
|
+
* Company medical price plan relation
|
|
93
|
+
*/
|
|
94
|
+
companies;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new ProductPricePlanEntity instance
|
|
97
|
+
* @param props - Partial properties to initialize the entity
|
|
98
|
+
*/
|
|
99
|
+
constructor(props) {
|
|
100
|
+
super();
|
|
101
|
+
Object.assign(this, props);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Converts the entity to a PricePlan model instance
|
|
105
|
+
* @param lang - Optional language for translations
|
|
106
|
+
* @returns Promise resolving to PricePlan model with pricing details
|
|
107
|
+
*/
|
|
108
|
+
async toModel(lang) {
|
|
109
|
+
const entity = await this.pricePlan;
|
|
110
|
+
const priceplan = entity.toModel(lang);
|
|
111
|
+
priceplan.id = this.id;
|
|
112
|
+
priceplan.price = this.price;
|
|
113
|
+
priceplan.startCredit = this.startCredit;
|
|
114
|
+
priceplan.freeBenefits = this.freeBenefits;
|
|
115
|
+
priceplan.featured = this.featured;
|
|
116
|
+
priceplan.active = this.active;
|
|
117
|
+
priceplan.metadata = this.getMetadata();
|
|
118
|
+
return priceplan;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Converts the entity to a Product model instance
|
|
122
|
+
* @param lang - Optional language for translations
|
|
123
|
+
* @returns Promise resolving to Product model with localized content
|
|
124
|
+
*/
|
|
125
|
+
async toSummary(lang) {
|
|
126
|
+
return await this.toModel(lang);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Retrieves the associated product for this price plan
|
|
130
|
+
* @param lang - Optional language for translations
|
|
131
|
+
* @returns Promise resolving to the Product model
|
|
132
|
+
*/
|
|
133
|
+
async toProduct(lang) {
|
|
134
|
+
const product = await this.product;
|
|
135
|
+
return product.toModel(lang);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Gets the metadata as Metadata instances
|
|
139
|
+
* @returns Array of Metadata instances
|
|
140
|
+
*/
|
|
141
|
+
getMetadata() {
|
|
142
|
+
return this.metadata?.map(m => common_1.Metadata.toInstance(m));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Retrieves activity history for this price plan
|
|
146
|
+
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
147
|
+
*/
|
|
148
|
+
async getActivities() {
|
|
149
|
+
const activities = [];
|
|
150
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
151
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
152
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
153
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
154
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledBy, common_1.ActivityType.enabledBy, staff_entity_1.StaffEntity));
|
|
155
|
+
activities.push(await (0, utils_1.toActivity)(this.enabledOn, common_1.ActivityType.createdOn));
|
|
156
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledBy, common_1.ActivityType.disabledBy, staff_entity_1.StaffEntity));
|
|
157
|
+
activities.push(await (0, utils_1.toActivity)(this.disabledOn, common_1.ActivityType.disabledOn));
|
|
158
|
+
return activities.filter(a => a);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
exports.ProductPricePlanEntity = ProductPricePlanEntity;
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.Column)(),
|
|
164
|
+
__metadata("design:type", Number)
|
|
165
|
+
], ProductPricePlanEntity.prototype, "pricePlanId", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, typeorm_1.Column)(),
|
|
168
|
+
__metadata("design:type", Number)
|
|
169
|
+
], ProductPricePlanEntity.prototype, "productId", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, typeorm_1.Column)({
|
|
172
|
+
type: 'decimal',
|
|
173
|
+
precision: 8,
|
|
174
|
+
scale: 2,
|
|
175
|
+
nullable: true,
|
|
176
|
+
default: null
|
|
177
|
+
}),
|
|
178
|
+
__metadata("design:type", Number)
|
|
179
|
+
], ProductPricePlanEntity.prototype, "price", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, typeorm_1.Column)({
|
|
182
|
+
type: 'decimal',
|
|
183
|
+
precision: 8,
|
|
184
|
+
scale: 2,
|
|
185
|
+
nullable: false,
|
|
186
|
+
default: 0
|
|
187
|
+
}),
|
|
188
|
+
__metadata("design:type", Number)
|
|
189
|
+
], ProductPricePlanEntity.prototype, "startCredit", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
(0, typeorm_1.Column)({
|
|
192
|
+
nullable: true,
|
|
193
|
+
default: null
|
|
194
|
+
}),
|
|
195
|
+
__metadata("design:type", Number)
|
|
196
|
+
], ProductPricePlanEntity.prototype, "freeBenefits", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
(0, typeorm_1.Column)({
|
|
199
|
+
nullable: true,
|
|
200
|
+
default: null
|
|
201
|
+
}),
|
|
202
|
+
__metadata("design:type", String)
|
|
203
|
+
], ProductPricePlanEntity.prototype, "featured", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
(0, typeorm_1.Column)({
|
|
206
|
+
nullable: false,
|
|
207
|
+
default: false
|
|
208
|
+
}),
|
|
209
|
+
__metadata("design:type", Boolean)
|
|
210
|
+
], ProductPricePlanEntity.prototype, "active", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, typeorm_1.Column)({
|
|
213
|
+
type: 'simple-json',
|
|
214
|
+
nullable: true,
|
|
215
|
+
default: null
|
|
216
|
+
}),
|
|
217
|
+
__metadata("design:type", Array)
|
|
218
|
+
], ProductPricePlanEntity.prototype, "metadata", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
221
|
+
__metadata("design:type", Number)
|
|
222
|
+
], ProductPricePlanEntity.prototype, "enabledBy", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
225
|
+
__metadata("design:type", Date)
|
|
226
|
+
], ProductPricePlanEntity.prototype, "enabledOn", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
229
|
+
__metadata("design:type", Number)
|
|
230
|
+
], ProductPricePlanEntity.prototype, "disabledBy", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
233
|
+
__metadata("design:type", Date)
|
|
234
|
+
], ProductPricePlanEntity.prototype, "disabledOn", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
(0, typeorm_2.ManyToOne)(() => priceplan_entity_1.PricePlanEntity, plan => plan.products),
|
|
237
|
+
__metadata("design:type", Promise)
|
|
238
|
+
], ProductPricePlanEntity.prototype, "pricePlan", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
(0, typeorm_2.ManyToOne)(() => country_entity_1.ProductCountryEntity, country => country.pricePlans),
|
|
241
|
+
__metadata("design:type", Promise)
|
|
242
|
+
], ProductPricePlanEntity.prototype, "product", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
(0, typeorm_1.OneToMany)(() => priceplan_entity_2.CompanyProductPricePlanEntity, plan => plan.pricePlan),
|
|
245
|
+
__metadata("design:type", Promise)
|
|
246
|
+
], ProductPricePlanEntity.prototype, "companies", void 0);
|
|
247
|
+
exports.ProductPricePlanEntity = ProductPricePlanEntity = __decorate([
|
|
248
|
+
(0, typeorm_1.Entity)('systemProductPricePlans'),
|
|
249
|
+
__metadata("design:paramtypes", [Object])
|
|
250
|
+
], ProductPricePlanEntity);
|
|
251
|
+
//# sourceMappingURL=priceplan.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"priceplan.entity.js","sourceRoot":"","sources":["../../../src/catalog/product/priceplan.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,qCAAoC;AACpC,4CAAwF;AACxF,kEAA8D;AAC9D,oEAAgE;AAChE,qDAAwD;AACxD,qFAA+F;AAC/F,uCAA0D;AAE1D;;;;;;;GAOG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,uBAA0B;IAErE;;;OAGG;IAEH,WAAW,CAAS;IAEpB;;;OAGG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAQH,KAAK,CAAS;IAEd;;OAEG;IAQH,WAAW,CAAS;IAEpB;;OAEG;IAKH,YAAY,CAAS;IAErB;;OAEG;IAKH,QAAQ,CAAS;IAEjB;;;;;OAKG;IAKH,MAAM,CAAU;IAEhB;;OAEG;IAMH,QAAQ,CAAa;IAErB;;OAEG;IAEH,SAAS,CAAS;IAElB;;OAEG;IAEH,SAAS,CAAO;IAEhB;;OAEG;IAEH,UAAU,CAAS;IAEnB;;OAEG;IAEH,UAAU,CAAO;IAEjB;;OAEG;IAEH,SAAS,CAA2B;IAEpC;;OAEG;IAEH,OAAO,CAAgC;IAEvC;;OAEG;IAEH,SAAS,CAA2C;IAEpD;;;OAGG;IACH,YAAY,KAAuC;QAClD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,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