docta-package 1.2.25 → 1.2.33

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.
@@ -6,3 +6,4 @@ export * from "./routing-keys";
6
6
  export * from "./exchanges";
7
7
  export * from "./queues";
8
8
  export * from "./period.status";
9
+ export * from "./notification.types";
@@ -22,3 +22,4 @@ __exportStar(require("./routing-keys"), exports);
22
22
  __exportStar(require("./exchanges"), exports);
23
23
  __exportStar(require("./queues"), exports);
24
24
  __exportStar(require("./period.status"), exports);
25
+ __exportStar(require("./notification.types"), exports);
@@ -0,0 +1,2 @@
1
+ export declare enum NotificationType {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationType = void 0;
4
+ var NotificationType;
5
+ (function (NotificationType) {
6
+ })(NotificationType || (exports.NotificationType = NotificationType = {}));
@@ -10,6 +10,7 @@ export declare enum EnumStatusCode {
10
10
  SPECIALTY_NOT_FOUND = "SPECIALTY_NOT_FOUND",
11
11
  NOT_ALLOWED = "NOT_ALLOWED",
12
12
  DOCTOR_NOT_FOUND = "DOCTOR_NOT_FOUND",
13
+ USER_NOT_FOUND = "USER_NOT_FOUND",
13
14
  ACCOUNT_DELETED = "ACCOUNT_DELETED",
14
15
  ACCOUNT_DEACTIVATED = "ACCOUNT_DEACTIVATED",
15
16
  TOKEN_REFRESHED = "TOKEN_REFRESHED",
@@ -20,5 +21,9 @@ export declare enum EnumStatusCode {
20
21
  FILE_TYPE_MISMATCH = "FILE_TYPE_MISMATCH",
21
22
  FILE_TOO_LARGE = "FILE_TOO_LARGE",
22
23
  NO_FILE_UPLOADED = "NO_FILE_UPLOADED",
23
- DELETED_SUCCESSFULLY = "DELETED_SUCCESSFULLY"
24
+ DELETED_SUCCESSFULLY = "DELETED_SUCCESSFULLY",
25
+ DOCTOR_DEACTIVATED = "DOCTOR_DEACTIVATED",
26
+ INVALID_TIME_GAP = "INVALID_TIME_GAP",
27
+ OVERLAP_EXISTS = "OVERLAP_EXISTS",
28
+ BOLD_TIME_ERROR = "BOLD_TIME_ERROR"
24
29
  }
@@ -14,6 +14,7 @@ var EnumStatusCode;
14
14
  EnumStatusCode["SPECIALTY_NOT_FOUND"] = "SPECIALTY_NOT_FOUND";
15
15
  EnumStatusCode["NOT_ALLOWED"] = "NOT_ALLOWED";
16
16
  EnumStatusCode["DOCTOR_NOT_FOUND"] = "DOCTOR_NOT_FOUND";
17
+ EnumStatusCode["USER_NOT_FOUND"] = "USER_NOT_FOUND";
17
18
  EnumStatusCode["ACCOUNT_DELETED"] = "ACCOUNT_DELETED";
18
19
  EnumStatusCode["ACCOUNT_DEACTIVATED"] = "ACCOUNT_DEACTIVATED";
19
20
  EnumStatusCode["TOKEN_REFRESHED"] = "TOKEN_REFRESHED";
@@ -25,4 +26,8 @@ var EnumStatusCode;
25
26
  EnumStatusCode["FILE_TOO_LARGE"] = "FILE_TOO_LARGE";
26
27
  EnumStatusCode["NO_FILE_UPLOADED"] = "NO_FILE_UPLOADED";
27
28
  EnumStatusCode["DELETED_SUCCESSFULLY"] = "DELETED_SUCCESSFULLY";
29
+ EnumStatusCode["DOCTOR_DEACTIVATED"] = "DOCTOR_DEACTIVATED";
30
+ EnumStatusCode["INVALID_TIME_GAP"] = "INVALID_TIME_GAP";
31
+ EnumStatusCode["OVERLAP_EXISTS"] = "OVERLAP_EXISTS";
32
+ EnumStatusCode["BOLD_TIME_ERROR"] = "BOLD_TIME_ERROR";
28
33
  })(EnumStatusCode || (exports.EnumStatusCode = EnumStatusCode = {}));
@@ -0,0 +1,5 @@
1
+ import { NotificationType } from "../../enums";
2
+ export type NotificationEventEvent<T> = {
3
+ type: NotificationType;
4
+ data: T;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,3 +2,4 @@ export * from "./publisher";
2
2
  export * from "./events/patient-created";
3
3
  export * from "./events/doctor.created";
4
4
  export * from "./events/forgot.password";
5
+ export * from "./events/notification-event";
@@ -18,3 +18,4 @@ __exportStar(require("./publisher"), exports);
18
18
  __exportStar(require("./events/patient-created"), exports);
19
19
  __exportStar(require("./events/doctor.created"), exports);
20
20
  __exportStar(require("./events/forgot.password"), exports);
21
+ __exportStar(require("./events/notification-event"), exports);
@@ -1,4 +1,5 @@
1
- import { IUserDocument } from "../models";
1
+ import { IDoctorDocument, IUserDocument } from "../models";
2
2
  export declare class ValidateInfo {
3
3
  static validateUser(user: IUserDocument): void;
4
+ static validateDoctor(doctor: IDoctorDocument): void;
4
5
  }
@@ -7,7 +7,7 @@ const errors_2 = require("../errors");
7
7
  class ValidateInfo {
8
8
  static validateUser(user) {
9
9
  if (!user) {
10
- throw new errors_1.NotFoundError(enums_1.EnumStatusCode.NOT_FOUND, "User not found");
10
+ throw new errors_1.NotFoundError(enums_1.EnumStatusCode.USER_NOT_FOUND, "User not found");
11
11
  }
12
12
  if (user.isDeleted) {
13
13
  throw new errors_2.UnAuthorizedError(enums_1.EnumStatusCode.ACCOUNT_DELETED, "Your account has been deleted");
@@ -16,5 +16,16 @@ class ValidateInfo {
16
16
  throw new errors_2.UnAuthorizedError(enums_1.EnumStatusCode.ACCOUNT_DEACTIVATED, "Account is deactivated");
17
17
  }
18
18
  }
19
+ static validateDoctor(doctor) {
20
+ if (!doctor) {
21
+ throw new errors_1.NotFoundError(enums_1.EnumStatusCode.DOCTOR_NOT_FOUND, "Doctor not found");
22
+ }
23
+ if (doctor.isDeleted) {
24
+ throw new errors_2.UnAuthorizedError(enums_1.EnumStatusCode.ACCOUNT_DELETED, "Your account has been deleted");
25
+ }
26
+ if (!doctor.isActive) {
27
+ throw new errors_2.UnAuthorizedError(enums_1.EnumStatusCode.DOCTOR_DEACTIVATED, "Account is deactivated");
28
+ }
29
+ }
19
30
  }
20
31
  exports.ValidateInfo = ValidateInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docta-package",
3
- "version": "1.2.25",
3
+ "version": "1.2.33",
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",