docta-package 1.2.58 → 1.2.60
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/build/dto/output/doctor.js +3 -3
- package/build/dto/output/expertise.js +2 -1
- package/build/dto/output/patient.js +2 -1
- package/build/dto/output/session.d.ts +3 -1
- package/build/dto/output/session.js +2 -0
- package/build/dto/output/specialty.js +2 -1
- package/build/dto/output/user.js +2 -1
- package/build/models/period.d.ts +0 -8
- package/build/models/period.js +0 -47
- package/build/models/session.d.ts +2 -0
- package/build/models/session.js +5 -0
- package/package.json +1 -1
|
@@ -12,15 +12,15 @@ const location_1 = require("./location");
|
|
|
12
12
|
// Base DTO for everyone
|
|
13
13
|
class DoctorOutputDto {
|
|
14
14
|
constructor(doctor) {
|
|
15
|
-
var _a;
|
|
16
|
-
this.id = doctor.id.toString();
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
this.id = (_b = ((_a = doctor.id) !== null && _a !== void 0 ? _a : doctor._id)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
17
17
|
this.user = new user_1.UserOutputDto(doctor.user);
|
|
18
18
|
this.name = doctor.name;
|
|
19
19
|
this.specialty = new specialty_1.SpecialtyOutputDto(doctor.specialty);
|
|
20
20
|
this.slug = doctor.slug;
|
|
21
21
|
this.biography = doctor.biography || null;
|
|
22
22
|
this.isActive = doctor.isActive;
|
|
23
|
-
this.consultationFeePerHour = (
|
|
23
|
+
this.consultationFeePerHour = (_c = doctor.consultationFeePerHour) !== null && _c !== void 0 ? _c : null;
|
|
24
24
|
this.isVerified = doctor.isVerified;
|
|
25
25
|
this.isVisible = doctor.isVisible;
|
|
26
26
|
this.photo = doctor.photo || null;
|
|
@@ -5,7 +5,8 @@ const user_1 = require("./user");
|
|
|
5
5
|
// Base DTO for everyone
|
|
6
6
|
class ExpertiseOutputDto {
|
|
7
7
|
constructor(expertise) {
|
|
8
|
-
|
|
8
|
+
var _a, _b;
|
|
9
|
+
this.id = (_b = ((_a = expertise.id) !== null && _a !== void 0 ? _a : expertise._id)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
9
10
|
this.en = {
|
|
10
11
|
name: expertise.en.name,
|
|
11
12
|
description: expertise.en.description || null,
|
|
@@ -5,7 +5,8 @@ const user_1 = require("./user");
|
|
|
5
5
|
// Base DTO for everyone
|
|
6
6
|
class PatientOutputDto {
|
|
7
7
|
constructor(patient) {
|
|
8
|
-
|
|
8
|
+
var _a, _b;
|
|
9
|
+
this.id = (_b = ((_a = patient.id) !== null && _a !== void 0 ? _a : patient._id)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
9
10
|
this.user = new user_1.UserOutputDto(patient.user);
|
|
10
11
|
this.dob = patient.dob || null;
|
|
11
12
|
this.phoneNumber = patient.phoneNumber || null;
|
|
@@ -2,6 +2,7 @@ import { ISessionDocument } from "../../models";
|
|
|
2
2
|
import { PeriodOutputDto } from "./period";
|
|
3
3
|
import { PatientOutputDto } from "./patient";
|
|
4
4
|
import { UserOutputDto } from "./user";
|
|
5
|
+
import { DoctorOutputDto } from "./doctor";
|
|
5
6
|
interface ISessionConfigOutput {
|
|
6
7
|
originalDoctorConsultationFeePerHour: number;
|
|
7
8
|
platformPercentage: number;
|
|
@@ -18,6 +19,7 @@ export declare class SessionOutputDto {
|
|
|
18
19
|
constructor(session: ISessionDocument);
|
|
19
20
|
}
|
|
20
21
|
export declare class SessionPatientOutputDto extends SessionOutputDto {
|
|
22
|
+
doctor: DoctorOutputDto;
|
|
21
23
|
pricing: {
|
|
22
24
|
totalPrice: number;
|
|
23
25
|
paymentApiPrice: number;
|
|
@@ -25,8 +27,8 @@ export declare class SessionPatientOutputDto extends SessionOutputDto {
|
|
|
25
27
|
constructor(session: ISessionDocument);
|
|
26
28
|
}
|
|
27
29
|
export declare class SessionDoctorOutputDto extends SessionOutputDto {
|
|
28
|
-
price: number;
|
|
29
30
|
patient: PatientOutputDto;
|
|
31
|
+
price: number;
|
|
30
32
|
constructor(session: ISessionDocument);
|
|
31
33
|
}
|
|
32
34
|
export declare class SessionAdminOutputDto extends SessionOutputDto {
|
|
@@ -4,6 +4,7 @@ exports.SessionAdminOutputDto = exports.SessionDoctorOutputDto = exports.Session
|
|
|
4
4
|
const period_1 = require("./period");
|
|
5
5
|
const patient_1 = require("./patient");
|
|
6
6
|
const user_1 = require("./user");
|
|
7
|
+
const doctor_1 = require("./doctor");
|
|
7
8
|
// Base DTO for everyone
|
|
8
9
|
class SessionOutputDto {
|
|
9
10
|
constructor(session) {
|
|
@@ -21,6 +22,7 @@ exports.SessionOutputDto = SessionOutputDto;
|
|
|
21
22
|
class SessionPatientOutputDto extends SessionOutputDto {
|
|
22
23
|
constructor(session) {
|
|
23
24
|
super(session); // call base constructor
|
|
25
|
+
this.doctor = new doctor_1.DoctorOutputDto(session.doctor);
|
|
24
26
|
this.pricing = {
|
|
25
27
|
totalPrice: session.pricing.totalPrice,
|
|
26
28
|
paymentApiPrice: session.pricing.paymentApiPrice,
|
|
@@ -5,7 +5,8 @@ const user_1 = require("./user");
|
|
|
5
5
|
// Base DTO for everyone
|
|
6
6
|
class SpecialtyOutputDto {
|
|
7
7
|
constructor(specialty) {
|
|
8
|
-
|
|
8
|
+
var _a, _b;
|
|
9
|
+
this.id = (_b = ((_a = specialty.id) !== null && _a !== void 0 ? _a : specialty._id)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
9
10
|
this.en = {
|
|
10
11
|
name: specialty.en.name,
|
|
11
12
|
description: specialty.en.description || null,
|
package/build/dto/output/user.js
CHANGED
|
@@ -4,7 +4,8 @@ exports.LoggedInUserOutputDto = exports.UserAdminOutputDto = exports.UserOutputD
|
|
|
4
4
|
// Base DTO for everyone
|
|
5
5
|
class UserOutputDto {
|
|
6
6
|
constructor(user) {
|
|
7
|
-
|
|
7
|
+
var _a, _b;
|
|
8
|
+
this.id = (_b = ((_a = user.id) !== null && _a !== void 0 ? _a : user._id)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
8
9
|
this.name = user.name;
|
|
9
10
|
this.email = user.email;
|
|
10
11
|
this.role = user.role;
|
package/build/models/period.d.ts
CHANGED
|
@@ -13,11 +13,3 @@ export interface IPeriodDocument extends IPeriod, Document {
|
|
|
13
13
|
export interface IPeriodModel extends Model<IPeriodDocument> {
|
|
14
14
|
}
|
|
15
15
|
export declare const PeriodModel: IPeriodModel;
|
|
16
|
-
/**
|
|
17
|
-
* Validates that the difference between startTime and endTime
|
|
18
|
-
* is one of [15, 30, 60, 90, 120] minutes and startTime < endTime.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Checks if a given period overlaps with any existing period for a doctor.
|
|
22
|
-
* Returns true if overlap exists, false otherwise.
|
|
23
|
-
*/
|
package/build/models/period.js
CHANGED
|
@@ -17,50 +17,3 @@ const PeriodSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base_
|
|
|
17
17
|
} }));
|
|
18
18
|
PeriodSchema.plugin(base_1.BaseSchemaPlugin);
|
|
19
19
|
exports.PeriodModel = (0, mongoose_1.model)("Period", PeriodSchema);
|
|
20
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
21
|
-
/**
|
|
22
|
-
* Validates that the difference between startTime and endTime
|
|
23
|
-
* is one of [15, 30, 60, 90, 120] minutes and startTime < endTime.
|
|
24
|
-
*/
|
|
25
|
-
// function isValidTimeGap(startTime: number, endTime: number): boolean {
|
|
26
|
-
// // Ensure startTime < endTime
|
|
27
|
-
// if (endTime <= startTime) return false;
|
|
28
|
-
// // Allowed gaps in minutes
|
|
29
|
-
// const allowedGaps = [15, 30, 60, 90, 120];
|
|
30
|
-
// // Convert milliseconds to minutes
|
|
31
|
-
// const diffInMinutes = (endTime - startTime) / (1000 * 60);
|
|
32
|
-
// // Check if difference matches any allowed gap
|
|
33
|
-
// return allowedGaps.includes(diffInMinutes);
|
|
34
|
-
// }
|
|
35
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
36
|
-
/**
|
|
37
|
-
* Checks if a given period overlaps with any existing period for a doctor.
|
|
38
|
-
* Returns true if overlap exists, false otherwise.
|
|
39
|
-
*/
|
|
40
|
-
// export async function checkPeriodOverlap(
|
|
41
|
-
// doctorId: string | Types.ObjectId,
|
|
42
|
-
// startTime: number,
|
|
43
|
-
// endTime: number
|
|
44
|
-
// ): Promise<boolean> {
|
|
45
|
-
// const overlappingPeriod = await PeriodModel.findOne({
|
|
46
|
-
// doctor: doctorId,
|
|
47
|
-
// $or: [
|
|
48
|
-
// {
|
|
49
|
-
// // New start is inside an existing period
|
|
50
|
-
// startTime: { $lte: startTime },
|
|
51
|
-
// endTime: { $gt: startTime },
|
|
52
|
-
// },
|
|
53
|
-
// {
|
|
54
|
-
// // New end is inside an existing period
|
|
55
|
-
// startTime: { $lt: endTime },
|
|
56
|
-
// endTime: { $gte: endTime },
|
|
57
|
-
// },
|
|
58
|
-
// {
|
|
59
|
-
// // New period fully covers an existing one
|
|
60
|
-
// startTime: { $gte: startTime },
|
|
61
|
-
// endTime: { $lte: endTime },
|
|
62
|
-
// },
|
|
63
|
-
// ],
|
|
64
|
-
// });
|
|
65
|
-
// return !!overlappingPeriod;
|
|
66
|
-
// }
|
|
@@ -3,6 +3,7 @@ import { IBaseModel } from "./base";
|
|
|
3
3
|
import { IPeriodDocument } from "./period";
|
|
4
4
|
import { IPatientDocument } from "./patient";
|
|
5
5
|
import { SessionStatus } from "../enums/session.status";
|
|
6
|
+
import { IDoctorDocument } from "./doctor";
|
|
6
7
|
/**
|
|
7
8
|
* Interface for session configuration percentages
|
|
8
9
|
*/
|
|
@@ -18,6 +19,7 @@ export interface ISessionConfig {
|
|
|
18
19
|
export interface ISession extends IBaseModel {
|
|
19
20
|
period: IPeriodDocument;
|
|
20
21
|
patient: IPatientDocument;
|
|
22
|
+
doctor: IDoctorDocument;
|
|
21
23
|
status: SessionStatus;
|
|
22
24
|
pricing: {
|
|
23
25
|
totalPrice: number;
|
package/build/models/session.js
CHANGED
|
@@ -6,6 +6,7 @@ const base_1 = require("./base");
|
|
|
6
6
|
const period_1 = require("./period");
|
|
7
7
|
const patient_1 = require("./patient");
|
|
8
8
|
const session_status_1 = require("../enums/session.status");
|
|
9
|
+
const doctor_1 = require("./doctor");
|
|
9
10
|
/**
|
|
10
11
|
* Schema definition
|
|
11
12
|
*/
|
|
@@ -17,6 +18,10 @@ const SessionSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base
|
|
|
17
18
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
18
19
|
ref: patient_1.PatientModel.modelName,
|
|
19
20
|
required: true,
|
|
21
|
+
}, doctor: {
|
|
22
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
23
|
+
ref: doctor_1.DoctorModel.modelName,
|
|
24
|
+
required: true,
|
|
20
25
|
}, status: {
|
|
21
26
|
type: String,
|
|
22
27
|
enum: Object.values(session_status_1.SessionStatus),
|