@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,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Activity, Transaction } from '@driveup/common';
|
|
2
|
+
import { BankAccount, PaymentType, StatusType, TransactionType } from '@driveup/shared';
|
|
3
|
+
import { TrackableEntity } from '../../../../utils/trackable';
|
|
3
4
|
import { CompanyInvoiceEntity } from '../../../company/finances/invoice/invoice.entity';
|
|
5
|
+
import { CompanyInstructorEntity } from '../../../company/instructor/instructor.entity';
|
|
4
6
|
import { StudentTrainingEntity } from './training.entity';
|
|
5
|
-
import { TrackableEntity } from '../../../../utils/trackable';
|
|
6
7
|
/**
|
|
7
8
|
* Student training transaction entity representing financial transactions for training sessions.
|
|
8
9
|
* Handles payments, cancellations, and refunds related to student training programs.
|
|
@@ -91,6 +92,7 @@ export declare class StudentTrainingTransactionEntity extends TrackableEntity<Tr
|
|
|
91
92
|
* @returns Transaction model instance (same as toModel())
|
|
92
93
|
*/
|
|
93
94
|
toSummary(): Transaction;
|
|
95
|
+
getTraining(): Promise<StudentTrainingEntity>;
|
|
94
96
|
/**
|
|
95
97
|
* Retrieves the referenced transaction (typically a cancellation transaction)
|
|
96
98
|
* @returns The related transaction entity or undefined if no reference exists
|
|
@@ -102,6 +104,9 @@ export declare class StudentTrainingTransactionEntity extends TrackableEntity<Tr
|
|
|
102
104
|
* @returns The original transaction entity that was canceled
|
|
103
105
|
*/
|
|
104
106
|
getByRefTransaction(): Promise<StudentTrainingTransactionEntity>;
|
|
107
|
+
getRegisteredBy(): Promise<CompanyInstructorEntity>;
|
|
108
|
+
getApprovedBy(): Promise<CompanyInstructorEntity>;
|
|
109
|
+
getCanceledBy(): Promise<CompanyInstructorEntity>;
|
|
105
110
|
/**
|
|
106
111
|
* Retrieves all tracked activities for this transaction
|
|
107
112
|
* Includes creation and update timestamps and associated users
|
|
@@ -11,13 +11,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var StudentTrainingTransactionEntity_1;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.StudentTrainingTransactionEntity = void 0;
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
15
|
-
const shared_1 = require("@driveup/shared");
|
|
16
14
|
const common_1 = require("@driveup/common");
|
|
15
|
+
const shared_1 = require("@driveup/shared");
|
|
16
|
+
const typeorm_1 = require("typeorm");
|
|
17
|
+
const activity_helper_1 = require("../../../../utils/activity.helper");
|
|
18
|
+
const trackable_1 = require("../../../../utils/trackable");
|
|
17
19
|
const invoice_entity_1 = require("../../../company/finances/invoice/invoice.entity");
|
|
20
|
+
const instructor_entity_1 = require("../../../company/instructor/instructor.entity");
|
|
18
21
|
const training_entity_1 = require("./training.entity");
|
|
19
|
-
const trackable_1 = require("../../../../utils/trackable");
|
|
20
|
-
const activity_helper_1 = require("../../../../utils/activity.helper");
|
|
21
22
|
/**
|
|
22
23
|
* Student training transaction entity representing financial transactions for training sessions.
|
|
23
24
|
* Handles payments, cancellations, and refunds related to student training programs.
|
|
@@ -44,7 +45,7 @@ let StudentTrainingTransactionEntity = StudentTrainingTransactionEntity_1 = clas
|
|
|
44
45
|
status: this.status,
|
|
45
46
|
amount: this.amount,
|
|
46
47
|
description: this.description,
|
|
47
|
-
bank: this.bankAccount ?
|
|
48
|
+
bank: this.bankAccount ? shared_1.BankAccount.toInstance(this.bankAccount) : null,
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
@@ -54,6 +55,9 @@ let StudentTrainingTransactionEntity = StudentTrainingTransactionEntity_1 = clas
|
|
|
54
55
|
toSummary() {
|
|
55
56
|
return this.toModel();
|
|
56
57
|
}
|
|
58
|
+
async getTraining() {
|
|
59
|
+
return await this.training;
|
|
60
|
+
}
|
|
57
61
|
/**
|
|
58
62
|
* Retrieves the referenced transaction (typically a cancellation transaction)
|
|
59
63
|
* @returns The related transaction entity or undefined if no reference exists
|
|
@@ -75,6 +79,39 @@ let StudentTrainingTransactionEntity = StudentTrainingTransactionEntity_1 = clas
|
|
|
75
79
|
refTransactionId: this.id
|
|
76
80
|
});
|
|
77
81
|
}
|
|
82
|
+
async getRegisteredBy() {
|
|
83
|
+
if (!this.createdBy)
|
|
84
|
+
return null;
|
|
85
|
+
const training = await this.training;
|
|
86
|
+
const company = await training.getCompany();
|
|
87
|
+
return await instructor_entity_1.CompanyInstructorEntity.createQueryBuilder('ci')
|
|
88
|
+
.innerJoin('ci.instructor', 'i') // instructor profile
|
|
89
|
+
.where('i.userId = :userId', { userId: this.createdBy })
|
|
90
|
+
.andWhere('ci.companyId = :companyId', { companyId: company.id })
|
|
91
|
+
.getOne();
|
|
92
|
+
}
|
|
93
|
+
async getApprovedBy() {
|
|
94
|
+
if (!this.approvedBy)
|
|
95
|
+
return null;
|
|
96
|
+
const training = await this.training;
|
|
97
|
+
const company = await training.getCompany();
|
|
98
|
+
return await instructor_entity_1.CompanyInstructorEntity.createQueryBuilder('ci')
|
|
99
|
+
.innerJoin('ci.instructor', 'i') // instructor profile
|
|
100
|
+
.where('i.userId = :userId', { userId: this.approvedBy })
|
|
101
|
+
.andWhere('ci.companyId = :companyId', { companyId: company.id })
|
|
102
|
+
.getOne();
|
|
103
|
+
}
|
|
104
|
+
async getCanceledBy() {
|
|
105
|
+
if (!this.canceledBy)
|
|
106
|
+
return null;
|
|
107
|
+
const training = await this.training;
|
|
108
|
+
const company = await training.getCompany();
|
|
109
|
+
return await instructor_entity_1.CompanyInstructorEntity.createQueryBuilder('ci')
|
|
110
|
+
.innerJoin('ci.instructor', 'i') // instructor profile
|
|
111
|
+
.where('i.userId = :userId', { userId: this.canceledBy })
|
|
112
|
+
.andWhere('ci.companyId = :companyId', { companyId: company.id })
|
|
113
|
+
.getOne();
|
|
114
|
+
}
|
|
78
115
|
/**
|
|
79
116
|
* Retrieves all tracked activities for this transaction
|
|
80
117
|
* Includes creation and update timestamps and associated users
|
|
@@ -164,7 +201,7 @@ __decorate([
|
|
|
164
201
|
nullable: true,
|
|
165
202
|
default: null
|
|
166
203
|
}),
|
|
167
|
-
__metadata("design:type",
|
|
204
|
+
__metadata("design:type", shared_1.BankAccount)
|
|
168
205
|
], StudentTrainingTransactionEntity.prototype, "bankAccount", void 0);
|
|
169
206
|
__decorate([
|
|
170
207
|
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/transaction.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAA0E;
|
|
1
|
+
{"version":3,"file":"transaction.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/transaction.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,4CAAwD;AACxD,4CAAsG;AACtG,qCAA0E;AAE1E,uEAA+D;AAC/D,2DAA8D;AAC9D,qFAAwF;AACxF,qFAAwF;AACxF,uDAA0D;AAE1D;;;;GAIG;AAEI,IAAM,gCAAgC,wCAAtC,MAAM,gCAAiC,SAAQ,2BAA4B;IA8IjF;;;OAGG;IACH,YAAY,KAAiD;QAC5D,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAAO,IAAI,oBAAW,CAAC;YACtB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAW,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;SACxE,CAAC,CAAC;IACJ,CAAC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AUzB;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;8BACW,oBAAW;qEAAC;AAMzB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oEACvB;AAMnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC9B,IAAI;oEAAC;AAMjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oEACvB;AAMnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC9B,IAAI;oEAAC;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAqB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;;kEACjC;AAOzC;IAFC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjE,IAAA,oBAAU,GAAE;;iEAC0B;2CA5I3B,gCAAgC;IAD5C,IAAA,gBAAM,EAAC,6BAA6B,CAAC;;GACzB,gCAAgC,CAoP5C"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Preference,
|
|
1
|
+
import { Activity, Student } from '@driveup/common';
|
|
2
|
+
import { AccountStatus, Language, Person, Preference, PreferenceScope, ProductType, ProgramType } from '@driveup/shared';
|
|
3
3
|
import { UserEntity } from '../../user/user.entity';
|
|
4
|
+
import { TrackableEntity } from '../../utils/trackable';
|
|
5
|
+
import { CompanyEntity } from '../company/company.entity';
|
|
4
6
|
import { StudentLicenceEntity } from './program/licence/licence.entity';
|
|
7
|
+
import { StudentMedicalCertificateEntity } from './program/medical/certificate.entity';
|
|
5
8
|
import { StudentMedicalExaminationEntity } from './program/medical/examination.entity';
|
|
6
9
|
import { StudentProgramEntity } from './program/program.entity';
|
|
7
|
-
import { StudentMedicalCertificateEntity } from './program/medical/certificate.entity';
|
|
8
|
-
import { TrackableEntity } from '../../utils/trackable';
|
|
9
|
-
import { CompanyEntity } from '../company/company.entity';
|
|
10
10
|
export declare class StudentEntity extends TrackableEntity<Student> {
|
|
11
11
|
/**
|
|
12
12
|
* Reference to the user account associated with this student profile
|
|
@@ -63,7 +63,7 @@ export declare class StudentEntity extends TrackableEntity<Student> {
|
|
|
63
63
|
/**
|
|
64
64
|
* All programs linked to this student profile
|
|
65
65
|
* The programs are created when the student enrolls to a driving category
|
|
66
|
-
* The program is palette of trainings and
|
|
66
|
+
* The program is palette of trainings and preparation trainings
|
|
67
67
|
*/
|
|
68
68
|
programs: Promise<StudentProgramEntity[]>;
|
|
69
69
|
/**
|
|
@@ -82,6 +82,9 @@ export declare class StudentEntity extends TrackableEntity<Student> {
|
|
|
82
82
|
* @returns Promise resolving to Student model
|
|
83
83
|
*/
|
|
84
84
|
toSummary(): Promise<Student>;
|
|
85
|
+
toPerson(): Promise<Person>;
|
|
86
|
+
getUser(): Promise<UserEntity>;
|
|
87
|
+
getProgram(programType: ProgramType, productTypes: ProductType[], categoryId?: number): Promise<StudentProgramEntity>;
|
|
85
88
|
/**
|
|
86
89
|
* Calculates the total balance for this student across all trainings under a specific company (transactions are filtered by type === training)
|
|
87
90
|
* @param company CompanyEntity - The company to filter trainings by
|
|
@@ -118,4 +121,6 @@ export declare class StudentEntity extends TrackableEntity<Student> {
|
|
|
118
121
|
* @returns Array of Preference objects or undefined if not set
|
|
119
122
|
*/
|
|
120
123
|
getPreferences(): Preference<boolean>[];
|
|
124
|
+
setPreference(name: string, value: any, scope: PreferenceScope): Promise<Preference<boolean>[]>;
|
|
125
|
+
removePreference(name: string): Promise<Preference<boolean>[]>;
|
|
121
126
|
}
|
|
@@ -8,22 +8,23 @@ 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 StudentEntity_1;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.StudentEntity = 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 user_entity_1 = require("../../user/user.entity");
|
|
19
|
+
const activity_helper_1 = require("../../utils/activity.helper");
|
|
20
|
+
const trackable_1 = require("../../utils/trackable");
|
|
18
21
|
const licence_entity_1 = require("./program/licence/licence.entity");
|
|
22
|
+
const certificate_entity_1 = require("./program/medical/certificate.entity");
|
|
19
23
|
const examination_entity_1 = require("./program/medical/examination.entity");
|
|
20
24
|
const program_entity_1 = require("./program/program.entity");
|
|
21
|
-
const certificate_entity_1 = require("./program/medical/certificate.entity");
|
|
22
|
-
const trackable_1 = require("../../utils/trackable");
|
|
23
|
-
const activity_helper_1 = require("../../utils/activity.helper");
|
|
24
|
-
const transaction_entity_1 = require("./program/training/transaction.entity");
|
|
25
25
|
const training_entity_1 = require("./program/training/training.entity");
|
|
26
|
-
|
|
26
|
+
const transaction_entity_1 = require("./program/training/transaction.entity");
|
|
27
|
+
let StudentEntity = StudentEntity_1 = class StudentEntity extends trackable_1.TrackableEntity {
|
|
27
28
|
/**
|
|
28
29
|
* Creates an instance of StudentEntity
|
|
29
30
|
* @param props - Partial properties to initialize the entity
|
|
@@ -54,6 +55,34 @@ let StudentEntity = class StudentEntity extends trackable_1.TrackableEntity {
|
|
|
54
55
|
async toSummary() {
|
|
55
56
|
return await this.toModel();
|
|
56
57
|
}
|
|
58
|
+
async toPerson() {
|
|
59
|
+
const user = await this.user;
|
|
60
|
+
return new shared_1.Person({
|
|
61
|
+
id: this.id,
|
|
62
|
+
name: this.name || user.name,
|
|
63
|
+
email: user.email,
|
|
64
|
+
phone: user.phone,
|
|
65
|
+
imageUrl: user.imageUrl,
|
|
66
|
+
image: user.imageUrl, // mvp only
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async getUser() {
|
|
70
|
+
return await this.user;
|
|
71
|
+
}
|
|
72
|
+
async getProgram(programType, productTypes, categoryId) {
|
|
73
|
+
return await program_entity_1.StudentProgramEntity
|
|
74
|
+
.createQueryBuilder('sp')
|
|
75
|
+
.innerJoin('sp.program', 'p')
|
|
76
|
+
.where('sp.studentId = :studentId', { studentId: this.id })
|
|
77
|
+
.andWhere('sp.status = :progressStatus', { progressStatus: shared_1.StatusType.Progress })
|
|
78
|
+
.andWhere('p.type = :programType', { programType: programType })
|
|
79
|
+
.andWhere('(:...products) in p.products', { products: productTypes })
|
|
80
|
+
.andWhere(new typeorm_1.Brackets(qb => {
|
|
81
|
+
qb.where('(p.categoryId is null and :categoryId is null)', { categoryId: categoryId })
|
|
82
|
+
.orWhere('p.categoryId = :categoryId', { categoryId: categoryId });
|
|
83
|
+
}))
|
|
84
|
+
.getOne();
|
|
85
|
+
}
|
|
57
86
|
/**
|
|
58
87
|
* Calculates the total balance for this student across all trainings under a specific company (transactions are filtered by type === training)
|
|
59
88
|
* @param company CompanyEntity - The company to filter trainings by
|
|
@@ -84,7 +113,9 @@ let StudentEntity = class StudentEntity extends trackable_1.TrackableEntity {
|
|
|
84
113
|
.where('cp.companyId = :companyId', { companyId: company.id })
|
|
85
114
|
.andWhere('sp.studentId = :studentId', { studentId: this.id })
|
|
86
115
|
.andWhere('tr.type = :paymentType', { paymentType: shared_1.TransactionType.Payment })
|
|
87
|
-
.
|
|
116
|
+
.andWhere('tr.status != :canceledStatus', { canceledStatus: shared_1.StatusType.Canceled })
|
|
117
|
+
.andWhere('tr.refTransactionId is null')
|
|
118
|
+
.select('SUM(COALESCE(tr.amount, 0))', 'total')
|
|
88
119
|
.getRawOne();
|
|
89
120
|
return Number(result?.total ?? 0);
|
|
90
121
|
}
|
|
@@ -139,7 +170,24 @@ let StudentEntity = class StudentEntity extends trackable_1.TrackableEntity {
|
|
|
139
170
|
getPreferences() {
|
|
140
171
|
if (!this.preferences)
|
|
141
172
|
return;
|
|
142
|
-
return this.preferences.map(
|
|
173
|
+
return this.preferences.map(shared_1.Preference.toInstance);
|
|
174
|
+
}
|
|
175
|
+
async setPreference(name, value, scope) {
|
|
176
|
+
this.preferences = this.preferences || [];
|
|
177
|
+
this.preferences = this.preferences.filter(p => p.name !== name);
|
|
178
|
+
this.preferences.push(new shared_1.Preference({
|
|
179
|
+
scope: scope,
|
|
180
|
+
name: name,
|
|
181
|
+
value: value
|
|
182
|
+
}));
|
|
183
|
+
await StudentEntity_1.save(this);
|
|
184
|
+
return this.preferences;
|
|
185
|
+
}
|
|
186
|
+
async removePreference(name) {
|
|
187
|
+
this.preferences = this.preferences || [];
|
|
188
|
+
this.preferences = this.preferences.filter(p => p.name !== name);
|
|
189
|
+
await StudentEntity_1.save(this);
|
|
190
|
+
return this.preferences;
|
|
143
191
|
}
|
|
144
192
|
};
|
|
145
193
|
exports.StudentEntity = StudentEntity;
|
|
@@ -197,7 +245,7 @@ __decorate([
|
|
|
197
245
|
(0, typeorm_1.OneToMany)(() => program_entity_1.StudentProgramEntity, program => program.student),
|
|
198
246
|
__metadata("design:type", Promise)
|
|
199
247
|
], StudentEntity.prototype, "programs", void 0);
|
|
200
|
-
exports.StudentEntity = StudentEntity = __decorate([
|
|
248
|
+
exports.StudentEntity = StudentEntity = StudentEntity_1 = __decorate([
|
|
201
249
|
(0, typeorm_1.Entity)('students'),
|
|
202
250
|
__metadata("design:paramtypes", [Object])
|
|
203
251
|
], StudentEntity);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"student.entity.js","sourceRoot":"","sources":["../../../src/profile/student/student.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"student.entity.js","sourceRoot":"","sources":["../../../src/profile/student/student.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,4CAAoD;AACpD,4CAA0L;AAC1L,qCAAyE;AAEzE,8DAA0D;AAC1D,wDAAoD;AACpD,iEAAyD;AACzD,qDAAwD;AAExD,qEAAwE;AACxE,6EAAuF;AACvF,6EAAuF;AACvF,6DAAgE;AAChE,wEAA2E;AAC3E,8EAAyF;AAGlF,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,2BAAwB;IA8F1D;;;OAGG;IACH,YAAY,KAA8B;QACzC,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,IAAI,gBAAO,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,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;SACvB,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS;QACd,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,QAAQ;QACb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;QAC7B,OAAO,IAAI,eAAM,CAAC;YACjB,EAAE,EAAE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import { Activity, Campaigne } from '@driveup/common';
|
|
2
|
+
import { Content, Language, ProductType } from '@driveup/shared';
|
|
4
3
|
import { TrackableEntity } from '../../utils/trackable';
|
|
4
|
+
import { CampaignGiftCodeEntity } from './gifcode.entity';
|
|
5
5
|
/**
|
|
6
6
|
* Represents a marketing campaign in the system.
|
|
7
7
|
* Campaigns offer promotional discounts through gift codes that users can redeem.
|
|
@@ -32,7 +32,7 @@ export declare class CampaignEntity extends TrackableEntity<Campaigne> {
|
|
|
32
32
|
/**
|
|
33
33
|
* Campaign expiration date - after this date, codes cannot be redeemed
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
expiryDate: Date;
|
|
36
36
|
/**
|
|
37
37
|
* Gift codes associated with this campaign
|
|
38
38
|
*/
|
|
@@ -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.CampaignEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
15
|
-
const shared_1 = require("@driveup/shared");
|
|
16
13
|
const common_1 = require("@driveup/common");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
14
|
+
const shared_1 = require("@driveup/shared");
|
|
15
|
+
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
16
|
+
const typeorm_1 = require("typeorm");
|
|
20
17
|
const activity_helper_1 = require("../../utils/activity.helper");
|
|
18
|
+
const trackable_1 = require("../../utils/trackable");
|
|
19
|
+
const staff_entity_1 = require("../staff/staff.entity");
|
|
20
|
+
const gifcode_entity_1 = require("./gifcode.entity");
|
|
21
21
|
/**
|
|
22
22
|
* Represents a marketing campaign in the system.
|
|
23
23
|
* Campaigns offer promotional discounts through gift codes that users can redeem.
|
|
@@ -48,7 +48,7 @@ let CampaignEntity = class CampaignEntity extends trackable_1.TrackableEntity {
|
|
|
48
48
|
description: transaltion.description,
|
|
49
49
|
giftAmount: this.giftAmount,
|
|
50
50
|
imageUrl: transaltion.url || this.imageUrl,
|
|
51
|
-
exipryDate: this.
|
|
51
|
+
exipryDate: this.expiryDate,
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
toSummary(lang) {
|
|
@@ -69,7 +69,7 @@ let CampaignEntity = class CampaignEntity extends trackable_1.TrackableEntity {
|
|
|
69
69
|
getTranslation(lang) {
|
|
70
70
|
const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
|
|
71
71
|
const translation = this.translations?.find(t => t.language === language);
|
|
72
|
-
return new
|
|
72
|
+
return new shared_1.Content({
|
|
73
73
|
title: translation?.title,
|
|
74
74
|
description: translation?.description,
|
|
75
75
|
content: translation?.content,
|
|
@@ -82,7 +82,7 @@ let CampaignEntity = class CampaignEntity extends trackable_1.TrackableEntity {
|
|
|
82
82
|
* @returns Array of Content instances for all languages
|
|
83
83
|
*/
|
|
84
84
|
getTranslations() {
|
|
85
|
-
return this.translations?.map(t => new
|
|
85
|
+
return this.translations?.map(t => new shared_1.Content({
|
|
86
86
|
title: t.title,
|
|
87
87
|
description: t.description,
|
|
88
88
|
content: t.content,
|
|
@@ -139,7 +139,7 @@ __decorate([
|
|
|
139
139
|
default: null
|
|
140
140
|
}),
|
|
141
141
|
__metadata("design:type", Date)
|
|
142
|
-
], CampaignEntity.prototype, "
|
|
142
|
+
], CampaignEntity.prototype, "expiryDate", void 0);
|
|
143
143
|
__decorate([
|
|
144
144
|
(0, typeorm_1.OneToMany)(() => gifcode_entity_1.CampaignGiftCodeEntity, giftCode => giftCode.campaign),
|
|
145
145
|
__metadata("design:type", Promise)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"campaign.entity.js","sourceRoot":"","sources":["../../../src/system/campaign/campaign.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"campaign.entity.js","sourceRoot":"","sources":["../../../src/system/campaign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QACP,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,oBAAW;QACjB,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,KAAK;KACf,CAAC;;gDACsB;AAUxB;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;oDACsB;AASxB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;gDACe;AAajB;IAPC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;KACV,CAAC;;kDACiB;AASnB;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;8BACU,IAAI;kDAAC;AAMjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAsB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;;iDAC1B;yBA3DjC,cAAc;IAD1B,IAAA,gBAAM,EAAC,iBAAiB,CAAC;;GACb,cAAc,CA2I1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ProfileType } from '@driveup/shared';
|
|
2
1
|
import { Activity, GiftCode } from '@driveup/common';
|
|
3
|
-
import {
|
|
2
|
+
import { ProfileType } from '@driveup/shared';
|
|
4
3
|
import { TrackableEntity } from '../../utils/trackable';
|
|
4
|
+
import { CampaignEntity } from './campaign.entity';
|
|
5
5
|
/**
|
|
6
6
|
* Campaign gift code entity representing promotional codes for campaigns.
|
|
7
7
|
* Extends TrackableEntity to track creation and update information.
|
|
@@ -22,11 +22,11 @@ export declare class CampaignGiftCodeEntity extends TrackableEntity<GiftCode> {
|
|
|
22
22
|
/**
|
|
23
23
|
* ID of the user who registered/used this gift code
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
registeredBy: number;
|
|
26
26
|
/**
|
|
27
27
|
* Timestamp when this gift code was registered/used
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
registeredOn: Date;
|
|
30
30
|
/**
|
|
31
31
|
* The campaign associated with this gift code
|
|
32
32
|
*/
|
|
@@ -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.CampaignGiftCodeEntity = 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
|
|
18
|
-
const trackable_1 = require("../../utils/trackable");
|
|
14
|
+
const shared_1 = require("@driveup/shared");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
19
16
|
const activity_helper_1 = require("../../utils/activity.helper");
|
|
17
|
+
const trackable_1 = require("../../utils/trackable");
|
|
18
|
+
const staff_entity_1 = require("../staff/staff.entity");
|
|
19
|
+
const campaign_entity_1 = require("./campaign.entity");
|
|
20
20
|
/**
|
|
21
21
|
* Campaign gift code entity representing promotional codes for campaigns.
|
|
22
22
|
* Extends TrackableEntity to track creation and update information.
|
|
@@ -56,7 +56,7 @@ let CampaignGiftCodeEntity = class CampaignGiftCodeEntity extends trackable_1.Tr
|
|
|
56
56
|
async getActivities() {
|
|
57
57
|
const activities = [];
|
|
58
58
|
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_1.ActivityType.created, staff_entity_1.StaffEntity));
|
|
59
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.
|
|
59
|
+
activities.push(await (0, activity_helper_1.toActivity)(this.registeredBy, this.registeredOn, shared_1.ActivityType.registered));
|
|
60
60
|
return activities;
|
|
61
61
|
}
|
|
62
62
|
};
|
|
@@ -85,11 +85,11 @@ __decorate([
|
|
|
85
85
|
__decorate([
|
|
86
86
|
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
87
87
|
__metadata("design:type", Number)
|
|
88
|
-
], CampaignGiftCodeEntity.prototype, "
|
|
88
|
+
], CampaignGiftCodeEntity.prototype, "registeredBy", void 0);
|
|
89
89
|
__decorate([
|
|
90
90
|
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
91
91
|
__metadata("design:type", Date)
|
|
92
|
-
], CampaignGiftCodeEntity.prototype, "
|
|
92
|
+
], CampaignGiftCodeEntity.prototype, "registeredOn", void 0);
|
|
93
93
|
__decorate([
|
|
94
94
|
(0, typeorm_1.ManyToOne)(() => campaign_entity_1.CampaignEntity, campaign => campaign.giftCodes),
|
|
95
95
|
__metadata("design:type", Promise)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gifcode.entity.js","sourceRoot":"","sources":["../../../src/system/campaign/gifcode.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"gifcode.entity.js","sourceRoot":"","sources":["../../../src/system/campaign/gifcode.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAqD;AACrD,4CAA4D;AAC5D,qCAAoD;AAEpD,iEAAyD;AACzD,qDAAwD;AACxD,wDAAoD;AACpD,uDAAmD;AAEnD;;;GAGG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,2BAAyB;IA+CpE;;;OAGG;IACH,YAAY,KAAuC;QAClD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAAO,IAAI,iBAAQ,CAAC;YACnB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC,CAAC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AAC;;GACrB,sBAAsB,CAuFlC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Activity, Country } from '@driveup/common';
|
|
2
|
+
import { Holiday, Language, WorkingHours } from '@driveup/shared';
|
|
3
|
+
import { AddonCountryEntity } from '../../catalog/addon/country.entity';
|
|
4
|
+
import { CountryProductEntity } from '../../catalog/product/country.entity';
|
|
3
5
|
import { CompanyEntity } from '../../profile/company/company.entity';
|
|
4
|
-
import { CurrencyEntity } from '../currency/currency.entity';
|
|
5
6
|
import { UserEntity } from '../../user/user.entity';
|
|
6
|
-
import { CountryProductEntity } from '../../catalog/product/country.entity';
|
|
7
|
-
import { AddonCountryEntity } from '../../catalog/addon/country.entity';
|
|
8
|
-
import { DrivingCategoryEntity } from '../driving/category.entity';
|
|
9
7
|
import { TrackableEntity } from '../../utils/trackable';
|
|
8
|
+
import { CurrencyEntity } from '../currency/currency.entity';
|
|
9
|
+
import { DrivingCategoryEntity } from '../driving/category.entity';
|
|
10
10
|
/**
|
|
11
11
|
* Represents a country in the system.
|
|
12
12
|
* Countries define regional settings including languages, currency, timezones,
|
|
@@ -114,6 +114,8 @@ export declare class CountryEntity extends TrackableEntity<Country> {
|
|
|
114
114
|
* @returns Country model with basic information for listings
|
|
115
115
|
*/
|
|
116
116
|
toSummary(): Country;
|
|
117
|
+
isLanguageSupported(language: Language): boolean;
|
|
118
|
+
isTimezoneSupported(timezone: string): boolean;
|
|
117
119
|
/**
|
|
118
120
|
* Retrieves activity history for this country
|
|
119
121
|
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
@@ -10,18 +10,18 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.CountryEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const shared_1 = require("@driveup/shared");
|
|
15
13
|
const common_1 = require("@driveup/common");
|
|
14
|
+
const shared_1 = require("@driveup/shared");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
const country_entity_1 = require("../../catalog/addon/country.entity");
|
|
17
|
+
const country_entity_2 = require("../../catalog/product/country.entity");
|
|
16
18
|
const company_entity_1 = require("../../profile/company/company.entity");
|
|
17
|
-
const currency_entity_1 = require("../currency/currency.entity");
|
|
18
19
|
const user_entity_1 = require("../../user/user.entity");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
const activity_helper_1 = require("../../utils/activity.helper");
|
|
21
|
+
const trackable_1 = require("../../utils/trackable");
|
|
22
|
+
const currency_entity_1 = require("../currency/currency.entity");
|
|
21
23
|
const category_entity_1 = require("../driving/category.entity");
|
|
22
24
|
const staff_entity_1 = require("../staff/staff.entity");
|
|
23
|
-
const trackable_1 = require("../../utils/trackable");
|
|
24
|
-
const activity_helper_1 = require("../../utils/activity.helper");
|
|
25
25
|
/**
|
|
26
26
|
* Represents a country in the system.
|
|
27
27
|
* Countries define regional settings including languages, currency, timezones,
|
|
@@ -72,6 +72,12 @@ let CountryEntity = class CountryEntity extends trackable_1.TrackableEntity {
|
|
|
72
72
|
active: this.active
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
+
isLanguageSupported(language) {
|
|
76
|
+
return this.languages?.includes(language);
|
|
77
|
+
}
|
|
78
|
+
isTimezoneSupported(timezone) {
|
|
79
|
+
return this.timezones?.includes(timezone);
|
|
80
|
+
}
|
|
75
81
|
/**
|
|
76
82
|
* Retrieves activity history for this country
|
|
77
83
|
* @returns Promise resolving to array of Activity instances tracking creation, updates, and status changes
|
|
@@ -173,11 +179,11 @@ __decorate([
|
|
|
173
179
|
__metadata("design:type", Promise)
|
|
174
180
|
], CountryEntity.prototype, "currency", void 0);
|
|
175
181
|
__decorate([
|
|
176
|
-
(0, typeorm_1.OneToMany)(() =>
|
|
182
|
+
(0, typeorm_1.OneToMany)(() => country_entity_2.CountryProductEntity, product => product.country),
|
|
177
183
|
__metadata("design:type", Promise)
|
|
178
184
|
], CountryEntity.prototype, "products", void 0);
|
|
179
185
|
__decorate([
|
|
180
|
-
(0, typeorm_1.OneToMany)(() =>
|
|
186
|
+
(0, typeorm_1.OneToMany)(() => country_entity_1.AddonCountryEntity, product => product.country),
|
|
181
187
|
__metadata("design:type", Promise)
|
|
182
188
|
], CountryEntity.prototype, "addons", void 0);
|
|
183
189
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country.entity.js","sourceRoot":"","sources":["../../../src/system/country/country.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;
|
|
1
|
+
{"version":3,"file":"country.entity.js","sourceRoot":"","sources":["../../../src/system/country/country.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAoD;AACpD,4CAAgF;AAChF,qCAA+D;AAE/D,uEAAwE;AACxE,yEAA4E;AAC5E,yEAAqE;AACrE,wDAAoD;AACpD,iEAAyD;AACzD,qDAAwD;AACxD,iEAA6D;AAC7D,gEAAmE;AACnE,wDAAoD;AAEpD;;;;;;;GAOG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,2BAAwB;IAuJ1D;;;OAGG;IACH,YAAY,KAA8B;QACzC,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAAO,IAAI,gBAAO,CAAC;YAClB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B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AuNzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Activity, Currency } from '@driveup/common';
|
|
2
|
-
import { CountryEntity } from '../country/country.entity';
|
|
3
2
|
import { TrackableEntity } from '../../utils/trackable';
|
|
3
|
+
import { CountryEntity } from '../country/country.entity';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a currency in the system.
|
|
6
6
|
* Currencies define monetary units used in different countries,
|
|
@@ -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.CurrencyEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const shared_1 = require("@driveup/shared");
|
|
15
13
|
const common_1 = require("@driveup/common");
|
|
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");
|
|
16
18
|
const country_entity_1 = require("../country/country.entity");
|
|
17
19
|
const staff_entity_1 = require("../staff/staff.entity");
|
|
18
|
-
const trackable_1 = require("../../utils/trackable");
|
|
19
|
-
const activity_helper_1 = require("../../utils/activity.helper");
|
|
20
20
|
/**
|
|
21
21
|
* Represents a currency in the system.
|
|
22
22
|
* Currencies define monetary units used in different countries,
|