docta-package 1.2.44 → 1.2.46

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.
@@ -0,0 +1,40 @@
1
+ import { ISessionDocument } from "../../models";
2
+ import { PeriodOutputDto } from "./period";
3
+ import { PatientOutputDto } from "./patient";
4
+ import { UserOutputDto } from "./user";
5
+ interface ISessionConfigOutput {
6
+ collectionPercentage: number;
7
+ distributionPercentage: number;
8
+ }
9
+ export declare class SessionOutputDto {
10
+ id: string;
11
+ period: PeriodOutputDto;
12
+ patient: PatientOutputDto;
13
+ status: string;
14
+ isDeleted: boolean;
15
+ createdAt: number;
16
+ updatedAt: number;
17
+ constructor(session: ISessionDocument);
18
+ }
19
+ export declare class SessionPatientOutputDto extends SessionOutputDto {
20
+ price: number;
21
+ constructor(session: ISessionDocument);
22
+ }
23
+ export declare class SessionDoctorOutputDto extends SessionOutputDto {
24
+ price: number;
25
+ constructor(session: ISessionDocument);
26
+ }
27
+ export declare class SessionAdminOutputDto extends SessionOutputDto {
28
+ totalPrice: number;
29
+ doctorPrice: number;
30
+ paymentApiPrice: number;
31
+ platformPrice: number;
32
+ hasDoctorCollected: boolean;
33
+ hasPlatformCollected: boolean;
34
+ config: ISessionConfigOutput;
35
+ createdBy: UserOutputDto | null;
36
+ updatedBy: UserOutputDto | null;
37
+ deletedBy: UserOutputDto | null;
38
+ constructor(session: ISessionDocument);
39
+ }
40
+ export {};
@@ -1 +1,61 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionAdminOutputDto = exports.SessionDoctorOutputDto = exports.SessionPatientOutputDto = exports.SessionOutputDto = void 0;
4
+ const period_1 = require("./period");
5
+ const patient_1 = require("./patient");
6
+ const user_1 = require("./user");
7
+ // Base DTO for everyone
8
+ class SessionOutputDto {
9
+ constructor(session) {
10
+ this.id = session.id.toString();
11
+ this.period = new period_1.PeriodOutputDto(session.period);
12
+ this.patient = new patient_1.PatientOutputDto(session.patient);
13
+ this.status = session.status;
14
+ this.isDeleted = session.isDeleted;
15
+ this.createdAt = session.createdAt;
16
+ this.updatedAt = session.updatedAt;
17
+ }
18
+ }
19
+ exports.SessionOutputDto = SessionOutputDto;
20
+ // DTO for patients responses
21
+ class SessionPatientOutputDto extends SessionOutputDto {
22
+ constructor(session) {
23
+ super(session); // call base constructor
24
+ this.price = session.totalPrice;
25
+ }
26
+ }
27
+ exports.SessionPatientOutputDto = SessionPatientOutputDto;
28
+ // DTO for doctors responses
29
+ class SessionDoctorOutputDto extends SessionOutputDto {
30
+ constructor(session) {
31
+ super(session); // call base constructor
32
+ this.price = session.doctorPrice;
33
+ }
34
+ }
35
+ exports.SessionDoctorOutputDto = SessionDoctorOutputDto;
36
+ // Extended DTO for admin responses
37
+ class SessionAdminOutputDto extends SessionOutputDto {
38
+ constructor(session) {
39
+ super(session); // call base constructor
40
+ this.totalPrice = session.totalPrice;
41
+ this.doctorPrice = session.doctorPrice;
42
+ this.paymentApiPrice = session.paymentApiPrice;
43
+ this.platformPrice = session.platformPrice;
44
+ this.hasDoctorCollected = session.hasDoctorCollected;
45
+ this.hasPlatformCollected = session.hasPlatformCollected;
46
+ this.config = {
47
+ collectionPercentage: session.config.collectionPercentage,
48
+ distributionPercentage: session.config.distributionPercentage,
49
+ };
50
+ this.createdBy = session.createdBy
51
+ ? new user_1.UserOutputDto(session.createdBy)
52
+ : null;
53
+ this.updatedBy = session.updatedBy
54
+ ? new user_1.UserOutputDto(session.updatedBy)
55
+ : null;
56
+ this.deletedBy = session.deletedBy
57
+ ? new user_1.UserOutputDto(session.deletedBy)
58
+ : null;
59
+ }
60
+ }
61
+ exports.SessionAdminOutputDto = SessionAdminOutputDto;
@@ -21,6 +21,8 @@ export interface ISession extends IBaseModel {
21
21
  doctorPrice: number;
22
22
  paymentApiPrice: number;
23
23
  platformPrice: number;
24
+ hasDoctorCollected: boolean;
25
+ hasPlatformCollected: boolean;
24
26
  config: ISessionConfig;
25
27
  }
26
28
  /**
@@ -22,7 +22,7 @@ const SessionSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base
22
22
  enum: Object.values(session_status_1.SessionStatus),
23
23
  default: session_status_1.SessionStatus.Created,
24
24
  required: true,
25
- }, totalPrice: { type: Number, required: true }, doctorPrice: { type: Number, required: true }, platformPrice: { type: Number, required: true }, paymentApiPrice: { type: Number, required: true }, config: {
25
+ }, totalPrice: { type: Number, required: true }, doctorPrice: { type: Number, required: true }, platformPrice: { type: Number, required: true }, paymentApiPrice: { type: Number, required: true }, hasDoctorCollected: { type: Boolean, required: true, default: false }, hasPlatformCollected: { type: Boolean, required: true, default: false }, config: {
26
26
  collectionPercentage: { type: Number, required: true },
27
27
  distributionPercentage: { type: Number, required: true },
28
28
  } }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docta-package",
3
- "version": "1.2.44",
3
+ "version": "1.2.46",
4
4
  "description": "This package will contail all the required files to run the docta micro-service app",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",