@driveup/schema 0.2.6 → 0.2.9
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/lib/catalog/addon/addon.entity.d.ts +3 -3
- package/lib/catalog/addon/addon.entity.js +7 -7
- package/lib/catalog/addon/addon.entity.js.map +1 -1
- package/lib/catalog/addon/country.entity.d.ts +4 -4
- package/lib/catalog/addon/country.entity.js +5 -6
- package/lib/catalog/addon/country.entity.js.map +1 -1
- package/lib/catalog/priceplan/priceplan.entity.d.ts +8 -3
- package/lib/catalog/priceplan/priceplan.entity.js +14 -7
- package/lib/catalog/priceplan/priceplan.entity.js.map +1 -1
- package/lib/catalog/product/country.entity.d.ts +6 -6
- package/lib/catalog/product/country.entity.js +9 -10
- package/lib/catalog/product/country.entity.js.map +1 -1
- package/lib/catalog/product/priceplan.entity.d.ts +9 -4
- package/lib/catalog/product/priceplan.entity.js +19 -9
- package/lib/catalog/product/priceplan.entity.js.map +1 -1
- package/lib/catalog/product/product.entity.d.ts +3 -3
- package/lib/catalog/product/product.entity.js +8 -8
- package/lib/catalog/product/product.entity.js.map +1 -1
- package/lib/catalog/program/program.entity.d.ts +2 -2
- package/lib/catalog/program/program.entity.js +7 -7
- package/lib/catalog/program/program.entity.js.map +1 -1
- package/lib/catalog/seed/assets/asset.entity.d.ts +2 -2
- package/lib/catalog/seed/assets/asset.entity.js +6 -6
- package/lib/catalog/seed/assets/asset.entity.js.map +1 -1
- package/lib/catalog/seed/courses/course.entity.d.ts +4 -4
- package/lib/catalog/seed/courses/course.entity.js +9 -9
- package/lib/catalog/seed/courses/course.entity.js.map +1 -1
- package/lib/catalog/seed/courses/lesson.entity.d.ts +3 -3
- package/lib/catalog/seed/courses/lesson.entity.js +7 -7
- package/lib/catalog/seed/courses/lesson.entity.js.map +1 -1
- package/lib/catalog/seed/courses/topic.entity.d.ts +3 -3
- package/lib/catalog/seed/courses/topic.entity.js +8 -8
- package/lib/catalog/seed/courses/topic.entity.js.map +1 -1
- package/lib/catalog/seed/expense/category.entity.d.ts +2 -2
- package/lib/catalog/seed/expense/category.entity.js +6 -6
- package/lib/catalog/seed/expense/category.entity.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/profile/agent/agent.entity.d.ts +13 -4
- package/lib/profile/agent/agent.entity.js +46 -20
- package/lib/profile/agent/agent.entity.js.map +1 -1
- package/lib/profile/agent/asset.entity.d.ts +1 -1
- package/lib/profile/agent/asset.entity.js +2 -2
- package/lib/profile/agent/asset.entity.js.map +1 -1
- package/lib/profile/agent/payout.entity.d.ts +3 -3
- package/lib/profile/agent/payout.entity.js +6 -6
- package/lib/profile/agent/payout.entity.js.map +1 -1
- package/lib/profile/agent/promotion.entity.d.ts +3 -3
- package/lib/profile/agent/promotion.entity.js +6 -6
- package/lib/profile/agent/promotion.entity.js.map +1 -1
- package/lib/profile/company/company.entity.d.ts +80 -9
- package/lib/profile/company/company.entity.js +246 -36
- package/lib/profile/company/company.entity.js.map +1 -1
- package/lib/profile/company/course/appointment.entity.d.ts +73 -4
- package/lib/profile/company/course/appointment.entity.js +247 -0
- package/lib/profile/company/course/appointment.entity.js.map +1 -1
- package/lib/profile/company/course/course.entity.d.ts +41 -8
- package/lib/profile/company/course/course.entity.js +58 -12
- package/lib/profile/company/course/course.entity.js.map +1 -1
- package/lib/profile/company/course/lesson.entity.d.ts +30 -7
- package/lib/profile/company/course/lesson.entity.js +93 -12
- package/lib/profile/company/course/lesson.entity.js.map +1 -1
- package/lib/profile/company/course/schedule.entity.d.ts +276 -0
- package/lib/profile/company/course/schedule.entity.js +744 -0
- package/lib/profile/company/course/schedule.entity.js.map +1 -0
- package/lib/profile/company/course/topic.entity.d.ts +9 -4
- package/lib/profile/company/course/topic.entity.js +14 -7
- package/lib/profile/company/course/topic.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/bill.entity.d.ts +9 -2
- package/lib/profile/company/finances/billing/bill.entity.js +38 -4
- package/lib/profile/company/finances/billing/bill.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/item.entity.d.ts +8 -3
- package/lib/profile/company/finances/billing/item.entity.js +10 -6
- package/lib/profile/company/finances/billing/item.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/transaction.entity.d.ts +7 -5
- package/lib/profile/company/finances/billing/transaction.entity.js +6 -6
- package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -1
- package/lib/profile/company/finances/expense/category.entity.d.ts +1 -1
- package/lib/profile/company/finances/expense/category.entity.js +4 -4
- package/lib/profile/company/finances/expense/category.entity.js.map +1 -1
- package/lib/profile/company/finances/expense/expense.entity.d.ts +6 -2
- package/lib/profile/company/finances/expense/expense.entity.js +32 -4
- package/lib/profile/company/finances/expense/expense.entity.js.map +1 -1
- package/lib/profile/company/finances/handover/handover.entity.d.ts +3 -3
- package/lib/profile/company/finances/handover/handover.entity.js +6 -6
- package/lib/profile/company/finances/handover/handover.entity.js.map +1 -1
- package/lib/profile/company/finances/invoice/invoice.entity.d.ts +8 -7
- package/lib/profile/company/finances/invoice/invoice.entity.js +15 -14
- package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -1
- package/lib/profile/company/finances/invoice/item.entity.d.ts +2 -2
- package/lib/profile/company/finances/invoice/item.entity.js +4 -4
- package/lib/profile/company/finances/invoice/item.entity.js.map +1 -1
- package/lib/profile/company/finances/payment/method.entity.d.ts +24 -4
- package/lib/profile/company/finances/payment/method.entity.js +40 -5
- package/lib/profile/company/finances/payment/method.entity.js.map +1 -1
- package/lib/profile/company/instructor/activity.entity.js.map +1 -1
- package/lib/profile/company/instructor/calendar-state.entity.js.map +1 -1
- package/lib/profile/company/instructor/instructor.entity.d.ts +34 -17
- package/lib/profile/company/instructor/instructor.entity.js +143 -25
- package/lib/profile/company/instructor/instructor.entity.js.map +1 -1
- package/lib/profile/company/instructor/task.entity.d.ts +2 -1
- package/lib/profile/company/instructor/task.entity.js +9 -4
- package/lib/profile/company/instructor/task.entity.js.map +1 -1
- package/lib/profile/company/medical/examination.entity.d.ts +4 -4
- package/lib/profile/company/medical/examination.entity.js +6 -6
- package/lib/profile/company/medical/examination.entity.js.map +1 -1
- package/lib/profile/company/medical/product.entity.d.ts +4 -5
- package/lib/profile/company/medical/product.entity.js +13 -14
- package/lib/profile/company/medical/product.entity.js.map +1 -1
- package/lib/profile/company/product/addon.entity.d.ts +3 -3
- package/lib/profile/company/product/addon.entity.js +6 -7
- package/lib/profile/company/product/addon.entity.js.map +1 -1
- package/lib/profile/company/product/priceplan.entity.d.ts +15 -13
- package/lib/profile/company/product/priceplan.entity.js +20 -16
- package/lib/profile/company/product/priceplan.entity.js.map +1 -1
- package/lib/profile/company/product/product.entity.d.ts +34 -8
- package/lib/profile/company/product/product.entity.js +70 -12
- package/lib/profile/company/product/product.entity.js.map +1 -1
- package/lib/profile/company/product/vehicle.entity.d.ts +2 -2
- package/lib/profile/company/product/vehicle.entity.js +4 -4
- package/lib/profile/company/product/vehicle.entity.js.map +1 -1
- package/lib/profile/instructor/instructor.entity.d.ts +6 -3
- package/lib/profile/instructor/instructor.entity.js +31 -9
- package/lib/profile/instructor/instructor.entity.js.map +1 -1
- package/lib/profile/student/program/licence/licence.entity.d.ts +13 -5
- package/lib/profile/student/program/licence/licence.entity.js +19 -8
- package/lib/profile/student/program/licence/licence.entity.js.map +1 -1
- package/lib/profile/student/program/medical/certificate.entity.d.ts +3 -3
- package/lib/profile/student/program/medical/certificate.entity.js +6 -6
- package/lib/profile/student/program/medical/certificate.entity.js.map +1 -1
- package/lib/profile/student/program/medical/examination.entity.d.ts +4 -4
- package/lib/profile/student/program/medical/examination.entity.js +14 -14
- package/lib/profile/student/program/medical/examination.entity.js.map +1 -1
- package/lib/profile/student/program/program.entity.d.ts +4 -4
- package/lib/profile/student/program/program.entity.js +8 -13
- package/lib/profile/student/program/program.entity.js.map +1 -1
- package/lib/profile/student/program/training/appointment.entity.d.ts +32 -9
- package/lib/profile/student/program/training/appointment.entity.js +144 -21
- package/lib/profile/student/program/training/appointment.entity.js.map +1 -1
- package/lib/profile/student/program/training/exam.entity.d.ts +9 -2
- package/lib/profile/student/program/training/exam.entity.js +28 -12
- package/lib/profile/student/program/training/exam.entity.js.map +1 -1
- package/lib/profile/student/program/training/lesson.entity.d.ts +8 -3
- package/lib/profile/student/program/training/lesson.entity.js +28 -6
- package/lib/profile/student/program/training/lesson.entity.js.map +1 -1
- package/lib/profile/student/program/training/request.entity.d.ts +6 -3
- package/lib/profile/student/program/training/request.entity.js +26 -5
- package/lib/profile/student/program/training/request.entity.js.map +1 -1
- package/lib/profile/student/program/training/topic.entity.d.ts +16 -4
- package/lib/profile/student/program/training/topic.entity.js +36 -9
- package/lib/profile/student/program/training/topic.entity.js.map +1 -1
- package/lib/profile/student/program/training/training.entity.d.ts +50 -6
- package/lib/profile/student/program/training/training.entity.js +217 -33
- package/lib/profile/student/program/training/training.entity.js.map +1 -1
- package/lib/profile/student/program/training/transaction.entity.d.ts +8 -3
- package/lib/profile/student/program/training/transaction.entity.js +43 -6
- package/lib/profile/student/program/training/transaction.entity.js.map +1 -1
- package/lib/profile/student/student.entity.d.ts +11 -6
- package/lib/profile/student/student.entity.js +59 -11
- package/lib/profile/student/student.entity.js.map +1 -1
- package/lib/system/campaign/campaign.entity.d.ts +4 -4
- package/lib/system/campaign/campaign.entity.js +10 -10
- package/lib/system/campaign/campaign.entity.js.map +1 -1
- package/lib/system/campaign/gifcode.entity.d.ts +4 -4
- package/lib/system/campaign/gifcode.entity.js +8 -8
- package/lib/system/campaign/gifcode.entity.js.map +1 -1
- package/lib/system/country/country.entity.d.ts +8 -6
- package/lib/system/country/country.entity.js +15 -9
- package/lib/system/country/country.entity.js.map +1 -1
- package/lib/system/currency/currency.entity.d.ts +1 -1
- package/lib/system/currency/currency.entity.js +4 -4
- package/lib/system/currency/currency.entity.js.map +1 -1
- package/lib/system/driving/category.entity.d.ts +7 -7
- package/lib/system/driving/category.entity.js +14 -14
- package/lib/system/driving/category.entity.js.map +1 -1
- package/lib/system/driving/vehicle.entity.d.ts +2 -2
- package/lib/system/driving/vehicle.entity.js +4 -4
- package/lib/system/driving/vehicle.entity.js.map +1 -1
- package/lib/system/event/event.entity.d.ts +2 -2
- package/lib/system/event/event.entity.js +4 -4
- package/lib/system/event/event.entity.js.map +1 -1
- package/lib/system/event/log.entity.d.ts +2 -2
- package/lib/system/event/log.entity.js +3 -3
- package/lib/system/event/log.entity.js.map +1 -1
- package/lib/system/ical/ical.entity.d.ts +63 -0
- package/lib/system/ical/ical.entity.js +70 -0
- package/lib/system/ical/ical.entity.js.map +1 -0
- package/lib/system/policy/policy.entity.d.ts +2 -2
- package/lib/system/policy/policy.entity.js +8 -8
- package/lib/system/policy/policy.entity.js.map +1 -1
- package/lib/system/staff/staff.entity.d.ts +1 -1
- package/lib/system/staff/staff.entity.js +5 -4
- package/lib/system/staff/staff.entity.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/user/alert.entity.d.ts +4 -3
- package/lib/user/alert.entity.js +11 -4
- package/lib/user/alert.entity.js.map +1 -1
- package/lib/user/blocked.entity.js +2 -2
- package/lib/user/blocked.entity.js.map +1 -1
- package/lib/user/device.entity.d.ts +17 -2
- package/lib/user/device.entity.js +29 -3
- package/lib/user/device.entity.js.map +1 -1
- package/lib/user/notification.entity.d.ts +3 -3
- package/lib/user/notification.entity.js +8 -8
- package/lib/user/notification.entity.js.map +1 -1
- package/lib/user/ticket.entity.d.ts +8 -3
- package/lib/user/ticket.entity.js +16 -7
- package/lib/user/ticket.entity.js.map +1 -1
- package/lib/user/user.entity.d.ts +101 -89
- package/lib/user/user.entity.js +272 -270
- package/lib/user/user.entity.js.map +1 -1
- package/lib/user/verification.entity.js +2 -2
- package/lib/user/verification.entity.js.map +1 -1
- package/lib/utils/activity.helper.d.ts +2 -2
- package/lib/utils/activity.helper.js.map +1 -1
- package/lib/utils/trackable.d.ts +13 -2
- package/lib/utils/trackable.js +55 -0
- package/lib/utils/trackable.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Language } from '@driveup/shared';
|
|
2
1
|
import { Activity, PricePlan } from '@driveup/common';
|
|
3
|
-
import {
|
|
2
|
+
import { Language, PricePlanType } from '@driveup/shared';
|
|
4
3
|
import { ProductPricePlanEntity } from '../../../catalog/product/priceplan.entity';
|
|
5
4
|
import { CompanyPaymentMethodEntity } from '../finances/payment/method.entity';
|
|
6
5
|
import { TrackableEntity } from '../../../utils/trackable';
|
|
6
|
+
import { CompanyProductEntity } from './product.entity';
|
|
7
7
|
export declare class CompanyProductPricePlanEntity extends TrackableEntity<PricePlan> {
|
|
8
8
|
/**
|
|
9
9
|
* Company product
|
|
@@ -19,25 +19,22 @@ export declare class CompanyProductPricePlanEntity extends TrackableEntity<Price
|
|
|
19
19
|
*/
|
|
20
20
|
active: boolean;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* Can be managed by driveup console and customized per company
|
|
24
|
-
*/
|
|
25
|
-
price: number;
|
|
26
|
-
/**
|
|
27
|
-
* Product start credit for company
|
|
28
|
-
* Readonly for company admin
|
|
29
|
-
* Can be managed by driveup console and customized per company
|
|
22
|
+
* Weather or not this is the upcoming price plan for the company product
|
|
30
23
|
*/
|
|
31
|
-
|
|
24
|
+
upcoming: boolean;
|
|
32
25
|
/**
|
|
33
|
-
* Product
|
|
26
|
+
* Product price
|
|
34
27
|
* Can be managed by driveup console and customized per company
|
|
35
28
|
*/
|
|
36
|
-
|
|
29
|
+
price: number;
|
|
37
30
|
/**
|
|
38
31
|
* Planned switch date to new price plan
|
|
39
32
|
*/
|
|
40
33
|
switchDate: Date;
|
|
34
|
+
/**
|
|
35
|
+
* Only for enterprise plans where a maximum number of seats is defined by driveup
|
|
36
|
+
*/
|
|
37
|
+
maxSeats: number;
|
|
41
38
|
/**
|
|
42
39
|
* Company product relation
|
|
43
40
|
*/
|
|
@@ -50,6 +47,10 @@ export declare class CompanyProductPricePlanEntity extends TrackableEntity<Price
|
|
|
50
47
|
* Current product price plan (the company product for which, THIS is the current price plan)
|
|
51
48
|
*/
|
|
52
49
|
currentPricePlan: Promise<CompanyProductEntity>;
|
|
50
|
+
/**
|
|
51
|
+
* Upcoming product price plan (the company product for which, THIS is the upcoming price plan)
|
|
52
|
+
*/
|
|
53
|
+
upcomingPricePlan: Promise<CompanyProductEntity>;
|
|
53
54
|
/**
|
|
54
55
|
* Current product payment method
|
|
55
56
|
*/
|
|
@@ -58,5 +59,6 @@ export declare class CompanyProductPricePlanEntity extends TrackableEntity<Price
|
|
|
58
59
|
toModel(lang?: Language): Promise<PricePlan>;
|
|
59
60
|
toSummary(): Promise<PricePlan>;
|
|
60
61
|
buildFeatureUsages(usageMetadata: Record<string, any>): Promise<import("@driveup/common").Item<any>[]>;
|
|
62
|
+
getPricePlanType(): Promise<PricePlanType>;
|
|
61
63
|
getActivities(): Promise<Activity[]>;
|
|
62
64
|
}
|
|
@@ -10,13 +10,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CompanyProductPricePlanEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
13
|
const shared_1 = require("@driveup/shared");
|
|
15
|
-
const
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
16
15
|
const priceplan_entity_1 = require("../../../catalog/product/priceplan.entity");
|
|
17
16
|
const method_entity_1 = require("../finances/payment/method.entity");
|
|
18
|
-
const trackable_1 = require("../../../utils/trackable");
|
|
19
17
|
const activity_helper_1 = require("../../../utils/activity.helper");
|
|
18
|
+
const trackable_1 = require("../../../utils/trackable");
|
|
19
|
+
const product_entity_1 = require("./product.entity");
|
|
20
20
|
let CompanyProductPricePlanEntity = class CompanyProductPricePlanEntity extends trackable_1.TrackableEntity {
|
|
21
21
|
constructor(props) {
|
|
22
22
|
super();
|
|
@@ -27,8 +27,6 @@ let CompanyProductPricePlanEntity = class CompanyProductPricePlanEntity extends
|
|
|
27
27
|
const pricePlan = await countryPricePlan.toModel(lang);
|
|
28
28
|
pricePlan.id = this.id;
|
|
29
29
|
pricePlan.price = this.price;
|
|
30
|
-
pricePlan.startCredit = this.startCredit;
|
|
31
|
-
pricePlan.freeBenefits = this.freeBenefits;
|
|
32
30
|
pricePlan.switchDate = this.switchDate;
|
|
33
31
|
return pricePlan;
|
|
34
32
|
}
|
|
@@ -40,6 +38,11 @@ let CompanyProductPricePlanEntity = class CompanyProductPricePlanEntity extends
|
|
|
40
38
|
const driveupPricePlan = await countryPricePlan.pricePlan;
|
|
41
39
|
return driveupPricePlan.getFeatureUsages(usageMetadata);
|
|
42
40
|
}
|
|
41
|
+
async getPricePlanType() {
|
|
42
|
+
const productPricePlan = await this.pricePlan;
|
|
43
|
+
const systemPricePlan = await productPricePlan.pricePlan;
|
|
44
|
+
return systemPricePlan.type;
|
|
45
|
+
}
|
|
43
46
|
async getActivities() {
|
|
44
47
|
const activities = [];
|
|
45
48
|
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_1.ActivityType.created));
|
|
@@ -72,14 +75,11 @@ __decorate([
|
|
|
72
75
|
], CompanyProductPricePlanEntity.prototype, "active", void 0);
|
|
73
76
|
__decorate([
|
|
74
77
|
(0, typeorm_1.Column)({
|
|
75
|
-
type: 'decimal',
|
|
76
|
-
precision: 8,
|
|
77
|
-
scale: 2,
|
|
78
78
|
nullable: false,
|
|
79
|
-
default:
|
|
79
|
+
default: false
|
|
80
80
|
}),
|
|
81
|
-
__metadata("design:type",
|
|
82
|
-
], CompanyProductPricePlanEntity.prototype, "
|
|
81
|
+
__metadata("design:type", Boolean)
|
|
82
|
+
], CompanyProductPricePlanEntity.prototype, "upcoming", void 0);
|
|
83
83
|
__decorate([
|
|
84
84
|
(0, typeorm_1.Column)({
|
|
85
85
|
type: 'decimal',
|
|
@@ -89,21 +89,21 @@ __decorate([
|
|
|
89
89
|
default: 0
|
|
90
90
|
}),
|
|
91
91
|
__metadata("design:type", Number)
|
|
92
|
-
], CompanyProductPricePlanEntity.prototype, "
|
|
92
|
+
], CompanyProductPricePlanEntity.prototype, "price", void 0);
|
|
93
93
|
__decorate([
|
|
94
94
|
(0, typeorm_1.Column)({
|
|
95
95
|
nullable: true,
|
|
96
96
|
default: null
|
|
97
97
|
}),
|
|
98
|
-
__metadata("design:type",
|
|
99
|
-
], CompanyProductPricePlanEntity.prototype, "
|
|
98
|
+
__metadata("design:type", Date)
|
|
99
|
+
], CompanyProductPricePlanEntity.prototype, "switchDate", void 0);
|
|
100
100
|
__decorate([
|
|
101
101
|
(0, typeorm_1.Column)({
|
|
102
102
|
nullable: true,
|
|
103
103
|
default: null
|
|
104
104
|
}),
|
|
105
|
-
__metadata("design:type",
|
|
106
|
-
], CompanyProductPricePlanEntity.prototype, "
|
|
105
|
+
__metadata("design:type", Number)
|
|
106
|
+
], CompanyProductPricePlanEntity.prototype, "maxSeats", void 0);
|
|
107
107
|
__decorate([
|
|
108
108
|
(0, typeorm_1.ManyToOne)(() => product_entity_1.CompanyProductEntity, product => product.pricePlans),
|
|
109
109
|
__metadata("design:type", Promise)
|
|
@@ -116,6 +116,10 @@ __decorate([
|
|
|
116
116
|
(0, typeorm_1.OneToOne)(() => product_entity_1.CompanyProductEntity, product => product.pricePlan),
|
|
117
117
|
__metadata("design:type", Promise)
|
|
118
118
|
], CompanyProductPricePlanEntity.prototype, "currentPricePlan", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, typeorm_1.OneToOne)(() => product_entity_1.CompanyProductEntity, product => product.upcomingPricePlan),
|
|
121
|
+
__metadata("design:type", Promise)
|
|
122
|
+
], CompanyProductPricePlanEntity.prototype, "upcomingPricePlan", void 0);
|
|
119
123
|
__decorate([
|
|
120
124
|
(0, typeorm_1.OneToOne)(() => method_entity_1.CompanyPaymentMethodEntity, method => method.productPaymentMethod),
|
|
121
125
|
(0, typeorm_1.JoinColumn)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceplan.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/product/priceplan.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"priceplan.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/product/priceplan.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4CAAwE;AACxE,qCAA0E;AAE1E,gFAAmF;AACnF,qEAA+E;AAC/E,oEAA4D;AAC5D,wDAA2D;AAC3D,qDAAwD;AAGjD,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,2BAA0B;IAoG5E,YAAY,KAA8C;QACzD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAe;QAC5B,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;QAC9C,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvD,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACvB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7B,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACvC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,SAAS;QACd,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,aAAkC;QAC1D,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC;QAC9C,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC;QAC1D,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACrB,MAAM,g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BACU,IAAI;iEAAC;AASjB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;+DACe;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;;8DAC9B;AAMvC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,yCAAsB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;;gEAC3B;AAM3C;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;;uEACnB;AAMhD;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC;;wEAC1B;AAOjD;IAFC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,0CAA0B,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC;IACjF,IAAA,oBAAU,GAAE;;oEACsC;wCAlGvC,6BAA6B;IADzC,IAAA,gBAAM,EAAC,0BAA0B,CAAC;;GACtB,6BAA6B,CAwIzC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ProductStatus, CatalogType, ProductType } from '@driveup/shared';
|
|
2
1
|
import { Activity, Product } from '@driveup/common';
|
|
3
|
-
import {
|
|
2
|
+
import { CatalogType, ProductStatus, ProductType } from '@driveup/shared';
|
|
4
3
|
import { CountryProductEntity } from '../../../catalog/product/country.entity';
|
|
5
|
-
import {
|
|
4
|
+
import { CompanyMedicalProductEntity } from '../medical/product.entity';
|
|
5
|
+
import { TrackableEntity } from '../../../utils/trackable';
|
|
6
6
|
import { CompanyCourseEntity } from '../course/course.entity';
|
|
7
|
+
import { CompanyProductPricePlanEntity } from './priceplan.entity';
|
|
8
|
+
import { CompanyEntity } from '../company.entity';
|
|
7
9
|
import { CompanyProductVehicleEntity } from './vehicle.entity';
|
|
8
|
-
import { CompanyMedicalProductEntity } from '../medical/product.entity';
|
|
9
10
|
import { CompanyAddonEntity } from './addon.entity';
|
|
10
|
-
import { TrackableEntity } from '../../../utils/trackable';
|
|
11
11
|
export declare class CompanyProductEntity extends TrackableEntity<Product> {
|
|
12
12
|
/**
|
|
13
13
|
* Reference to the company that owns this product
|
|
@@ -19,8 +19,12 @@ export declare class CompanyProductEntity extends TrackableEntity<Product> {
|
|
|
19
19
|
productId: number;
|
|
20
20
|
/**
|
|
21
21
|
* CompanyProductPricePlanEntity id of the currently active price plan for this product
|
|
22
|
-
|
|
22
|
+
*/
|
|
23
23
|
pricePlanId: number;
|
|
24
|
+
/**
|
|
25
|
+
* CompanyProductPricePlanEntity id of the upcoming price plan for the product
|
|
26
|
+
*/
|
|
27
|
+
upcomingPricePlanId: number;
|
|
24
28
|
/**
|
|
25
29
|
* Company product status
|
|
26
30
|
* Examples: Active, Inactive, Suspended, Archived
|
|
@@ -42,6 +46,17 @@ export declare class CompanyProductEntity extends TrackableEntity<Product> {
|
|
|
42
46
|
* Company product price for B2C
|
|
43
47
|
*/
|
|
44
48
|
price: number;
|
|
49
|
+
/**
|
|
50
|
+
* Product start credit for company
|
|
51
|
+
* Readonly for company admin
|
|
52
|
+
* Can be managed by driveup console and customized per company
|
|
53
|
+
*/
|
|
54
|
+
startCredit: number;
|
|
55
|
+
/**
|
|
56
|
+
* Product max free benefits for company
|
|
57
|
+
* Can be managed by driveup console and customized per company
|
|
58
|
+
*/
|
|
59
|
+
freeBenefits: number;
|
|
45
60
|
/**
|
|
46
61
|
* Product credit for B2C
|
|
47
62
|
*/
|
|
@@ -74,6 +89,11 @@ export declare class CompanyProductEntity extends TrackableEntity<Product> {
|
|
|
74
89
|
* and company can't use the product features
|
|
75
90
|
*/
|
|
76
91
|
enabled: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Company product active state
|
|
94
|
+
* Managed by the company
|
|
95
|
+
*/
|
|
96
|
+
active: boolean;
|
|
77
97
|
/**
|
|
78
98
|
* ID of the user who activated this product
|
|
79
99
|
*/
|
|
@@ -134,12 +154,16 @@ export declare class CompanyProductEntity extends TrackableEntity<Product> {
|
|
|
134
154
|
* All product price plans
|
|
135
155
|
* The company can switch any time between different price plans
|
|
136
156
|
*/
|
|
137
|
-
pricePlans: Promise<CompanyProductPricePlanEntity>;
|
|
157
|
+
pricePlans: Promise<CompanyProductPricePlanEntity[]>;
|
|
138
158
|
/**
|
|
139
159
|
* Current price plan
|
|
140
160
|
* The active price plan for the company product
|
|
141
161
|
*/
|
|
142
162
|
pricePlan: Promise<CompanyProductPricePlanEntity>;
|
|
163
|
+
/**
|
|
164
|
+
* Upcoming price plan
|
|
165
|
+
*/
|
|
166
|
+
upcomingPricePlan: Promise<CompanyProductPricePlanEntity>;
|
|
143
167
|
/**
|
|
144
168
|
* Company product addons
|
|
145
169
|
* Addons are additional features or services that can be added to the main product
|
|
@@ -173,12 +197,14 @@ export declare class CompanyProductEntity extends TrackableEntity<Product> {
|
|
|
173
197
|
vehicles: Promise<CompanyProductVehicleEntity[]>;
|
|
174
198
|
constructor(props?: Partial<CompanyProductEntity>);
|
|
175
199
|
isMedical: () => boolean;
|
|
176
|
-
|
|
200
|
+
isPreparation: () => boolean;
|
|
177
201
|
isDriving: () => boolean;
|
|
178
202
|
isCompletion: () => boolean;
|
|
179
203
|
toModel(): Promise<Product>;
|
|
180
204
|
toSummary(): Promise<Product>;
|
|
181
205
|
getVehicles(): Promise<import("@driveup/common").Vehicle[]>;
|
|
182
206
|
canPurchase(): boolean;
|
|
207
|
+
getUpcomingPricePlan(): Promise<CompanyProductPricePlanEntity>;
|
|
183
208
|
getActivities(): Promise<Activity[]>;
|
|
209
|
+
canAddTraining(): Promise<boolean>;
|
|
184
210
|
}
|
|
@@ -10,24 +10,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CompanyProductEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
13
|
const shared_1 = require("@driveup/shared");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const luxon_1 = require("luxon");
|
|
17
16
|
const country_entity_1 = require("../../../catalog/product/country.entity");
|
|
18
|
-
const
|
|
17
|
+
const staff_entity_1 = require("../../../system/staff/staff.entity");
|
|
18
|
+
const activity_helper_1 = require("../../../utils/activity.helper");
|
|
19
|
+
const product_entity_1 = require("../medical/product.entity");
|
|
20
|
+
const trackable_1 = require("../../../utils/trackable");
|
|
19
21
|
const course_entity_1 = require("../course/course.entity");
|
|
22
|
+
const priceplan_entity_1 = require("./priceplan.entity");
|
|
23
|
+
const company_entity_1 = require("../company.entity");
|
|
20
24
|
const vehicle_entity_1 = require("./vehicle.entity");
|
|
21
|
-
const product_entity_1 = require("../medical/product.entity");
|
|
22
25
|
const addon_entity_1 = require("./addon.entity");
|
|
23
|
-
const trackable_1 = require("../../../utils/trackable");
|
|
24
|
-
const activity_helper_1 = require("../../../utils/activity.helper");
|
|
25
26
|
let CompanyProductEntity = class CompanyProductEntity extends trackable_1.TrackableEntity {
|
|
26
27
|
constructor(props) {
|
|
27
28
|
super();
|
|
28
29
|
this.isMedical = () => this.catalogType === shared_1.CatalogType.Medical;
|
|
29
|
-
this.
|
|
30
|
-
this.isDriving = () => this.catalogType === shared_1.CatalogType.
|
|
30
|
+
this.isPreparation = () => this.catalogType === shared_1.CatalogType.Preparation;
|
|
31
|
+
this.isDriving = () => this.catalogType === shared_1.CatalogType.Preparation;
|
|
31
32
|
this.isCompletion = () => this.catalogType === shared_1.CatalogType.Completion;
|
|
32
33
|
Object.assign(this, props);
|
|
33
34
|
}
|
|
@@ -54,6 +55,15 @@ let CompanyProductEntity = class CompanyProductEntity extends trackable_1.Tracka
|
|
|
54
55
|
canPurchase() {
|
|
55
56
|
return this.status === shared_1.ProductStatus.Active;
|
|
56
57
|
}
|
|
58
|
+
async getUpcomingPricePlan() {
|
|
59
|
+
// TODO: check this function carefuly
|
|
60
|
+
return priceplan_entity_1.CompanyProductPricePlanEntity.createQueryBuilder('pp') // company product plan
|
|
61
|
+
.innerJoin('pp.product', 'p') // company product
|
|
62
|
+
.where('p.id = :id', { id: this.id })
|
|
63
|
+
.andWhere('pp.active = :false', { false: false })
|
|
64
|
+
.andWhere('pp.switchDate >= :now', { now: luxon_1.DateTime.now().toJSDate() })
|
|
65
|
+
.getOne();
|
|
66
|
+
}
|
|
57
67
|
async getActivities() {
|
|
58
68
|
const activities = [];
|
|
59
69
|
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_1.ActivityType.created));
|
|
@@ -64,6 +74,20 @@ let CompanyProductEntity = class CompanyProductEntity extends trackable_1.Tracka
|
|
|
64
74
|
activities.push(await (0, activity_helper_1.toActivity)(this.disabledBy, this.disabledOn, shared_1.ActivityType.disabled, staff_entity_1.StaffEntity));
|
|
65
75
|
return activities.filter(a => a);
|
|
66
76
|
}
|
|
77
|
+
async canAddTraining() {
|
|
78
|
+
const company = await this.company;
|
|
79
|
+
const blockedStatuses = [shared_1.AccountStatus.Suspended, shared_1.AccountStatus.Blocked, shared_1.AccountStatus.Closed];
|
|
80
|
+
if (blockedStatuses.includes(company.status)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (!this.enabled) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (!this.active) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
67
91
|
};
|
|
68
92
|
exports.CompanyProductEntity = CompanyProductEntity;
|
|
69
93
|
__decorate([
|
|
@@ -81,6 +105,13 @@ __decorate([
|
|
|
81
105
|
}),
|
|
82
106
|
__metadata("design:type", Number)
|
|
83
107
|
], CompanyProductEntity.prototype, "pricePlanId", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, typeorm_1.Column)({
|
|
110
|
+
nullable: true,
|
|
111
|
+
default: null
|
|
112
|
+
}),
|
|
113
|
+
__metadata("design:type", Number)
|
|
114
|
+
], CompanyProductEntity.prototype, "upcomingPricePlanId", void 0);
|
|
84
115
|
__decorate([
|
|
85
116
|
(0, typeorm_1.Column)({
|
|
86
117
|
type: 'enum',
|
|
@@ -129,6 +160,23 @@ __decorate([
|
|
|
129
160
|
}),
|
|
130
161
|
__metadata("design:type", Number)
|
|
131
162
|
], CompanyProductEntity.prototype, "price", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, typeorm_1.Column)({
|
|
165
|
+
type: 'decimal',
|
|
166
|
+
precision: 8,
|
|
167
|
+
scale: 2,
|
|
168
|
+
nullable: false,
|
|
169
|
+
default: 0
|
|
170
|
+
}),
|
|
171
|
+
__metadata("design:type", Number)
|
|
172
|
+
], CompanyProductEntity.prototype, "startCredit", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, typeorm_1.Column)({
|
|
175
|
+
nullable: true,
|
|
176
|
+
default: null
|
|
177
|
+
}),
|
|
178
|
+
__metadata("design:type", Number)
|
|
179
|
+
], CompanyProductEntity.prototype, "freeBenefits", void 0);
|
|
132
180
|
__decorate([
|
|
133
181
|
(0, typeorm_1.Column)({
|
|
134
182
|
type: 'decimal',
|
|
@@ -152,7 +200,7 @@ __decorate([
|
|
|
152
200
|
], CompanyProductEntity.prototype, "freeBenefitsAllowed", void 0);
|
|
153
201
|
__decorate([
|
|
154
202
|
(0, typeorm_1.Column)({
|
|
155
|
-
type: '
|
|
203
|
+
type: 'json',
|
|
156
204
|
nullable: true,
|
|
157
205
|
default: null
|
|
158
206
|
}),
|
|
@@ -165,6 +213,13 @@ __decorate([
|
|
|
165
213
|
}),
|
|
166
214
|
__metadata("design:type", Boolean)
|
|
167
215
|
], CompanyProductEntity.prototype, "enabled", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
(0, typeorm_1.Column)({
|
|
218
|
+
nullable: false,
|
|
219
|
+
default: true
|
|
220
|
+
}),
|
|
221
|
+
__metadata("design:type", Boolean)
|
|
222
|
+
], CompanyProductEntity.prototype, "active", void 0);
|
|
168
223
|
__decorate([
|
|
169
224
|
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
170
225
|
__metadata("design:type", Number)
|
|
@@ -222,14 +277,17 @@ __decorate([
|
|
|
222
277
|
__metadata("design:type", Promise)
|
|
223
278
|
], CompanyProductEntity.prototype, "product", void 0);
|
|
224
279
|
__decorate([
|
|
225
|
-
(0, typeorm_1.
|
|
280
|
+
(0, typeorm_1.OneToMany)(() => priceplan_entity_1.CompanyProductPricePlanEntity, plan => plan.product),
|
|
226
281
|
__metadata("design:type", Promise)
|
|
227
282
|
], CompanyProductEntity.prototype, "pricePlans", void 0);
|
|
228
283
|
__decorate([
|
|
229
284
|
(0, typeorm_1.OneToOne)(() => priceplan_entity_1.CompanyProductPricePlanEntity, plan => plan.currentPricePlan),
|
|
230
|
-
(0, typeorm_1.JoinColumn)(),
|
|
231
285
|
__metadata("design:type", Promise)
|
|
232
286
|
], CompanyProductEntity.prototype, "pricePlan", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
(0, typeorm_1.OneToOne)(() => priceplan_entity_1.CompanyProductPricePlanEntity, plan => plan.upcomingPricePlan),
|
|
289
|
+
__metadata("design:type", Promise)
|
|
290
|
+
], CompanyProductEntity.prototype, "upcomingPricePlan", void 0);
|
|
233
291
|
__decorate([
|
|
234
292
|
(0, typeorm_1.OneToMany)(() => addon_entity_1.CompanyAddonEntity, addon => addon.company),
|
|
235
293
|
__metadata("design:type", Promise)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/product/product.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file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A,mBAAS,EAAC,GAAG,EAAE,CAAC,gDAA6B,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;;wDAChB;AAOrD;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,gDAA6B,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC;;uDAC3B;AAMlD;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,gDAA6B,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC;;+DACpB;AAO1D;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,iCAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;oDACtB;AAYtC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,4CAA2B,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;;qDACvB;AAUhD;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,mCAAmB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;;qDACvB;AAUxC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,4CAA2B,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;;sDACtB;+BApUrC,oBAAoB;IADhC,IAAA,gBAAM,EAAC,iBAAiB,CAAC;;GACb,oBAAoB,CA8YhC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CarTransmission } from '@driveup/shared';
|
|
2
1
|
import { Activity, Vehicle } from '@driveup/common';
|
|
3
|
-
import {
|
|
2
|
+
import { CarTransmission } from '@driveup/shared';
|
|
4
3
|
import { TrackableEntity } from '../../../utils/trackable';
|
|
4
|
+
import { CompanyProductEntity } from './product.entity';
|
|
5
5
|
export declare class CompanyProductVehicleEntity extends TrackableEntity<Vehicle> {
|
|
6
6
|
/**
|
|
7
7
|
* Reference to the company product this vehicle belongs to
|
|
@@ -10,12 +10,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CompanyProductVehicleEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const shared_1 = require("@driveup/shared");
|
|
15
13
|
const common_1 = require("@driveup/common");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
14
|
+
const shared_1 = require("@driveup/shared");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
18
16
|
const activity_helper_1 = require("../../../utils/activity.helper");
|
|
17
|
+
const trackable_1 = require("../../../utils/trackable");
|
|
18
|
+
const product_entity_1 = require("./product.entity");
|
|
19
19
|
let CompanyProductVehicleEntity = class CompanyProductVehicleEntity extends trackable_1.TrackableEntity {
|
|
20
20
|
constructor(props) {
|
|
21
21
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicle.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/product/vehicle.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"vehicle.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/product/vehicle.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAoD;AACpD,4CAAgE;AAChE,qCAAoD;AAEpD,oEAA4D;AAC5D,wDAA2D;AAC3D,qDAAwD;AAGjD,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,2BAAwB;IA6ExE,YAAY,KAA4C;QACvD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO;QACN,OAAO,IAAI,gBAAO,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,MAAM,EAAE,IAAI,CAAC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,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;6DACe;AAYjB;IANC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,wBAAe;QACrB,OAAO,EAAE,wBAAe,CAAC,SAAS;QAClC,QAAQ,EAAE,KAAK;KACf,CAAC;;iEACsC;AAMxC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;4DAC5B;sCA3E3B,2BAA2B;IADvC,IAAA,gBAAM,EAAC,wBAAwB,CAAC;;GACpB,2BAA2B,CAyGvC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Activity, Instructor } from '@driveup/common';
|
|
2
|
+
import { AccountStatus, Language, Person, Preference, PreferenceScope } from '@driveup/shared';
|
|
3
3
|
import { UserEntity } from '../../user/user.entity';
|
|
4
|
-
import { CompanyInstructorEntity } from '../company/instructor/instructor.entity';
|
|
5
4
|
import { TrackableEntity } from '../../utils/trackable';
|
|
5
|
+
import { CompanyInstructorEntity } from '../company/instructor/instructor.entity';
|
|
6
6
|
/**
|
|
7
7
|
* Represents an instructor profile in the system.
|
|
8
8
|
* Instructors can be associated with multiple companies and provide
|
|
@@ -67,6 +67,7 @@ export declare class InstructorEntity extends TrackableEntity<Instructor> {
|
|
|
67
67
|
* @returns Promise resolving to Person model with basic contact information
|
|
68
68
|
*/
|
|
69
69
|
toPerson(): Promise<Person>;
|
|
70
|
+
getUser(): Promise<UserEntity>;
|
|
70
71
|
/**
|
|
71
72
|
* Retrieves all activity records for this instructor
|
|
72
73
|
* Includes creation and update actions
|
|
@@ -91,4 +92,6 @@ export declare class InstructorEntity extends TrackableEntity<Instructor> {
|
|
|
91
92
|
* @returns Array of Preference objects or undefined if not set
|
|
92
93
|
*/
|
|
93
94
|
getPreferences(): Preference<boolean>[];
|
|
95
|
+
setPreference(name: string, value: any, scope: PreferenceScope): Promise<Preference<boolean>[]>;
|
|
96
|
+
removePreference(name: string): Promise<Preference<boolean>[]>;
|
|
94
97
|
}
|
|
@@ -8,16 +8,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var InstructorEntity_1;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.InstructorEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const shared_1 = require("@driveup/shared");
|
|
15
14
|
const common_1 = require("@driveup/common");
|
|
16
|
-
const
|
|
15
|
+
const shared_1 = require("@driveup/shared");
|
|
16
|
+
const typeorm_1 = require("typeorm");
|
|
17
17
|
const log_entity_1 = require("../../system/event/log.entity");
|
|
18
|
-
const
|
|
19
|
-
const trackable_1 = require("../../utils/trackable");
|
|
18
|
+
const user_entity_1 = require("../../user/user.entity");
|
|
20
19
|
const activity_helper_1 = require("../../utils/activity.helper");
|
|
20
|
+
const trackable_1 = require("../../utils/trackable");
|
|
21
|
+
const instructor_entity_1 = require("../company/instructor/instructor.entity");
|
|
21
22
|
/**
|
|
22
23
|
* Represents an instructor profile in the system.
|
|
23
24
|
* Instructors can be associated with multiple companies and provide
|
|
@@ -25,7 +26,7 @@ const activity_helper_1 = require("../../utils/activity.helper");
|
|
|
25
26
|
*
|
|
26
27
|
* @extends TrackableEntity<Instructor>
|
|
27
28
|
*/
|
|
28
|
-
let InstructorEntity = class InstructorEntity extends trackable_1.TrackableEntity {
|
|
29
|
+
let InstructorEntity = InstructorEntity_1 = class InstructorEntity extends trackable_1.TrackableEntity {
|
|
29
30
|
/**
|
|
30
31
|
* Creates an instance of InstructorEntity
|
|
31
32
|
* @param props - Partial properties to initialize the entity
|
|
@@ -63,14 +64,18 @@ let InstructorEntity = class InstructorEntity extends trackable_1.TrackableEntit
|
|
|
63
64
|
*/
|
|
64
65
|
async toPerson() {
|
|
65
66
|
const user = await this.user;
|
|
66
|
-
return new
|
|
67
|
+
return new shared_1.Person({
|
|
67
68
|
id: this.id,
|
|
68
69
|
name: this.name,
|
|
69
70
|
imageUrl: this.imageUrl || user.imageUrl,
|
|
71
|
+
image: this.imageUrl || user.imageUrl, // mvp only
|
|
70
72
|
phone: user.phone,
|
|
71
73
|
email: user.email
|
|
72
74
|
});
|
|
73
75
|
}
|
|
76
|
+
async getUser() {
|
|
77
|
+
return await this.user;
|
|
78
|
+
}
|
|
74
79
|
/**
|
|
75
80
|
* Retrieves all activity records for this instructor
|
|
76
81
|
* Includes creation and update actions
|
|
@@ -122,7 +127,24 @@ let InstructorEntity = class InstructorEntity extends trackable_1.TrackableEntit
|
|
|
122
127
|
getPreferences() {
|
|
123
128
|
if (!this.preferences)
|
|
124
129
|
return;
|
|
125
|
-
return this.preferences.map(
|
|
130
|
+
return this.preferences.map(shared_1.Preference.toInstance);
|
|
131
|
+
}
|
|
132
|
+
async setPreference(name, value, scope) {
|
|
133
|
+
this.preferences = this.preferences || [];
|
|
134
|
+
this.preferences = this.preferences.filter(p => p.name !== name);
|
|
135
|
+
this.preferences.push(new shared_1.Preference({
|
|
136
|
+
scope: scope,
|
|
137
|
+
name: name,
|
|
138
|
+
value: value
|
|
139
|
+
}));
|
|
140
|
+
await instructor_entity_1.CompanyInstructorEntity.save(this);
|
|
141
|
+
return this.preferences;
|
|
142
|
+
}
|
|
143
|
+
async removePreference(name) {
|
|
144
|
+
this.preferences = this.preferences || [];
|
|
145
|
+
this.preferences = this.preferences.filter(p => p.name !== name);
|
|
146
|
+
await InstructorEntity_1.save(this);
|
|
147
|
+
return this.preferences;
|
|
126
148
|
}
|
|
127
149
|
};
|
|
128
150
|
exports.InstructorEntity = InstructorEntity;
|
|
@@ -178,7 +200,7 @@ __decorate([
|
|
|
178
200
|
(0, typeorm_1.OneToMany)(() => instructor_entity_1.CompanyInstructorEntity, company => company.instructor),
|
|
179
201
|
__metadata("design:type", Promise)
|
|
180
202
|
], InstructorEntity.prototype, "companies", void 0);
|
|
181
|
-
exports.InstructorEntity = InstructorEntity = __decorate([
|
|
203
|
+
exports.InstructorEntity = InstructorEntity = InstructorEntity_1 = __decorate([
|
|
182
204
|
(0, typeorm_1.Entity)('instructors'),
|
|
183
205
|
__metadata("design:paramtypes", [Object])
|
|
184
206
|
], InstructorEntity);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructor.entity.js","sourceRoot":"","sources":["../../../src/profile/instructor/instructor.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"instructor.entity.js","sourceRoot":"","sources":["../../../src/profile/instructor/instructor.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,4CAAuD;AACvD,4CAAmI;AACnI,qCAA+D;AAE/D,8DAA0D;AAC1D,wDAAoD;AACpD,iEAAyD;AACzD,qDAAwD;AACxD,+EAAkF;AAElF;;;;;;GAMG;AAEI,IAAM,gBAAgB,wBAAtB,MAAM,gBAAiB,SAAQ,2BAA2B;IAyEhE;;;OAGG;IACH,YAAY,KAAiC;QAC5C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACZ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;QAC7B,OAAO,mBAAU,CAAC,UAAU,CAAC;YAC5B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YACxC,K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