@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,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Address,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Activity, Invoice, Tax } from '@driveup/common';
|
|
2
|
+
import { Address, BankAccount, Note, StatusType } from '@driveup/shared';
|
|
3
|
+
import { EntityManager } from 'typeorm';
|
|
4
|
+
import { TrackableEntity } from '../../../../utils/trackable';
|
|
5
5
|
import { StudentTrainingEntity } from '../../../student/program/training/training.entity';
|
|
6
|
-
import { StudentEntity } from '../../../student/student.entity';
|
|
7
6
|
import { StudentTrainingTransactionEntity } from '../../../student/program/training/transaction.entity';
|
|
8
|
-
import {
|
|
7
|
+
import { StudentEntity } from '../../../student/student.entity';
|
|
8
|
+
import { CompanyEntity } from '../../company.entity';
|
|
9
|
+
import { CompanyInvoiceItemEntity } from './item.entity';
|
|
9
10
|
export declare class CompanyInvoiceEntity extends TrackableEntity<Invoice> {
|
|
10
11
|
companyId: number;
|
|
11
12
|
trainingId: number;
|
|
@@ -60,6 +61,6 @@ export declare class CompanyInvoiceEntity extends TrackableEntity<Invoice> {
|
|
|
60
61
|
/**
|
|
61
62
|
* Get the total amount for the invoice, including items totals and VAT.
|
|
62
63
|
*/
|
|
63
|
-
getTotalAmount(): Promise<number>;
|
|
64
|
+
getTotalAmount(manager?: EntityManager): Promise<number>;
|
|
64
65
|
getActivities(): Promise<Activity[]>;
|
|
65
66
|
}
|
|
@@ -10,15 +10,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CompanyInvoiceEntity = 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");
|
|
16
|
+
const activity_helper_1 = require("../../../../utils/activity.helper");
|
|
17
|
+
const trackable_1 = require("../../../../utils/trackable");
|
|
18
18
|
const training_entity_1 = require("../../../student/program/training/training.entity");
|
|
19
19
|
const transaction_entity_1 = require("../../../student/program/training/transaction.entity");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const company_entity_1 = require("../../company.entity");
|
|
21
|
+
const item_entity_1 = require("./item.entity");
|
|
22
22
|
let CompanyInvoiceEntity = class CompanyInvoiceEntity extends trackable_1.TrackableEntity {
|
|
23
23
|
constructor(props) {
|
|
24
24
|
super();
|
|
@@ -31,14 +31,14 @@ let CompanyInvoiceEntity = class CompanyInvoiceEntity extends trackable_1.Tracka
|
|
|
31
31
|
number: this.number,
|
|
32
32
|
invoiceDate: this.invoiceDate,
|
|
33
33
|
dueDate: this.dueDate,
|
|
34
|
-
bankAccount: this.bankAccount ?
|
|
35
|
-
companyAddress: this.bankAccount ?
|
|
34
|
+
bankAccount: this.bankAccount ? shared_1.BankAccount.toInstance(this.bankAccount) : null,
|
|
35
|
+
companyAddress: this.bankAccount ? shared_1.Address.toInstance(this.companyAddress) : null,
|
|
36
36
|
companyTax: this.companyTax ? common_1.Tax.toInstance(this.companyTax) : null,
|
|
37
37
|
companyPhone: this.companyPhone,
|
|
38
38
|
subtotalAmount: this.subtotalAmount,
|
|
39
39
|
totalVatAmount: this.totalVatAmount,
|
|
40
40
|
totalAmount: this.totalAmount,
|
|
41
|
-
note: this.note ?
|
|
41
|
+
note: this.note ? shared_1.Note.toInstance(this.note) : null,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
toSummary() {
|
|
@@ -63,8 +63,9 @@ let CompanyInvoiceEntity = class CompanyInvoiceEntity extends trackable_1.Tracka
|
|
|
63
63
|
/**
|
|
64
64
|
* Get the total amount for the invoice, including items totals and VAT.
|
|
65
65
|
*/
|
|
66
|
-
async getTotalAmount() {
|
|
67
|
-
const
|
|
66
|
+
async getTotalAmount(manager) {
|
|
67
|
+
const invoiceManager = manager ?? item_entity_1.CompanyInvoiceItemEntity.getRepository().manager;
|
|
68
|
+
const items = await invoiceManager.findBy(item_entity_1.CompanyInvoiceItemEntity, { invoiceId: this.id });
|
|
68
69
|
return items?.reduce((total, item) => {
|
|
69
70
|
const itemSubtotal = item.price * item.quantity;
|
|
70
71
|
const itemVat = item.vat ? itemSubtotal * (item.vat / 100) : 0;
|
|
@@ -167,7 +168,7 @@ __decorate([
|
|
|
167
168
|
nullable: true,
|
|
168
169
|
default: null
|
|
169
170
|
}),
|
|
170
|
-
__metadata("design:type",
|
|
171
|
+
__metadata("design:type", shared_1.Address)
|
|
171
172
|
], CompanyInvoiceEntity.prototype, "companyAddress", void 0);
|
|
172
173
|
__decorate([
|
|
173
174
|
(0, typeorm_1.Column)({
|
|
@@ -182,7 +183,7 @@ __decorate([
|
|
|
182
183
|
nullable: true,
|
|
183
184
|
default: null
|
|
184
185
|
}),
|
|
185
|
-
__metadata("design:type",
|
|
186
|
+
__metadata("design:type", shared_1.BankAccount)
|
|
186
187
|
], CompanyInvoiceEntity.prototype, "bankAccount", void 0);
|
|
187
188
|
__decorate([
|
|
188
189
|
(0, typeorm_1.Column)({
|
|
@@ -198,7 +199,7 @@ __decorate([
|
|
|
198
199
|
nullable: true,
|
|
199
200
|
default: null
|
|
200
201
|
}),
|
|
201
|
-
__metadata("design:type",
|
|
202
|
+
__metadata("design:type", shared_1.Note)
|
|
202
203
|
], CompanyInvoiceEntity.prototype, "note", void 0);
|
|
203
204
|
__decorate([
|
|
204
205
|
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoice.entity.js","sourceRoot":"","sources":["../../../../../src/profile/company/finances/invoice/invoice.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"invoice.entity.js","sourceRoot":"","sources":["../../../../../src/profile/company/finances/invoice/inv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B;AAMzC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sCAAwB,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;;mDACrB;AAM3C;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,qDAAgC,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;yDAC9B;+BA3J3C,oBAAoB;IADhC,IAAA,gBAAM,EAAC,iBAAiB,CAAC;;GACb,oBAAoB,CAgOhC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CompanyInvoiceEntity } from './invoice.entity';
|
|
2
|
-
import { ProductType } from '@driveup/shared';
|
|
3
1
|
import { Activity, InvoiceItem } from '@driveup/common';
|
|
2
|
+
import { ProductType } from '@driveup/shared';
|
|
4
3
|
import { TrackableEntity } from '../../../../utils/trackable';
|
|
4
|
+
import { CompanyInvoiceEntity } from './invoice.entity';
|
|
5
5
|
export declare class CompanyInvoiceItemEntity extends TrackableEntity<InvoiceItem> {
|
|
6
6
|
invoiceId: number;
|
|
7
7
|
description: string;
|
|
@@ -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.CompanyInvoiceItemEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const invoice_entity_1 = require("./invoice.entity");
|
|
15
|
-
const shared_1 = require("@driveup/shared");
|
|
16
13
|
const common_1 = require("@driveup/common");
|
|
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 invoice_entity_1 = require("./invoice.entity");
|
|
19
19
|
let CompanyInvoiceItemEntity = class CompanyInvoiceItemEntity extends trackable_1.TrackableEntity {
|
|
20
20
|
constructor(props) {
|
|
21
21
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.entity.js","sourceRoot":"","sources":["../../../../../src/profile/company/finances/invoice/item.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"item.entity.js","sourceRoot":"","sources":["../../../../../src/profile/company/finances/invoice/item.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,4CAA4D;AAC5D,qCAAoD;AAEpD,uEAA+D;AAC/D,2DAA8D;AAC9D,qDAAwD;AAGjD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,2BAA4B;IAgFzE,YAAY,KAAyC;QACpD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO;QACN,OAAO,IAAI,oBAAW,CAAC;YACtB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;IAED,SAAS;QACR,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,aAAa;QAClB,MAAM,UAAU,GAAe,EAAE,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,MAAM,IAAA,4BAAU,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,qBAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QACxF,UAAU,CAAC,IAAI,CAAC,MAAM,IAAA,4BAAU,EAAC,IAAI,CAAC,SAAS,EAAE,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,EAAE,oBAAW;QACjB,OAAO,EAAE,oBAAW,CAAC,UAAU;QAC/B,QAAQ,EAAE,IAAI;KACd,CAAC;;4DACsB;AASxB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;uDACY;AAGd;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;;yDACzB;mCA9E3B,wBAAwB;IADpC,IAAA,gBAAM,EAAC,qBAAqB,CAAC;;GACjB,wBAAwB,CA2GpC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Activity, PaymentMethod } from '@driveup/common';
|
|
2
|
-
import {
|
|
3
|
-
import { CompanyBillTransactionEntity } from '../billing/transaction.entity';
|
|
2
|
+
import { PaymentProvider } from '@driveup/shared';
|
|
4
3
|
import { CompanyProductPricePlanEntity } from '../../product/priceplan.entity';
|
|
4
|
+
import { CompanyBillTransactionEntity } from '../billing/transaction.entity';
|
|
5
5
|
import { TrackableEntity } from '../../../../utils/trackable';
|
|
6
|
+
import { CompanyEntity } from '../../company.entity';
|
|
6
7
|
export declare class CompanyPaymentMethodEntity extends TrackableEntity<PaymentMethod> {
|
|
7
8
|
companyId: number;
|
|
8
9
|
name: string;
|
|
@@ -11,25 +12,44 @@ export declare class CompanyPaymentMethodEntity extends TrackableEntity<PaymentM
|
|
|
11
12
|
* all other payment methods become inactive
|
|
12
13
|
*/
|
|
13
14
|
active: boolean;
|
|
15
|
+
provider: PaymentProvider;
|
|
14
16
|
/**
|
|
15
|
-
* The provider's response when adding the payment method
|
|
17
|
+
* The provider's response when adding the payment method (for stripe provider, the structure is Stripe.PaymentMethod)
|
|
16
18
|
*/
|
|
17
19
|
metadata: any;
|
|
20
|
+
type: 'card' | 'paypal';
|
|
21
|
+
/**
|
|
22
|
+
* Provider payment method ID
|
|
23
|
+
*/
|
|
18
24
|
methodId: string;
|
|
25
|
+
/**
|
|
26
|
+
* Provider customer ID
|
|
27
|
+
*/
|
|
19
28
|
customerId: string;
|
|
29
|
+
/**
|
|
30
|
+
* Provider setup intent ID
|
|
31
|
+
* Setup intent is created when a checkout session is created, and when the customer enters their payment information in the checkout session on the web and the stripe finally verifies the payment method, or closes the page and canceles the process
|
|
32
|
+
* Until the payment method is successfully created or canceled, we can keep track of the process with setup intent id
|
|
33
|
+
*/
|
|
34
|
+
setupId: string;
|
|
20
35
|
/**
|
|
21
36
|
* Whether the payment method is confirmed and ready to use
|
|
22
37
|
*/
|
|
23
38
|
confirmed: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* URL to the payment method's image/icon (paypal logo, visa card logo, etc...)
|
|
41
|
+
*/
|
|
42
|
+
imageUrl: string;
|
|
24
43
|
company: Promise<CompanyEntity>;
|
|
25
44
|
transactions: Promise<CompanyBillTransactionEntity[]>;
|
|
26
45
|
/**
|
|
27
|
-
*
|
|
46
|
+
* The company product price plan, for which this is the currently active paymentMethod
|
|
28
47
|
*/
|
|
29
48
|
productPaymentMethod: Promise<CompanyProductPricePlanEntity>;
|
|
30
49
|
constructor(props?: Partial<CompanyPaymentMethodEntity>);
|
|
31
50
|
toModel(): PaymentMethod;
|
|
32
51
|
toSummary(): PaymentMethod;
|
|
52
|
+
getCompany(): Promise<CompanyEntity>;
|
|
33
53
|
getFailedTransactions(): Promise<CompanyBillTransactionEntity[]>;
|
|
34
54
|
getActivities(): Promise<Activity[]>;
|
|
35
55
|
}
|
|
@@ -10,14 +10,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CompanyPaymentMethodEntity = 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");
|
|
16
|
+
const activity_helper_1 = require("../../../../utils/activity.helper");
|
|
18
17
|
const priceplan_entity_1 = require("../../product/priceplan.entity");
|
|
18
|
+
const transaction_entity_1 = require("../billing/transaction.entity");
|
|
19
19
|
const trackable_1 = require("../../../../utils/trackable");
|
|
20
|
-
const
|
|
20
|
+
const company_entity_1 = require("../../company.entity");
|
|
21
21
|
let CompanyPaymentMethodEntity = class CompanyPaymentMethodEntity extends trackable_1.TrackableEntity {
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super();
|
|
@@ -37,6 +37,9 @@ let CompanyPaymentMethodEntity = class CompanyPaymentMethodEntity extends tracka
|
|
|
37
37
|
toSummary() {
|
|
38
38
|
return this.toModel();
|
|
39
39
|
}
|
|
40
|
+
async getCompany() {
|
|
41
|
+
return await this.company;
|
|
42
|
+
}
|
|
40
43
|
async getFailedTransactions() {
|
|
41
44
|
return await transaction_entity_1.CompanyBillTransactionEntity
|
|
42
45
|
.createQueryBuilder('t')
|
|
@@ -72,6 +75,15 @@ __decorate([
|
|
|
72
75
|
}),
|
|
73
76
|
__metadata("design:type", Boolean)
|
|
74
77
|
], CompanyPaymentMethodEntity.prototype, "active", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)({
|
|
80
|
+
type: 'enum',
|
|
81
|
+
enum: shared_1.PaymentProvider,
|
|
82
|
+
default: shared_1.PaymentProvider.Stripe,
|
|
83
|
+
nullable: false
|
|
84
|
+
}),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], CompanyPaymentMethodEntity.prototype, "provider", void 0);
|
|
75
87
|
__decorate([
|
|
76
88
|
(0, typeorm_1.Column)({
|
|
77
89
|
type: 'simple-json',
|
|
@@ -80,6 +92,15 @@ __decorate([
|
|
|
80
92
|
}),
|
|
81
93
|
__metadata("design:type", Object)
|
|
82
94
|
], CompanyPaymentMethodEntity.prototype, "metadata", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, typeorm_1.Column)({
|
|
97
|
+
type: 'enum',
|
|
98
|
+
enum: ['card', 'paypal'], // alternative: Stripe.PaymentMethodType
|
|
99
|
+
default: 'card',
|
|
100
|
+
nullable: false
|
|
101
|
+
}),
|
|
102
|
+
__metadata("design:type", String)
|
|
103
|
+
], CompanyPaymentMethodEntity.prototype, "type", void 0);
|
|
83
104
|
__decorate([
|
|
84
105
|
(0, typeorm_1.Column)({
|
|
85
106
|
nullable: true,
|
|
@@ -94,6 +115,13 @@ __decorate([
|
|
|
94
115
|
}),
|
|
95
116
|
__metadata("design:type", String)
|
|
96
117
|
], CompanyPaymentMethodEntity.prototype, "customerId", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({
|
|
120
|
+
nullable: true,
|
|
121
|
+
default: null
|
|
122
|
+
}),
|
|
123
|
+
__metadata("design:type", String)
|
|
124
|
+
], CompanyPaymentMethodEntity.prototype, "setupId", void 0);
|
|
97
125
|
__decorate([
|
|
98
126
|
(0, typeorm_1.Column)({
|
|
99
127
|
nullable: false,
|
|
@@ -101,6 +129,13 @@ __decorate([
|
|
|
101
129
|
}),
|
|
102
130
|
__metadata("design:type", Boolean)
|
|
103
131
|
], CompanyPaymentMethodEntity.prototype, "confirmed", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
(0, typeorm_1.Column)({
|
|
134
|
+
nullable: true,
|
|
135
|
+
default: null
|
|
136
|
+
}),
|
|
137
|
+
__metadata("design:type", String)
|
|
138
|
+
], CompanyPaymentMethodEntity.prototype, "imageUrl", void 0);
|
|
104
139
|
__decorate([
|
|
105
140
|
(0, typeorm_1.ManyToOne)(() => company_entity_1.CompanyEntity, company => company.paymentMethods),
|
|
106
141
|
__metadata("design:type", Promise)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.entity.js","sourceRoot":"","sources":["../../../../../src/profile/company/finances/payment/method.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"method.entity.js","sourceRoot":"","sources":["../../../../../src/profile/company/finances/payment/method.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0D;AAC1D,4CAAwF;AACxF,qCAAyE;AAEzE,uEAA+D;AAC/D,qEAA+E;AAC/E,sEAA6E;AAC7E,2DAA8D;AAC9D,yDAAqD;AAG9C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,2BAA8B;IA2G7E,YAAY,KAA2C;QACtD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO;QACN,OAAO,IAAI,sBAAa,CAAC;YACxB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACJ,CAAC;IAED,SAAS;QACR,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,UAAU;QACf,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,qBAAqB;QAC1B,OAAO,MAAM,iDAA4B;aACvC,kBAAkB,CAAC,GAAG,CAAC;aACvB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC;aACnC,KAAK,CAAC,yBAAyB,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;aACjD,QAAQ,CAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,mBAAU,CAAC,MAAM,EAAE,CAAC;aAC7D,QAAQ,CAAC,2BAA2B,EAAE,EAAE,UAAU,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B;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;4DACe;AASjB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;8DACiB;AAWnB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;2DACc;AAShB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;KACd,CAAC;;6DACiB;AASnB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;4DACe;AAGjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8BAAa,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC;;2DAClC;AAGhC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,iDAA4B,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;;gEAC1B;AAMtD;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,gDAA6B,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC;;wEACvB;qCAzGjD,0BAA0B;IADtC,IAAA,gBAAM,EAAC,uBAAuB,CAAC;;GACnB,0BAA0B,CAoJtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/instructor/activity.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA8F;
|
|
1
|
+
{"version":3,"file":"activity.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/instructor/activity.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA8F;AAE9F,2DAA8D;AAGvD,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAiE3C,YAAY,KAAgD;QAC3D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD,CAAA;AApEY,0EAA+B;AAM3C;IADC,IAAA,gCAAsB,GAAE;;2DACd;AAMX;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;kEAAC;AAMhB;IADC,IAAA,gBAAM,GAAE;;qEACY;AAOrB;IADC,IAAA,gBAAM,GAAE;;8DACK;AAMd;IADC,IAAA,gBAAM,GAAE;8BACH,IAAI;6DAAC;AAMX;IADC,IAAA,gBAAM,GAAE;;oEACW;AAUpB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;qEACmB;AAUrB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;gEACc;AAMhB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAAuB,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;;mEACjC;0CA/DjC,+BAA+B;IAD3C,IAAA,gBAAM,EAAC,6BAA6B,CAAC;;GACzB,+BAA+B,CAoE3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-state.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/instructor/calendar-state.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"calendar-state.entity.js","sourceRoot":"","sources":["../../../../src/profile/company/instructor/calendar-state.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuF;AACvF,qCAA+E;AAE/E,2DAA8D;AAE9D;;;;GAIG;AAEI,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IA2E/C,6DAA6D;IAE7D,YAAY,KAAoD;QAC/D,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;CACD,CAAA;AAhFY,kFAAmC;AAK/C;IADC,IAAA,gCAAsB,GAAE;;+DACd;AAOX;IADC,IAAA,0BAAgB,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACzC,IAAI;sEAAC;AAOhB;IADC,IAAA,0BAAgB,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACzC,IAAI;sEAAC;AAOhB;IADC,IAAA,0BAAgB,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACzC,IAAI;sEAAC;AAShB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,mBAAS,EAAC,MAAM,CAAC;;gEACN;AAQZ;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;mEACZ;AAUhB;IAHC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,KAAK;KACf,CAAC;;yEACmB;AAOrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uEAC0C;AAQnE;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yEACgE;AAKzF;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAAuB,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC;;uEAC3C;8CAzEjC,mCAAmC;IAD/C,IAAA,gBAAM,EAAC,gCAAgC,CAAC;;GAC5B,mCAAmC,CAgF/C"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Activity, Instructor } from '@driveup/common';
|
|
2
|
+
import { AccountStatus, Holiday, Language, Link, Metadata, Period, Preference, PreferenceScope, Role, WorkingHours } from '@driveup/shared';
|
|
3
|
+
import { UserEntity } from '../../../user/user.entity';
|
|
4
|
+
import { TrackableEntity } from '../../../utils/trackable';
|
|
5
5
|
import { InstructorEntity } from '../../instructor/instructor.entity';
|
|
6
|
-
import { CompanyHandoverEntity } from '../finances/handover/handover.entity';
|
|
7
|
-
import { CompanyCourseEntity } from '../course/course.entity';
|
|
8
|
-
import { CompanyCourseLessonEntity } from '../course/lesson.entity';
|
|
9
|
-
import { StudentTrainingEntity } from '../../student/program/training/training.entity';
|
|
10
6
|
import { StudentTrainingAppointmentEntity } from '../../student/program/training/appointment.entity';
|
|
11
|
-
import { CompanyCourseScheduleEntity } from '../course/appointment.entity';
|
|
12
7
|
import { StudentTrainingLessonEntity } from '../../student/program/training/lesson.entity';
|
|
13
|
-
import {
|
|
8
|
+
import { StudentTrainingEntity } from '../../student/program/training/training.entity';
|
|
9
|
+
import { CompanyEntity } from '../company.entity';
|
|
10
|
+
import { CompanyCourseEntity } from '../course/course.entity';
|
|
11
|
+
import { CompanyCourseLessonEntity } from '../course/lesson.entity';
|
|
12
|
+
import { CompanyCourseScheduleEntity } from '../course/schedule.entity';
|
|
13
|
+
import { CompanyHandoverEntity } from '../finances/handover/handover.entity';
|
|
14
14
|
import { CompanyInstructorActivityEntity } from './activity.entity';
|
|
15
|
-
import {
|
|
16
|
-
import { UserEntity } from '../../../user/user.entity';
|
|
15
|
+
import { CompanyInstructorTaskEntity } from './task.entity';
|
|
17
16
|
export declare class CompanyInstructorEntity extends TrackableEntity<Instructor> {
|
|
17
|
+
userId: number;
|
|
18
18
|
instructorId: number;
|
|
19
19
|
companyId: number;
|
|
20
20
|
status: AccountStatus;
|
|
@@ -46,6 +46,10 @@ export declare class CompanyInstructorEntity extends TrackableEntity<Instructor>
|
|
|
46
46
|
invitedOn: Date;
|
|
47
47
|
closedBy: number;
|
|
48
48
|
closedOn: Date;
|
|
49
|
+
/**
|
|
50
|
+
* User relation
|
|
51
|
+
*/
|
|
52
|
+
user: Promise<UserEntity>;
|
|
49
53
|
/**
|
|
50
54
|
* Instrucor profile relation
|
|
51
55
|
*/
|
|
@@ -90,17 +94,19 @@ export declare class CompanyInstructorEntity extends TrackableEntity<Instructor>
|
|
|
90
94
|
* History of the profile activities (profile events)
|
|
91
95
|
*/
|
|
92
96
|
activities: Promise<CompanyInstructorActivityEntity[]>;
|
|
93
|
-
/**
|
|
94
|
-
* Shared calendar states for the instructor
|
|
95
|
-
*/
|
|
96
|
-
sharedCalendarStates: Promise<InstructorSharedCalendarStateEntity[]>;
|
|
97
97
|
constructor(props?: Partial<CompanyInstructorEntity>);
|
|
98
98
|
toModel(): Promise<Instructor>;
|
|
99
99
|
toSummary(): Promise<Instructor>;
|
|
100
|
-
toPerson(): Promise<import("@driveup/
|
|
100
|
+
toPerson(): Promise<import("@driveup/shared").Person>;
|
|
101
101
|
getUser(): Promise<UserEntity>;
|
|
102
|
+
getCompany(): Promise<CompanyEntity>;
|
|
102
103
|
getInstructor(): Promise<InstructorEntity>;
|
|
103
104
|
canReinstate(): Promise<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Non working hours of the instructor in the given period
|
|
107
|
+
*/
|
|
108
|
+
getNonWorkingHours(period: Period): Period[];
|
|
109
|
+
getOffDays(period: Period): Holiday[];
|
|
104
110
|
getActivities(): Promise<Activity[]>;
|
|
105
111
|
getInvitedBy(): Promise<CompanyInstructorEntity | null>;
|
|
106
112
|
getClosedBy(): Promise<CompanyInstructorEntity | null>;
|
|
@@ -122,4 +128,15 @@ export declare class CompanyInstructorEntity extends TrackableEntity<Instructor>
|
|
|
122
128
|
* @returns Array of Preference objects or undefined if not set
|
|
123
129
|
*/
|
|
124
130
|
getPreferences(): Preference<boolean>[];
|
|
131
|
+
setPreference(name: string, value: any, scope: PreferenceScope): Promise<Preference<boolean>[]>;
|
|
132
|
+
removePreference(name: string): Promise<Preference<boolean>[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Checks if the current instructor has access to the resources of the teammate instructor
|
|
135
|
+
* - Both instructors must belong to the same company
|
|
136
|
+
* - If the current instructor is a company owner or manager, they have access to all instructors of the company
|
|
137
|
+
* - If the teammate is an instructor, they only have access to their own resources
|
|
138
|
+
* @param teammate number | CompanyInstructorEntity
|
|
139
|
+
* @returns boolean - Weather or not the accesser should be allowed to access the resources of the accessed
|
|
140
|
+
*/
|
|
141
|
+
hasTeammateAccess(teammate: CompanyInstructorEntity): boolean;
|
|
125
142
|
}
|