docta-package 1.2.59 → 1.2.61
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.
|
@@ -25,8 +25,8 @@ export declare class SessionPatientOutputDto extends SessionOutputDto {
|
|
|
25
25
|
constructor(session: ISessionDocument);
|
|
26
26
|
}
|
|
27
27
|
export declare class SessionDoctorOutputDto extends SessionOutputDto {
|
|
28
|
-
price: number;
|
|
29
28
|
patient: PatientOutputDto;
|
|
29
|
+
price: number;
|
|
30
30
|
constructor(session: ISessionDocument);
|
|
31
31
|
}
|
|
32
32
|
export declare class SessionAdminOutputDto extends SessionOutputDto {
|
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),
|