docta-package 1.2.2 → 1.2.9
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/input/doctor.d.ts +5 -5
- package/build/dto/input/doctor.js +11 -11
- package/build/dto/output/doctor.d.ts +7 -7
- package/build/dto/output/doctor.js +17 -17
- package/build/dto/output/patient.d.ts +1 -1
- package/build/dto/output/patient.js +5 -5
- package/build/dto/output/specialty.d.ts +1 -1
- package/build/dto/output/specialty.js +4 -4
- package/build/errors/BadRequestError.d.ts +1 -1
- package/build/errors/BadRequestError.js +2 -2
- package/build/errors/NotFoundError.d.ts +1 -1
- package/build/errors/NotFoundError.js +2 -2
- package/build/errors/UnAuthorizedError.d.ts +1 -1
- package/build/errors/UnAuthorizedError.js +2 -2
- package/build/models/base.d.ts +1 -1
- package/build/models/doctor.d.ts +8 -8
- package/build/models/doctor.js +13 -13
- package/build/models/patient.d.ts +2 -2
- package/build/models/patient.js +5 -5
- package/build/models/specialty.d.ts +1 -1
- package/build/models/specialty.js +3 -3
- package/build/models/user.d.ts +1 -1
- package/build/models/user.js +3 -3
- package/build/utils/token-utils.js +2 -0
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EducationInputDto } from "
|
|
2
|
-
import { PositionInputDto } from "
|
|
3
|
-
import { LanguageInputDto } from "
|
|
4
|
-
import { FaqInputDto } from "
|
|
5
|
-
import { LocationInputDto } from "
|
|
1
|
+
import { EducationInputDto } from "./education";
|
|
2
|
+
import { PositionInputDto } from "./position";
|
|
3
|
+
import { LanguageInputDto } from "./language";
|
|
4
|
+
import { FaqInputDto } from "./faq";
|
|
5
|
+
import { LocationInputDto } from "./location";
|
|
6
6
|
export declare class CreateDoctorDto {
|
|
7
7
|
name: string;
|
|
8
8
|
email: string;
|
|
@@ -12,11 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.UpdateDoctorDto = exports.ActivateDoctorAccountDto = exports.CreateDoctorDto = void 0;
|
|
13
13
|
const class_validator_1 = require("class-validator");
|
|
14
14
|
const class_transformer_1 = require("class-transformer");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
15
|
+
const education_1 = require("./education");
|
|
16
|
+
const position_1 = require("./position");
|
|
17
|
+
const language_1 = require("./language");
|
|
18
|
+
const faq_1 = require("./faq");
|
|
19
|
+
const location_1 = require("./location");
|
|
20
20
|
class CreateDoctorDto {
|
|
21
21
|
}
|
|
22
22
|
exports.CreateDoctorDto = CreateDoctorDto;
|
|
@@ -92,28 +92,28 @@ __decorate([
|
|
|
92
92
|
(0, class_validator_1.IsOptional)(),
|
|
93
93
|
(0, class_validator_1.IsArray)(),
|
|
94
94
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
95
|
-
(0, class_transformer_1.Type)(() =>
|
|
95
|
+
(0, class_transformer_1.Type)(() => education_1.EducationInputDto),
|
|
96
96
|
__metadata("design:type", Array)
|
|
97
97
|
], UpdateDoctorDto.prototype, "educations", void 0);
|
|
98
98
|
__decorate([
|
|
99
99
|
(0, class_validator_1.IsOptional)(),
|
|
100
100
|
(0, class_validator_1.IsArray)(),
|
|
101
101
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
102
|
-
(0, class_transformer_1.Type)(() =>
|
|
102
|
+
(0, class_transformer_1.Type)(() => position_1.PositionInputDto),
|
|
103
103
|
__metadata("design:type", Array)
|
|
104
104
|
], UpdateDoctorDto.prototype, "positions", void 0);
|
|
105
105
|
__decorate([
|
|
106
106
|
(0, class_validator_1.IsOptional)(),
|
|
107
107
|
(0, class_validator_1.IsArray)(),
|
|
108
108
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
109
|
-
(0, class_transformer_1.Type)(() =>
|
|
109
|
+
(0, class_transformer_1.Type)(() => language_1.LanguageInputDto),
|
|
110
110
|
__metadata("design:type", Array)
|
|
111
111
|
], UpdateDoctorDto.prototype, "languages", void 0);
|
|
112
112
|
__decorate([
|
|
113
113
|
(0, class_validator_1.IsOptional)(),
|
|
114
114
|
(0, class_validator_1.IsArray)(),
|
|
115
115
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
116
|
-
(0, class_transformer_1.Type)(() =>
|
|
116
|
+
(0, class_transformer_1.Type)(() => faq_1.FaqInputDto),
|
|
117
117
|
__metadata("design:type", Array)
|
|
118
118
|
], UpdateDoctorDto.prototype, "faqs", void 0);
|
|
119
119
|
__decorate([
|
|
@@ -126,6 +126,6 @@ __decorate([
|
|
|
126
126
|
__decorate([
|
|
127
127
|
(0, class_validator_1.IsOptional)(),
|
|
128
128
|
(0, class_validator_1.ValidateNested)(),
|
|
129
|
-
(0, class_transformer_1.Type)(() =>
|
|
130
|
-
__metadata("design:type",
|
|
129
|
+
(0, class_transformer_1.Type)(() => location_1.LocationInputDto),
|
|
130
|
+
__metadata("design:type", location_1.LocationInputDto)
|
|
131
131
|
], UpdateDoctorDto.prototype, "location", void 0);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IDoctorDocument } from "../../models";
|
|
2
|
-
import { SpecialtyOutputDto } from "
|
|
3
|
-
import { UserOutputDto } from "
|
|
4
|
-
import { EducationOutputDto } from "
|
|
5
|
-
import { PositionOutputDto } from "
|
|
6
|
-
import { LanguageOutputDto } from "
|
|
7
|
-
import { FaqOutputDto } from "
|
|
8
|
-
import { LocationOutputDto } from "
|
|
2
|
+
import { SpecialtyOutputDto } from "./specialty";
|
|
3
|
+
import { UserOutputDto } from "./user";
|
|
4
|
+
import { EducationOutputDto } from "./education";
|
|
5
|
+
import { PositionOutputDto } from "./position";
|
|
6
|
+
import { LanguageOutputDto } from "./language";
|
|
7
|
+
import { FaqOutputDto } from "./faq";
|
|
8
|
+
import { LocationOutputDto } from "./location";
|
|
9
9
|
export declare class DoctorOutputDto {
|
|
10
10
|
id: string;
|
|
11
11
|
user: UserOutputDto;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DoctorAdminOutputDto = exports.DoctorOutputDto = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const specialty_1 = require("./specialty");
|
|
5
|
+
const user_1 = require("./user");
|
|
6
|
+
const education_1 = require("./education");
|
|
7
|
+
const position_1 = require("./position");
|
|
8
|
+
const language_1 = require("./language");
|
|
9
|
+
const faq_1 = require("./faq");
|
|
10
|
+
const location_1 = require("./location");
|
|
11
11
|
// Base DTO for everyone
|
|
12
12
|
class DoctorOutputDto {
|
|
13
13
|
constructor(doctor) {
|
|
14
14
|
var _a;
|
|
15
15
|
this.id = doctor.id.toString();
|
|
16
|
-
this.user = new
|
|
16
|
+
this.user = new user_1.UserOutputDto(doctor.user);
|
|
17
17
|
this.name = doctor.name;
|
|
18
|
-
this.specialty = new
|
|
18
|
+
this.specialty = new specialty_1.SpecialtyOutputDto(doctor.specialty);
|
|
19
19
|
this.slug = doctor.slug;
|
|
20
20
|
this.biography = doctor.biography || null;
|
|
21
21
|
this.isActive = doctor.isActive;
|
|
@@ -24,16 +24,16 @@ class DoctorOutputDto {
|
|
|
24
24
|
this.isVisible = doctor.isVisible;
|
|
25
25
|
this.photo = doctor.photo || null;
|
|
26
26
|
this.educations = (doctor.educations || [])
|
|
27
|
-
.map((e) => new
|
|
27
|
+
.map((e) => new education_1.EducationOutputDto(e))
|
|
28
28
|
.sort((a, b) => b.year - a.year);
|
|
29
29
|
this.positions = (doctor.positions || [])
|
|
30
|
-
.map((p) => new
|
|
30
|
+
.map((p) => new position_1.PositionOutputDto(p))
|
|
31
31
|
.sort((a, b) => b.startDate - a.startDate);
|
|
32
|
-
this.languages = (doctor.languages || []).map((l) => new
|
|
33
|
-
this.faqs = (doctor.faqs || []).map((f) => new
|
|
32
|
+
this.languages = (doctor.languages || []).map((l) => new language_1.LanguageOutputDto(l));
|
|
33
|
+
this.faqs = (doctor.faqs || []).map((f) => new faq_1.FaqOutputDto(f));
|
|
34
34
|
this.expertises = doctor.expertises || [];
|
|
35
35
|
this.location = doctor.location
|
|
36
|
-
? new
|
|
36
|
+
? new location_1.LocationOutputDto(doctor.location)
|
|
37
37
|
: null;
|
|
38
38
|
this.isDeleted = doctor.isDeleted;
|
|
39
39
|
this.createdAt = doctor.createdAt;
|
|
@@ -48,13 +48,13 @@ class DoctorAdminOutputDto extends DoctorOutputDto {
|
|
|
48
48
|
super(doctor); // call base constructor
|
|
49
49
|
this.isDeactivatedByAdmin = (_a = doctor.isDeactivatedByAdmin) !== null && _a !== void 0 ? _a : null;
|
|
50
50
|
this.createdBy = doctor.createdBy
|
|
51
|
-
? new
|
|
51
|
+
? new user_1.UserOutputDto(doctor.createdBy)
|
|
52
52
|
: null;
|
|
53
53
|
this.updatedBy = doctor.updatedBy
|
|
54
|
-
? new
|
|
54
|
+
? new user_1.UserOutputDto(doctor.updatedBy)
|
|
55
55
|
: null;
|
|
56
56
|
this.deletedBy = doctor.deletedBy
|
|
57
|
-
? new
|
|
57
|
+
? new user_1.UserOutputDto(doctor.deletedBy)
|
|
58
58
|
: null;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PatientAdminOutputDto = exports.PatientOutputDto = void 0;
|
|
4
|
-
const
|
|
4
|
+
const user_1 = require("./user");
|
|
5
5
|
// Base DTO for everyone
|
|
6
6
|
class PatientOutputDto {
|
|
7
7
|
constructor(patient) {
|
|
8
8
|
this.id = patient.id.toString();
|
|
9
|
-
this.user = new
|
|
9
|
+
this.user = new user_1.UserOutputDto(patient.user);
|
|
10
10
|
this.dob = patient.dob || null;
|
|
11
11
|
this.phoneNumber = patient.phoneNumber || null;
|
|
12
12
|
this.gender = patient.gender || null;
|
|
@@ -21,13 +21,13 @@ class PatientAdminOutputDto extends PatientOutputDto {
|
|
|
21
21
|
constructor(patient) {
|
|
22
22
|
super(patient); // call base constructor
|
|
23
23
|
this.createdBy = patient.createdBy
|
|
24
|
-
? new
|
|
24
|
+
? new user_1.UserOutputDto(patient.createdBy)
|
|
25
25
|
: null;
|
|
26
26
|
this.updatedBy = patient.updatedBy
|
|
27
|
-
? new
|
|
27
|
+
? new user_1.UserOutputDto(patient.updatedBy)
|
|
28
28
|
: null;
|
|
29
29
|
this.deletedBy = patient.deletedBy
|
|
30
|
-
? new
|
|
30
|
+
? new user_1.UserOutputDto(patient.deletedBy)
|
|
31
31
|
: null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SpecialtyAdminOutputDto = exports.SpecialtyOutputDto = void 0;
|
|
4
|
-
const
|
|
4
|
+
const user_1 = require("./user");
|
|
5
5
|
// Base DTO for everyone
|
|
6
6
|
class SpecialtyOutputDto {
|
|
7
7
|
constructor(specialty) {
|
|
@@ -27,13 +27,13 @@ class SpecialtyAdminOutputDto extends SpecialtyOutputDto {
|
|
|
27
27
|
constructor(specialty) {
|
|
28
28
|
super(specialty); // call base constructor
|
|
29
29
|
this.createdBy = specialty.createdBy
|
|
30
|
-
? new
|
|
30
|
+
? new user_1.UserOutputDto(specialty.createdBy)
|
|
31
31
|
: null;
|
|
32
32
|
this.updatedBy = specialty.updatedBy
|
|
33
|
-
? new
|
|
33
|
+
? new user_1.UserOutputDto(specialty.updatedBy)
|
|
34
34
|
: null;
|
|
35
35
|
this.deletedBy = specialty.deletedBy
|
|
36
|
-
? new
|
|
36
|
+
? new user_1.UserOutputDto(specialty.deletedBy)
|
|
37
37
|
: null;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BadRequestError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const CustomError_1 = require("./CustomError");
|
|
5
5
|
const enums_1 = require("../enums");
|
|
6
|
-
class BadRequestError extends
|
|
6
|
+
class BadRequestError extends CustomError_1.CustomError {
|
|
7
7
|
constructor(code = enums_1.EnumStatusCode.BAD_REQUEST, message = "Bad Request") {
|
|
8
8
|
super(message, code, 400);
|
|
9
9
|
this.statusCode = 400;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotFoundError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const CustomError_1 = require("./CustomError");
|
|
5
5
|
const enums_1 = require("../enums");
|
|
6
|
-
class NotFoundError extends
|
|
6
|
+
class NotFoundError extends CustomError_1.CustomError {
|
|
7
7
|
constructor(code = enums_1.EnumStatusCode.NOT_FOUND, message = "Not Found") {
|
|
8
8
|
super(message, code, 404);
|
|
9
9
|
this.statusCode = 404;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnAuthorizedError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const CustomError_1 = require("./CustomError");
|
|
5
5
|
const enums_1 = require("../enums");
|
|
6
|
-
class UnAuthorizedError extends
|
|
6
|
+
class UnAuthorizedError extends CustomError_1.CustomError {
|
|
7
7
|
constructor(code = enums_1.EnumStatusCode.UNAUTHORIZED, message = "Unauthorized") {
|
|
8
8
|
super(message, code, 401);
|
|
9
9
|
this.statusCode = 401;
|
package/build/models/base.d.ts
CHANGED
package/build/models/doctor.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Document, Model } from "mongoose";
|
|
2
|
-
import { ISpecialtyDocument } from "
|
|
3
|
-
import { IUserDocument } from "
|
|
4
|
-
import { IBaseModel } from "
|
|
5
|
-
import { IEducation } from "
|
|
6
|
-
import { IPosition } from "
|
|
7
|
-
import { ILanguage } from "
|
|
8
|
-
import { IFaq } from "
|
|
9
|
-
import { ILocation } from "
|
|
2
|
+
import { ISpecialtyDocument } from "./specialty";
|
|
3
|
+
import { IUserDocument } from "./user";
|
|
4
|
+
import { IBaseModel } from "./base";
|
|
5
|
+
import { IEducation } from "./education";
|
|
6
|
+
import { IPosition } from "./position";
|
|
7
|
+
import { ILanguage } from "./language";
|
|
8
|
+
import { IFaq } from "./faq";
|
|
9
|
+
import { ILocation } from "./location";
|
|
10
10
|
export interface IDoctor extends IBaseModel {
|
|
11
11
|
name: string;
|
|
12
12
|
slug: string;
|
package/build/models/doctor.js
CHANGED
|
@@ -11,24 +11,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DoctorModel = void 0;
|
|
13
13
|
const mongoose_1 = require("mongoose");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const DoctorSchema = new mongoose_1.Schema(Object.assign(Object.assign({},
|
|
14
|
+
const specialty_1 = require("./specialty");
|
|
15
|
+
const user_1 = require("./user");
|
|
16
|
+
const base_1 = require("./base");
|
|
17
|
+
const education_1 = require("./education");
|
|
18
|
+
const position_1 = require("./position");
|
|
19
|
+
const language_1 = require("./language");
|
|
20
|
+
const faq_1 = require("./faq");
|
|
21
|
+
const location_1 = require("./location");
|
|
22
|
+
const DoctorSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base_1.BaseSchemaFields), { user: {
|
|
23
23
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
24
|
-
ref:
|
|
24
|
+
ref: user_1.UserModel,
|
|
25
25
|
required: true,
|
|
26
26
|
onDelete: "cascade",
|
|
27
27
|
}, specialty: {
|
|
28
28
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
29
|
-
ref:
|
|
29
|
+
ref: specialty_1.SpecialtyModel,
|
|
30
30
|
required: true,
|
|
31
|
-
}, name: { type: String, required: true, trim: true }, biography: { type: String, required: false }, slug: { type: String, required: true, unique: true, trim: true }, isActive: { type: Boolean, default: false }, consultationFee: { type: Number, required: false }, isVerified: { type: Boolean, default: false }, isVisible: { type: Boolean, default: true }, isDeactivatedByAdmin: { type: Boolean, default: false }, photo: { type: String, required: false }, educations: { type: [
|
|
31
|
+
}, name: { type: String, required: true, trim: true }, biography: { type: String, required: false }, slug: { type: String, required: true, unique: true, trim: true }, isActive: { type: Boolean, default: false }, consultationFee: { type: Number, required: false }, isVerified: { type: Boolean, default: false }, isVisible: { type: Boolean, default: true }, isDeactivatedByAdmin: { type: Boolean, default: false }, photo: { type: String, required: false }, educations: { type: [education_1.EducationSchema], required: true, default: [] }, positions: { type: [position_1.PositionSchema], required: true, default: [] }, languages: { type: [language_1.LanguageSchema], required: true, default: [] }, faqs: { type: [faq_1.FaqSchema], required: true, default: [] }, expertises: { type: [String], required: true, default: [] }, location: { type: location_1.LocationSchema, required: false } }));
|
|
32
32
|
const createSlug = (text) => text
|
|
33
33
|
.toLowerCase()
|
|
34
34
|
.trim()
|
|
@@ -51,5 +51,5 @@ DoctorSchema.pre("validate", function (next) {
|
|
|
51
51
|
next();
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
|
-
DoctorSchema.plugin(
|
|
54
|
+
DoctorSchema.plugin(base_1.BaseSchemaPlugin);
|
|
55
55
|
exports.DoctorModel = (0, mongoose_1.model)("Doctor", DoctorSchema);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Document, Model } from "mongoose";
|
|
2
|
-
import { IUserDocument } from "
|
|
3
|
-
import { IBaseModel } from "
|
|
2
|
+
import { IUserDocument } from "./user";
|
|
3
|
+
import { IBaseModel } from "./base";
|
|
4
4
|
import { Gender } from "../enums";
|
|
5
5
|
export interface IPatient extends IBaseModel {
|
|
6
6
|
user: IUserDocument;
|
package/build/models/patient.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PatientModel = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const user_1 = require("./user");
|
|
6
|
+
const base_1 = require("./base");
|
|
7
7
|
const enums_1 = require("../enums");
|
|
8
|
-
const PatientSchema = new mongoose_1.Schema(Object.assign(Object.assign({},
|
|
8
|
+
const PatientSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base_1.BaseSchemaFields), { user: {
|
|
9
9
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
10
|
-
ref:
|
|
10
|
+
ref: user_1.UserModel.modelName,
|
|
11
11
|
required: true,
|
|
12
12
|
onDelete: "cascade",
|
|
13
13
|
}, dob: { type: Number, required: false }, phoneNumber: { type: String, required: false }, gender: { type: String, enum: Object.values(enums_1.Gender), required: false } }));
|
|
14
|
-
PatientSchema.plugin(
|
|
14
|
+
PatientSchema.plugin(base_1.BaseSchemaPlugin);
|
|
15
15
|
exports.PatientModel = (0, mongoose_1.model)("Patient", PatientSchema);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SpecialtyModel = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
|
-
const
|
|
5
|
+
const base_1 = require("./base");
|
|
6
6
|
const LocalizedFieldsSchema = new mongoose_1.Schema({
|
|
7
7
|
name: { type: String, required: true },
|
|
8
8
|
description: { type: String, default: null },
|
|
9
9
|
}, { _id: false });
|
|
10
|
-
const SpecialtySchema = new mongoose_1.Schema(Object.assign(Object.assign({},
|
|
11
|
-
SpecialtySchema.plugin(
|
|
10
|
+
const SpecialtySchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base_1.BaseSchemaFields), { en: { type: LocalizedFieldsSchema, required: true }, fr: { type: LocalizedFieldsSchema, required: false, default: null } }));
|
|
11
|
+
SpecialtySchema.plugin(base_1.BaseSchemaPlugin);
|
|
12
12
|
exports.SpecialtyModel = (0, mongoose_1.model)("Specialty", SpecialtySchema);
|
package/build/models/user.d.ts
CHANGED
package/build/models/user.js
CHANGED
|
@@ -13,13 +13,13 @@ exports.UserModel = void 0;
|
|
|
13
13
|
const mongoose_1 = require("mongoose");
|
|
14
14
|
const enums_1 = require("../enums");
|
|
15
15
|
const bcrypt = require("bcryptjs");
|
|
16
|
-
const
|
|
17
|
-
const UserSchema = new mongoose_1.Schema(Object.assign(Object.assign({},
|
|
16
|
+
const base_1 = require("./base");
|
|
17
|
+
const UserSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base_1.BaseSchemaFields), { name: { type: String, required: true }, email: { type: String, required: true, unique: true, trim: true }, password: { type: String, required: false, default: null }, activationToken: { type: String, default: null }, forgotPasswordToken: { type: String, default: null }, token: { type: String, default: null }, isActive: { type: Boolean, default: false }, role: {
|
|
18
18
|
type: String,
|
|
19
19
|
enum: Object.values(enums_1.EnumUserRole),
|
|
20
20
|
default: enums_1.EnumUserRole.PATIENT,
|
|
21
21
|
} }));
|
|
22
|
-
UserSchema.plugin(
|
|
22
|
+
UserSchema.plugin(base_1.BaseSchemaPlugin);
|
|
23
23
|
UserSchema.pre("save", function (next) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
if (!this.isModified("password")) {
|
|
@@ -23,6 +23,8 @@ class TokenUtils {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
static createAccessToken(payload) {
|
|
26
|
+
console.log("General config");
|
|
27
|
+
console.log(config_1.generalConfig.accessTokenExpiry);
|
|
26
28
|
return jsonwebtoken_1.default.sign(payload, config_1.generalConfig.accessTokenSecret, {
|
|
27
29
|
expiresIn: config_1.generalConfig.accessTokenExpiry,
|
|
28
30
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docta-package",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "This package will contail all the required files to run the docta micro-service app",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"build"
|