@driveup/schema 0.2.6 → 0.2.7
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 +5 -5
- package/lib/catalog/addon/addon.entity.js.map +1 -1
- package/lib/catalog/addon/country.entity.d.ts +3 -3
- package/lib/catalog/addon/country.entity.js +5 -5
- package/lib/catalog/addon/country.entity.js.map +1 -1
- package/lib/catalog/priceplan/priceplan.entity.d.ts +2 -2
- package/lib/catalog/priceplan/priceplan.entity.js +4 -4
- package/lib/catalog/priceplan/priceplan.entity.js.map +1 -1
- package/lib/catalog/product/country.entity.d.ts +4 -4
- package/lib/catalog/product/country.entity.js +9 -9
- package/lib/catalog/product/country.entity.js.map +1 -1
- package/lib/catalog/product/priceplan.entity.d.ts +3 -3
- package/lib/catalog/product/priceplan.entity.js +8 -8
- 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 +6 -6
- package/lib/catalog/product/product.entity.js.map +1 -1
- package/lib/catalog/program/program.entity.d.ts +1 -1
- package/lib/catalog/program/program.entity.js +5 -5
- 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 +4 -4
- package/lib/catalog/seed/assets/asset.entity.js.map +1 -1
- package/lib/catalog/seed/courses/course.entity.d.ts +3 -3
- package/lib/catalog/seed/courses/course.entity.js +7 -7
- package/lib/catalog/seed/courses/course.entity.js.map +1 -1
- package/lib/catalog/seed/courses/lesson.entity.d.ts +2 -2
- package/lib/catalog/seed/courses/lesson.entity.js +5 -5
- package/lib/catalog/seed/courses/lesson.entity.js.map +1 -1
- package/lib/catalog/seed/courses/topic.entity.d.ts +2 -2
- package/lib/catalog/seed/courses/topic.entity.js +5 -5
- package/lib/catalog/seed/courses/topic.entity.js.map +1 -1
- package/lib/catalog/seed/expense/category.entity.d.ts +1 -1
- package/lib/catalog/seed/expense/category.entity.js +4 -4
- package/lib/catalog/seed/expense/category.entity.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/profile/agent/agent.entity.d.ts +12 -4
- package/lib/profile/agent/agent.entity.js +30 -6
- 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 +2 -2
- package/lib/profile/agent/payout.entity.js +4 -4
- 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 +39 -8
- package/lib/profile/company/company.entity.js +147 -10
- package/lib/profile/company/company.entity.js.map +1 -1
- package/lib/profile/company/course/course.entity.d.ts +35 -8
- package/lib/profile/company/course/course.entity.js +48 -9
- package/lib/profile/company/course/course.entity.js.map +1 -1
- package/lib/profile/company/course/lesson.entity.d.ts +20 -6
- package/lib/profile/company/course/lesson.entity.js +77 -10
- package/lib/profile/company/course/lesson.entity.js.map +1 -1
- package/lib/profile/company/course/{appointment.entity.d.ts → schedule.entity.d.ts} +78 -8
- package/lib/profile/company/course/{appointment.entity.js → schedule.entity.js} +257 -7
- package/lib/profile/company/course/schedule.entity.js.map +1 -0
- package/lib/profile/company/course/topic.entity.d.ts +6 -2
- package/lib/profile/company/course/topic.entity.js +12 -5
- package/lib/profile/company/course/topic.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/bill.entity.d.ts +3 -3
- package/lib/profile/company/finances/billing/bill.entity.js +5 -5
- package/lib/profile/company/finances/billing/bill.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/item.entity.d.ts +2 -2
- package/lib/profile/company/finances/billing/item.entity.js +5 -5
- package/lib/profile/company/finances/billing/item.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/transaction.entity.d.ts +3 -3
- 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 +7 -6
- package/lib/profile/company/finances/invoice/invoice.entity.js +9 -8
- 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 +10 -4
- package/lib/profile/company/finances/payment/method.entity.js +24 -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 +19 -11
- package/lib/profile/company/instructor/instructor.entity.js +100 -16
- 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 +3 -3
- package/lib/profile/company/medical/examination.entity.js +5 -5
- package/lib/profile/company/medical/examination.entity.js.map +1 -1
- package/lib/profile/company/medical/product.entity.d.ts +4 -4
- package/lib/profile/company/medical/product.entity.js +5 -5
- package/lib/profile/company/medical/product.entity.js.map +1 -1
- package/lib/profile/company/product/addon.entity.d.ts +2 -2
- package/lib/profile/company/product/addon.entity.js +5 -5
- package/lib/profile/company/product/addon.entity.js.map +1 -1
- package/lib/profile/company/product/priceplan.entity.d.ts +4 -3
- package/lib/profile/company/product/priceplan.entity.js +9 -4
- package/lib/profile/company/product/priceplan.entity.js.map +1 -1
- package/lib/profile/company/product/product.entity.d.ts +8 -7
- package/lib/profile/company/product/product.entity.js +19 -9
- 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 +28 -7
- package/lib/profile/instructor/instructor.entity.js.map +1 -1
- package/lib/profile/student/program/licence/licence.entity.d.ts +3 -3
- package/lib/profile/student/program/licence/licence.entity.js +5 -5
- package/lib/profile/student/program/licence/licence.entity.js.map +1 -1
- package/lib/profile/student/program/medical/certificate.entity.d.ts +2 -2
- package/lib/profile/student/program/medical/certificate.entity.js +4 -4
- package/lib/profile/student/program/medical/certificate.entity.js.map +1 -1
- package/lib/profile/student/program/medical/examination.entity.d.ts +3 -3
- package/lib/profile/student/program/medical/examination.entity.js +10 -10
- package/lib/profile/student/program/medical/examination.entity.js.map +1 -1
- package/lib/profile/student/program/program.entity.d.ts +6 -6
- package/lib/profile/student/program/program.entity.js +9 -9
- package/lib/profile/student/program/program.entity.js.map +1 -1
- package/lib/profile/student/program/training/appointment.entity.d.ts +21 -9
- package/lib/profile/student/program/training/appointment.entity.js +109 -12
- package/lib/profile/student/program/training/appointment.entity.js.map +1 -1
- package/lib/profile/student/program/training/exam.entity.d.ts +4 -2
- package/lib/profile/student/program/training/exam.entity.js +12 -4
- package/lib/profile/student/program/training/exam.entity.js.map +1 -1
- package/lib/profile/student/program/training/lesson.entity.d.ts +9 -4
- package/lib/profile/student/program/training/lesson.entity.js +29 -7
- 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 +14 -3
- package/lib/profile/student/program/training/topic.entity.js +29 -5
- package/lib/profile/student/program/training/topic.entity.js.map +1 -1
- package/lib/profile/student/program/training/training.entity.d.ts +49 -6
- package/lib/profile/student/program/training/training.entity.js +190 -7
- 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 +41 -4
- 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 +57 -10
- package/lib/profile/student/student.entity.js.map +1 -1
- package/lib/system/campaign/campaign.entity.d.ts +2 -2
- package/lib/system/campaign/campaign.entity.js +6 -6
- package/lib/system/campaign/campaign.entity.js.map +1 -1
- package/lib/system/campaign/gifcode.entity.d.ts +2 -2
- package/lib/system/campaign/gifcode.entity.js +6 -6
- package/lib/system/campaign/gifcode.entity.js.map +1 -1
- package/lib/system/country/country.entity.d.ts +7 -5
- 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 +12 -12
- 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/policy/policy.entity.d.ts +1 -1
- package/lib/system/policy/policy.entity.js +5 -5
- 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 +3 -3
- package/lib/system/staff/staff.entity.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/user/alert.entity.d.ts +3 -2
- 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 +15 -0
- package/lib/user/device.entity.js +26 -0
- package/lib/user/device.entity.js.map +1 -1
- package/lib/user/notification.entity.d.ts +2 -2
- package/lib/user/notification.entity.js +4 -4
- package/lib/user/notification.entity.js.map +1 -1
- package/lib/user/ticket.entity.d.ts +8 -3
- package/lib/user/ticket.entity.js +11 -4
- package/lib/user/ticket.entity.js.map +1 -1
- package/lib/user/user.entity.d.ts +91 -82
- package/lib/user/user.entity.js +257 -259
- 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 +2 -2
- package/lib/utils/trackable.js.map +1 -1
- package/package.json +2 -2
- package/lib/profile/company/course/appointment.entity.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Activity, AddonUsage, Address, Note, Period, Person, Rating, Student, Training } from '@driveup/common';
|
|
2
|
+
import { CarTransmission, StatusType, TrainingType } from '@driveup/shared';
|
|
3
|
+
import { TrackableEntity } from '../../../../utils/trackable';
|
|
4
|
+
import { CompanyCourseEntity } from '../../../company/course/course.entity';
|
|
3
5
|
import { CompanyInvoiceEntity } from '../../../company/finances/invoice/invoice.entity';
|
|
4
|
-
import { StudentTrainingTransactionEntity } from './transaction.entity';
|
|
5
6
|
import { CompanyInstructorEntity } from '../../../company/instructor/instructor.entity';
|
|
6
|
-
import { CompanyCourseEntity } from '../../../company/course/course.entity';
|
|
7
7
|
import { StudentProgramEntity } from '../program.entity';
|
|
8
|
-
import { StudentTrainingLessonEntity } from './lesson.entity';
|
|
9
8
|
import { StudentTrainingAppointmentEntity } from './appointment.entity';
|
|
10
|
-
import {
|
|
9
|
+
import { StudentTrainingLessonEntity } from './lesson.entity';
|
|
10
|
+
import { StudentTrainingTransactionEntity } from './transaction.entity';
|
|
11
11
|
export declare class StudentTrainingEntity extends TrackableEntity<Training> {
|
|
12
12
|
/**
|
|
13
13
|
* Student program
|
|
@@ -100,6 +100,14 @@ export declare class StudentTrainingEntity extends TrackableEntity<Training> {
|
|
|
100
100
|
* Ratings and reviews given by the student for this training
|
|
101
101
|
*/
|
|
102
102
|
ratings: Rating[];
|
|
103
|
+
/**
|
|
104
|
+
* When student terminates a training they can submit a description
|
|
105
|
+
*/
|
|
106
|
+
terminationNote: Note;
|
|
107
|
+
/**
|
|
108
|
+
* Wether or not the student can manage appointments in the calendar
|
|
109
|
+
*/
|
|
110
|
+
calendarEnabled: boolean;
|
|
103
111
|
/**
|
|
104
112
|
* List of addons used in the training
|
|
105
113
|
*/
|
|
@@ -199,5 +207,40 @@ export declare class StudentTrainingEntity extends TrackableEntity<Training> {
|
|
|
199
207
|
* @returns The sum of prices of all the appointments in this training, or 0 by default if no sum is found
|
|
200
208
|
*/
|
|
201
209
|
getTotalSessionFee(): Promise<number>;
|
|
210
|
+
/**
|
|
211
|
+
* @returns TrainingType - type of the training
|
|
212
|
+
*/
|
|
213
|
+
getTrainingType(): Promise<TrainingType>;
|
|
214
|
+
getTotalTopics(): Promise<number>;
|
|
215
|
+
getTotalCompletedTopics(): Promise<number>;
|
|
216
|
+
/**
|
|
217
|
+
* @returns StudentTrainingAppointmentEntity - The next upcoming appointment which is not canceled, or null if nothing is found
|
|
218
|
+
*/
|
|
219
|
+
getNextAppointment(): Promise<StudentTrainingAppointmentEntity>;
|
|
220
|
+
/**
|
|
221
|
+
* @returns The number of remaining (not yet occurred), not canceled appointments in this training, or 0 if there are no remaining appointments
|
|
222
|
+
*/
|
|
223
|
+
getRemainingAppointments(): Promise<number>;
|
|
224
|
+
/**
|
|
225
|
+
* Gets total number of appointments related to this training (canceled and not canceled)
|
|
226
|
+
*/
|
|
227
|
+
getTotalAppointments(): Promise<number>;
|
|
228
|
+
/**
|
|
229
|
+
* Check if a not canceled appointment exists that overlaps with the given period
|
|
230
|
+
* @param period Period - period to check for overlapping appointments
|
|
231
|
+
* @param appointment StudentTrainingAppointmentEntity - an optional appointment to exclude from the check (useful when updating an appointment)
|
|
232
|
+
* @returns boolean - true if an overlapping appointment exists, false otherwise
|
|
233
|
+
*/
|
|
234
|
+
appointmentExistsInPeriod(period: Period, appointment?: StudentTrainingAppointmentEntity): Promise<boolean>;
|
|
235
|
+
/**
|
|
236
|
+
* If the training is not in-progress, estimation isn't calculated
|
|
237
|
+
* If the number of previous appointments is less than 10, estimation isn't calculated
|
|
238
|
+
* If there are no completed topics, estimation isn't calculated
|
|
239
|
+
* @returns An estimated date for the exam based on the student's progress so far, or null if estimation can't be calculated
|
|
240
|
+
*/
|
|
241
|
+
getEstimatedExamDate(): Promise<Date>;
|
|
242
|
+
getTotalParts(): Promise<number>;
|
|
202
243
|
getActivities(): Promise<Activity[]>;
|
|
244
|
+
getCreatedBy(): Promise<CompanyInstructorEntity>;
|
|
245
|
+
getArchivedBy(): Promise<CompanyInstructorEntity>;
|
|
203
246
|
}
|
|
@@ -10,18 +10,20 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.StudentTrainingEntity = 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 luxon_1 = require("luxon");
|
|
16
|
+
const typeorm_1 = require("typeorm");
|
|
17
|
+
const activity_helper_1 = require("../../../../utils/activity.helper");
|
|
18
|
+
const trackable_1 = require("../../../../utils/trackable");
|
|
19
|
+
const course_entity_1 = require("../../../company/course/course.entity");
|
|
16
20
|
const invoice_entity_1 = require("../../../company/finances/invoice/invoice.entity");
|
|
17
|
-
const transaction_entity_1 = require("./transaction.entity");
|
|
18
21
|
const instructor_entity_1 = require("../../../company/instructor/instructor.entity");
|
|
19
|
-
const course_entity_1 = require("../../../company/course/course.entity");
|
|
20
22
|
const program_entity_1 = require("../program.entity");
|
|
21
|
-
const lesson_entity_1 = require("./lesson.entity");
|
|
22
23
|
const appointment_entity_1 = require("./appointment.entity");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
24
|
+
const lesson_entity_1 = require("./lesson.entity");
|
|
25
|
+
const topic_entity_1 = require("./topic.entity");
|
|
26
|
+
const transaction_entity_1 = require("./transaction.entity");
|
|
25
27
|
let StudentTrainingEntity = class StudentTrainingEntity extends trackable_1.TrackableEntity {
|
|
26
28
|
constructor(props) {
|
|
27
29
|
super();
|
|
@@ -171,6 +173,9 @@ let StudentTrainingEntity = class StudentTrainingEntity extends trackable_1.Trac
|
|
|
171
173
|
async getCanceledTransactions() {
|
|
172
174
|
const total = await transaction_entity_1.StudentTrainingTransactionEntity.sum('amount', {
|
|
173
175
|
trainingId: this.id,
|
|
176
|
+
// TODO: ask admir about this. a cancelation item has type = TransactionType.Cancelation AND status = StatusType.Canceled
|
|
177
|
+
// therefore the bellow condition is never met
|
|
178
|
+
// or perhaps I'm wrong about my point
|
|
174
179
|
type: shared_1.TransactionType.Cancelation,
|
|
175
180
|
status: (0, typeorm_1.Not)(shared_1.StatusType.Canceled),
|
|
176
181
|
});
|
|
@@ -185,6 +190,148 @@ let StudentTrainingEntity = class StudentTrainingEntity extends trackable_1.Trac
|
|
|
185
190
|
});
|
|
186
191
|
return total || 0;
|
|
187
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* @returns TrainingType - type of the training
|
|
195
|
+
*/
|
|
196
|
+
async getTrainingType() {
|
|
197
|
+
const product = await this.getProduct();
|
|
198
|
+
const trainingType = product.catalogType === shared_1.CatalogType.Driving ? shared_1.TrainingType.Driving : shared_1.TrainingType.Course;
|
|
199
|
+
return trainingType;
|
|
200
|
+
}
|
|
201
|
+
async getTotalTopics() {
|
|
202
|
+
const total = await topic_entity_1.StudentTrainingTopicEntity.createQueryBuilder('t')
|
|
203
|
+
.innerJoin('t.lesson', 'l')
|
|
204
|
+
.where('l.trainingId = :trainingId', { trainingId: this.id })
|
|
205
|
+
.getCount();
|
|
206
|
+
return total || 0;
|
|
207
|
+
}
|
|
208
|
+
async getTotalCompletedTopics() {
|
|
209
|
+
const total = await topic_entity_1.StudentTrainingTopicEntity.createQueryBuilder('t')
|
|
210
|
+
.innerJoin('t.lesson', 'l')
|
|
211
|
+
.where('l.trainingId = :trainingId', { trainingId: this.id })
|
|
212
|
+
.andWhere('t.done = :true', { true: true })
|
|
213
|
+
.getCount();
|
|
214
|
+
return total || 0;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @returns StudentTrainingAppointmentEntity - The next upcoming appointment which is not canceled, or null if nothing is found
|
|
218
|
+
*/
|
|
219
|
+
async getNextAppointment() {
|
|
220
|
+
const appointment = await appointment_entity_1.StudentTrainingAppointmentEntity.findOne({
|
|
221
|
+
where: {
|
|
222
|
+
trainingId: this.id,
|
|
223
|
+
startDate: (0, typeorm_1.MoreThanOrEqual)(luxon_1.DateTime.now().toJSDate()),
|
|
224
|
+
status: (0, typeorm_1.Not)(shared_1.StatusType.Canceled)
|
|
225
|
+
},
|
|
226
|
+
order: { startDate: 'ASC' }
|
|
227
|
+
});
|
|
228
|
+
return appointment || null;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @returns The number of remaining (not yet occurred), not canceled appointments in this training, or 0 if there are no remaining appointments
|
|
232
|
+
*/
|
|
233
|
+
async getRemainingAppointments() {
|
|
234
|
+
const total = await appointment_entity_1.StudentTrainingAppointmentEntity.countBy({
|
|
235
|
+
trainingId: this.id,
|
|
236
|
+
startDate: (0, typeorm_1.MoreThanOrEqual)(luxon_1.DateTime.now().toJSDate()),
|
|
237
|
+
status: (0, typeorm_1.Not)(shared_1.StatusType.Canceled)
|
|
238
|
+
});
|
|
239
|
+
return total || 0;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Gets total number of appointments related to this training (canceled and not canceled)
|
|
243
|
+
*/
|
|
244
|
+
async getTotalAppointments() {
|
|
245
|
+
const total = await appointment_entity_1.StudentTrainingAppointmentEntity.countBy({
|
|
246
|
+
trainingId: this.id
|
|
247
|
+
});
|
|
248
|
+
return total || 0;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Check if a not canceled appointment exists that overlaps with the given period
|
|
252
|
+
* @param period Period - period to check for overlapping appointments
|
|
253
|
+
* @param appointment StudentTrainingAppointmentEntity - an optional appointment to exclude from the check (useful when updating an appointment)
|
|
254
|
+
* @returns boolean - true if an overlapping appointment exists, false otherwise
|
|
255
|
+
*/
|
|
256
|
+
async appointmentExistsInPeriod(period, appointment) {
|
|
257
|
+
const query = appointment_entity_1.StudentTrainingAppointmentEntity
|
|
258
|
+
.createQueryBuilder('a')
|
|
259
|
+
.where('a.trainingId = :trainingId', { trainingId: this.id })
|
|
260
|
+
.andWhere('a.status != :canceledStatus', { canceledStatus: shared_1.StatusType.Canceled })
|
|
261
|
+
.andWhere(`
|
|
262
|
+
a.startDate < :endDate
|
|
263
|
+
AND
|
|
264
|
+
(
|
|
265
|
+
(a.endDate IS NULL AND DATE_ADD(a.startDate, INTERVAL a.duration MINUTE) > :startDate) OR
|
|
266
|
+
(a.endDate IS NOT NULL AND a.endDate > :startDate)
|
|
267
|
+
)
|
|
268
|
+
`, { endDate: period.endDate, startDate: period.startDate });
|
|
269
|
+
if (appointment) {
|
|
270
|
+
query.andWhere('a.id != :appointmentId', { appointmentId: appointment.id });
|
|
271
|
+
}
|
|
272
|
+
return await query.getExists();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* If the training is not in-progress, estimation isn't calculated
|
|
276
|
+
* If the number of previous appointments is less than 10, estimation isn't calculated
|
|
277
|
+
* If there are no completed topics, estimation isn't calculated
|
|
278
|
+
* @returns An estimated date for the exam based on the student's progress so far, or null if estimation can't be calculated
|
|
279
|
+
*/
|
|
280
|
+
async getEstimatedExamDate() {
|
|
281
|
+
// If the training is not in-progress, estimation isn't calculated
|
|
282
|
+
if (this.status !== shared_1.StatusType.Progress)
|
|
283
|
+
return null;
|
|
284
|
+
// If the training has had less than 10 appointments, estimation isn't calculated
|
|
285
|
+
const totalPreviousAppointments = await appointment_entity_1.StudentTrainingAppointmentEntity.countBy({
|
|
286
|
+
trainingId: this.id,
|
|
287
|
+
startDate: (0, typeorm_1.LessThanOrEqual)(luxon_1.DateTime.now().toJSDate()),
|
|
288
|
+
status: (0, typeorm_1.Not)(shared_1.StatusType.Canceled),
|
|
289
|
+
isExam: false
|
|
290
|
+
});
|
|
291
|
+
if (totalPreviousAppointments < 10)
|
|
292
|
+
return null;
|
|
293
|
+
const firstAppointment = await appointment_entity_1.StudentTrainingAppointmentEntity.findOne({
|
|
294
|
+
order: { startDate: 'ASC' },
|
|
295
|
+
where: { trainingId: this.id, status: (0, typeorm_1.Not)(shared_1.StatusType.Canceled), isExam: false }
|
|
296
|
+
});
|
|
297
|
+
const latestAppointment = await appointment_entity_1.StudentTrainingAppointmentEntity.findOne({
|
|
298
|
+
order: { startDate: 'DESC' },
|
|
299
|
+
where: {
|
|
300
|
+
trainingId: this.id,
|
|
301
|
+
startDate: (0, typeorm_1.LessThanOrEqual)(luxon_1.DateTime.now().toJSDate()),
|
|
302
|
+
status: (0, typeorm_1.Not)(shared_1.StatusType.Canceled),
|
|
303
|
+
isExam: false
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
if (!latestAppointment)
|
|
307
|
+
return null;
|
|
308
|
+
const daysBetween = luxon_1.DateTime.fromJSDate(latestAppointment.startDate).diff(luxon_1.DateTime.fromJSDate(firstAppointment.startDate), 'days').days;
|
|
309
|
+
if (daysBetween <= 0)
|
|
310
|
+
return null;
|
|
311
|
+
const now = luxon_1.DateTime.now();
|
|
312
|
+
const totalTopics = await this.getTotalTopics();
|
|
313
|
+
const completedTopics = await this.getTotalCompletedTopics();
|
|
314
|
+
const remainingTopics = totalTopics - completedTopics;
|
|
315
|
+
if (!completedTopics)
|
|
316
|
+
return null;
|
|
317
|
+
if (!remainingTopics) {
|
|
318
|
+
return now.toJSDate();
|
|
319
|
+
}
|
|
320
|
+
// (number of days between first and latest appointment / number of completed topics) * number of remaining topics
|
|
321
|
+
const remainingDays = (daysBetween / completedTopics) * remainingTopics;
|
|
322
|
+
return now.plus({ days: remainingDays }).toJSDate();
|
|
323
|
+
// TODO: in the future consider the appointments created for the future as well
|
|
324
|
+
}
|
|
325
|
+
async getTotalParts() {
|
|
326
|
+
const trainingType = await this.getTrainingType();
|
|
327
|
+
if (trainingType !== shared_1.TrainingType.Course) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
return await lesson_entity_1.StudentTrainingLessonEntity.countBy({
|
|
331
|
+
trainingId: this.id,
|
|
332
|
+
canceledOn: (0, typeorm_1.IsNull)()
|
|
333
|
+
});
|
|
334
|
+
}
|
|
188
335
|
async getActivities() {
|
|
189
336
|
const activities = [];
|
|
190
337
|
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, this.createdOn, shared_1.ActivityType.created));
|
|
@@ -193,6 +340,27 @@ let StudentTrainingEntity = class StudentTrainingEntity extends trackable_1.Trac
|
|
|
193
340
|
activities.push(await (0, activity_helper_1.toActivity)(this.terminatedBy, this.terminatedOn, shared_1.ActivityType.terminated));
|
|
194
341
|
return activities.filter(a => a);
|
|
195
342
|
}
|
|
343
|
+
async getCreatedBy() {
|
|
344
|
+
if (!this.createdBy)
|
|
345
|
+
return null;
|
|
346
|
+
const company = await this.getCompany();
|
|
347
|
+
return await instructor_entity_1.CompanyInstructorEntity.createQueryBuilder('ci')
|
|
348
|
+
.innerJoin('ci.instructor', 'i') // instructor profile
|
|
349
|
+
.where('i.userId = :userId', { userId: this.createdBy })
|
|
350
|
+
.andWhere('ci.companyId = :companyId', { companyId: company.id })
|
|
351
|
+
.getOne();
|
|
352
|
+
}
|
|
353
|
+
async getArchivedBy() {
|
|
354
|
+
const archivedById = this.completedBy || this.terminatedBy;
|
|
355
|
+
if (!archivedById)
|
|
356
|
+
return null;
|
|
357
|
+
const company = await this.getCompany();
|
|
358
|
+
return await instructor_entity_1.CompanyInstructorEntity.createQueryBuilder('ci')
|
|
359
|
+
.innerJoin('ci.instructor', 'i') // instructor profile
|
|
360
|
+
.where('i.userId = :userId', { userId: archivedById })
|
|
361
|
+
.andWhere('ci.companyId = :companyId', { companyId: company.id })
|
|
362
|
+
.getOne();
|
|
363
|
+
}
|
|
196
364
|
};
|
|
197
365
|
exports.StudentTrainingEntity = StudentTrainingEntity;
|
|
198
366
|
__decorate([
|
|
@@ -350,6 +518,21 @@ __decorate([
|
|
|
350
518
|
}),
|
|
351
519
|
__metadata("design:type", Array)
|
|
352
520
|
], StudentTrainingEntity.prototype, "ratings", void 0);
|
|
521
|
+
__decorate([
|
|
522
|
+
(0, typeorm_1.Column)({
|
|
523
|
+
type: 'simple-json',
|
|
524
|
+
nullable: true,
|
|
525
|
+
default: null
|
|
526
|
+
}),
|
|
527
|
+
__metadata("design:type", common_1.Note)
|
|
528
|
+
], StudentTrainingEntity.prototype, "terminationNote", void 0);
|
|
529
|
+
__decorate([
|
|
530
|
+
(0, typeorm_1.Column)({
|
|
531
|
+
nullable: false,
|
|
532
|
+
default: true
|
|
533
|
+
}),
|
|
534
|
+
__metadata("design:type", Boolean)
|
|
535
|
+
], StudentTrainingEntity.prototype, "calendarEnabled", void 0);
|
|
353
536
|
__decorate([
|
|
354
537
|
(0, typeorm_1.Column)({
|
|
355
538
|
type: 'simple-json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"training.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/training.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAsF;AACtF,4CAA4G;AAC5G,4CAAyG;AACzG,qFAAwF;AACxF,6DAAwE;AACxE,qFAAwF;AACxF,yEAA4E;AAC5E,sDAAyD;AACzD,mDAA8D;AAC9D,6DAAwE;AACxE,2DAA8D;AAC9D,uEAA+D;AAGxD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2BAAyB;IA6RnE,YAAY,KAAsC;QACjD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1F,OAAO,IAAI,iBAAQ,CAAC;YACnB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,UAAU;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,MA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C,QAAQ,CAAC,QAAQ,CAAC;;qDAC/B;AAMrC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2CAAuB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;;yDACnC;AAM7C;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,2CAA2B,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;;sDACvB;AAMhD;IADC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,qDAAgC,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;;2DAClB;AAM1D;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qDAAgC,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;2DACrB;AAM1D;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qCAAoB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;;uDACzB;gCA3R9B,qBAAqB;IADjC,IAAA,gBAAM,EAAC,kBAAkB,CAAC;;GACd,qBAAqB,CA6djC"}
|
|
1
|
+
{"version":3,"file":"training.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/training.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAiH;AACjH,4CAAqI;AACrI,iCAAiC;AACjC,qCAAwH;AAExH,uEAA+D;AAC/D,2DAA8D;AAC9D,yEAA4E;AAC5E,qFAAwF;AACxF,qFAAwF;AACxF,sDAAyD;AACzD,6DAAwE;AACxE,mDAA8D;AAC9D,iDAA4D;AAC5D,6DAAwE;AAGjE,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2BAAyB;IAgTnE,YAAY,KAAsC;QACjD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAA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action } from '@driveup/common';
|
|
2
|
+
import { 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.
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/transaction.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"transaction.entity.js","sourceRoot":"","sources":["../../../../../src/profile/student/program/training/transaction.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,4CAAqE;AACrE,4CAAyF;AACzF,qCAA0E;AAE1E,uEAA+D;AAC/D,2DAA8D;AAC9D,qFAAwF;AACxF,qFAAwF;AACxF,uDAA0D;AAE1D;;;;GAIG;AAEI,IAAM,gCAAgC,wCAAtC,MAAM,gC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,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 {
|
|
1
|
+
import { Activity, Person, Preference, Student } from '@driveup/common';
|
|
2
|
+
import { AccountStatus, Language, 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,33 @@ 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 common_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
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async getUser() {
|
|
69
|
+
return await this.user;
|
|
70
|
+
}
|
|
71
|
+
async getProgram(programType, productTypes, categoryId) {
|
|
72
|
+
return await program_entity_1.StudentProgramEntity
|
|
73
|
+
.createQueryBuilder('sp')
|
|
74
|
+
.innerJoin('sp.program', 'p')
|
|
75
|
+
.where('sp.studentId = :studentId', { studentId: this.id })
|
|
76
|
+
.andWhere('sp.status = :progressStatus', { progressStatus: shared_1.StatusType.Progress })
|
|
77
|
+
.andWhere('p.type = :programType', { programType: programType })
|
|
78
|
+
.andWhere('(:...products) in p.products', { products: productTypes })
|
|
79
|
+
.andWhere(new typeorm_1.Brackets(qb => {
|
|
80
|
+
qb.where('(p.categoryId is null and :categoryId is null)', { categoryId: categoryId })
|
|
81
|
+
.orWhere('p.categoryId = :categoryId', { categoryId: categoryId });
|
|
82
|
+
}))
|
|
83
|
+
.getOne();
|
|
84
|
+
}
|
|
57
85
|
/**
|
|
58
86
|
* Calculates the total balance for this student across all trainings under a specific company (transactions are filtered by type === training)
|
|
59
87
|
* @param company CompanyEntity - The company to filter trainings by
|
|
@@ -84,7 +112,9 @@ let StudentEntity = class StudentEntity extends trackable_1.TrackableEntity {
|
|
|
84
112
|
.where('cp.companyId = :companyId', { companyId: company.id })
|
|
85
113
|
.andWhere('sp.studentId = :studentId', { studentId: this.id })
|
|
86
114
|
.andWhere('tr.type = :paymentType', { paymentType: shared_1.TransactionType.Payment })
|
|
87
|
-
.
|
|
115
|
+
.andWhere('tr.status != :canceledStatus', { canceledStatus: shared_1.StatusType.Canceled })
|
|
116
|
+
.andWhere('tr.refTransactionId is null')
|
|
117
|
+
.select('SUM(COALESCE(tr.amount, 0))', 'total')
|
|
88
118
|
.getRawOne();
|
|
89
119
|
return Number(result?.total ?? 0);
|
|
90
120
|
}
|
|
@@ -141,6 +171,23 @@ let StudentEntity = class StudentEntity extends trackable_1.TrackableEntity {
|
|
|
141
171
|
return;
|
|
142
172
|
return this.preferences.map(common_1.Preference.toInstance);
|
|
143
173
|
}
|
|
174
|
+
async setPreference(name, value, scope) {
|
|
175
|
+
this.preferences = this.preferences || [];
|
|
176
|
+
this.preferences = this.preferences.filter(p => p.name !== name);
|
|
177
|
+
this.preferences.push(new common_1.Preference({
|
|
178
|
+
scope: scope,
|
|
179
|
+
name: name,
|
|
180
|
+
value: value
|
|
181
|
+
}));
|
|
182
|
+
await StudentEntity_1.save(this);
|
|
183
|
+
return this.preferences;
|
|
184
|
+
}
|
|
185
|
+
async removePreference(name) {
|
|
186
|
+
this.preferences = this.preferences || [];
|
|
187
|
+
this.preferences = this.preferences.filter(p => p.name !== name);
|
|
188
|
+
await StudentEntity_1.save(this);
|
|
189
|
+
return this.preferences;
|
|
190
|
+
}
|
|
144
191
|
};
|
|
145
192
|
exports.StudentEntity = StudentEntity;
|
|
146
193
|
__decorate([
|
|
@@ -197,7 +244,7 @@ __decorate([
|
|
|
197
244
|
(0, typeorm_1.OneToMany)(() => program_entity_1.StudentProgramEntity, program => program.student),
|
|
198
245
|
__metadata("design:type", Promise)
|
|
199
246
|
], StudentEntity.prototype, "programs", void 0);
|
|
200
|
-
exports.StudentEntity = StudentEntity = __decorate([
|
|
247
|
+
exports.StudentEntity = StudentEntity = StudentEntity_1 = __decorate([
|
|
201
248
|
(0, typeorm_1.Entity)('students'),
|
|
202
249
|
__metadata("design:paramtypes", [Object])
|
|
203
250
|
], StudentEntity);
|