docta-package 1.0.2 → 1.2.0

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.
Files changed (164) hide show
  1. package/README.md +1 -0
  2. package/build/config.d.ts +14 -0
  3. package/build/config.js +15 -0
  4. package/build/dto/input/doctor.d.ts +28 -0
  5. package/build/dto/input/doctor.js +131 -0
  6. package/build/dto/input/education.d.ts +4 -0
  7. package/build/dto/input/education.js +26 -0
  8. package/build/dto/input/faq.d.ts +4 -0
  9. package/build/dto/input/faq.js +26 -0
  10. package/build/dto/input/index.js +25 -0
  11. package/build/dto/input/language.d.ts +5 -0
  12. package/build/dto/input/language.js +28 -0
  13. package/build/dto/input/location.d.ts +9 -0
  14. package/build/dto/input/location.js +51 -0
  15. package/build/dto/input/patient.d.ts +6 -0
  16. package/build/dto/input/patient.js +33 -0
  17. package/build/dto/input/position.d.ts +6 -0
  18. package/build/dto/input/position.js +37 -0
  19. package/build/dto/input/specialty.d.ts +12 -0
  20. package/build/dto/input/specialty.js +56 -0
  21. package/build/dto/input/user.d.ts +29 -0
  22. package/build/dto/input/user.js +112 -0
  23. package/build/dto/output/doctor.d.ts +38 -0
  24. package/build/dto/output/doctor.js +61 -0
  25. package/build/dto/output/education.d.ts +6 -0
  26. package/build/dto/output/education.js +10 -0
  27. package/build/dto/output/faq.d.ts +6 -0
  28. package/build/dto/output/faq.js +10 -0
  29. package/build/dto/output/index.js +25 -0
  30. package/build/dto/output/language.d.ts +6 -0
  31. package/build/dto/output/language.js +10 -0
  32. package/build/dto/output/location.d.ts +11 -0
  33. package/build/dto/output/location.js +16 -0
  34. package/build/dto/output/patient.d.ts +20 -0
  35. package/build/dto/output/patient.js +34 -0
  36. package/build/dto/output/position.d.ts +8 -0
  37. package/build/dto/output/position.js +13 -0
  38. package/build/dto/output/specialty.d.ts +23 -0
  39. package/build/dto/output/specialty.js +40 -0
  40. package/build/dto/output/user.d.ts +24 -0
  41. package/build/dto/output/user.js +36 -0
  42. package/build/enums/gender.d.ts +4 -0
  43. package/build/enums/gender.js +8 -0
  44. package/build/enums/index.js +20 -0
  45. package/build/enums/language-levels.d.ts +8 -0
  46. package/build/enums/language-levels.js +12 -0
  47. package/build/enums/status-codes.d.ts +24 -0
  48. package/build/enums/status-codes.js +28 -0
  49. package/build/enums/user-role.d.ts +5 -0
  50. package/build/enums/user-role.js +9 -0
  51. package/build/errors/BadRequestError.d.ts +8 -0
  52. package/build/errors/BadRequestError.js +15 -0
  53. package/build/errors/CustomError.d.ts +8 -0
  54. package/build/errors/CustomError.js +13 -0
  55. package/build/errors/NotFoundError.d.ts +8 -0
  56. package/build/errors/NotFoundError.js +15 -0
  57. package/build/errors/UnAuthorizedError.d.ts +8 -0
  58. package/build/errors/UnAuthorizedError.js +15 -0
  59. package/build/errors/index.js +20 -0
  60. package/{src/index.ts → build/index.d.ts} +4 -6
  61. package/build/index.js +25 -0
  62. package/build/interfaces/LoggedInUserToken.d.ts +6 -0
  63. package/build/interfaces/LoggedInUserToken.js +2 -0
  64. package/build/interfaces/index.js +17 -0
  65. package/build/middleware/errorHandler.d.ts +2 -0
  66. package/build/middleware/errorHandler.js +26 -0
  67. package/build/middleware/index.js +21 -0
  68. package/build/middleware/multer.d.ts +6 -0
  69. package/build/middleware/multer.js +58 -0
  70. package/build/middleware/require-auth.d.ts +2 -0
  71. package/build/middleware/require-auth.js +39 -0
  72. package/build/middleware/validate-request.d.ts +2 -0
  73. package/build/middleware/validate-request.js +41 -0
  74. package/build/middleware/verify-roles.d.ts +3 -0
  75. package/build/middleware/verify-roles.js +17 -0
  76. package/build/models/base.d.ts +13 -0
  77. package/build/models/base.js +41 -0
  78. package/build/models/doctor.d.ts +33 -0
  79. package/build/models/doctor.js +55 -0
  80. package/build/models/education.d.ts +14 -0
  81. package/build/models/education.js +8 -0
  82. package/build/models/faq.d.ts +14 -0
  83. package/build/models/faq.js +8 -0
  84. package/build/models/index.js +26 -0
  85. package/build/models/language.d.ts +15 -0
  86. package/build/models/language.js +14 -0
  87. package/build/models/location.d.ts +19 -0
  88. package/{src/models/location.ts → build/models/location.js} +6 -17
  89. package/build/models/patient.d.ts +15 -0
  90. package/build/models/patient.js +15 -0
  91. package/build/models/position.d.ts +16 -0
  92. package/build/models/position.js +10 -0
  93. package/build/models/specialty.d.ts +15 -0
  94. package/build/models/specialty.js +12 -0
  95. package/build/models/user.d.ts +19 -0
  96. package/build/models/user.js +47 -0
  97. package/build/utils/index.js +21 -0
  98. package/build/utils/orchestration-result.d.ts +38 -0
  99. package/build/utils/orchestration-result.js +26 -0
  100. package/build/utils/s3-helper.d.ts +13 -0
  101. package/build/utils/s3-helper.js +67 -0
  102. package/build/utils/token-utils.d.ts +11 -0
  103. package/build/utils/token-utils.js +77 -0
  104. package/build/utils/validate-info.d.ts +4 -0
  105. package/build/utils/validate-info.js +20 -0
  106. package/build/utils/winston.d.ts +3 -0
  107. package/build/utils/winston.js +32 -0
  108. package/package.json +9 -2
  109. package/src/config.ts +0 -25
  110. package/src/dto/input/doctor.ts +0 -120
  111. package/src/dto/input/education.ts +0 -11
  112. package/src/dto/input/faq.ts +0 -11
  113. package/src/dto/input/language.ts +0 -13
  114. package/src/dto/input/location.ts +0 -31
  115. package/src/dto/input/patient.ts +0 -17
  116. package/src/dto/input/position.ts +0 -21
  117. package/src/dto/input/specialty.ts +0 -40
  118. package/src/dto/input/user.ts +0 -87
  119. package/src/dto/output/doctor.ts +0 -90
  120. package/src/dto/output/education.ts +0 -11
  121. package/src/dto/output/faq.ts +0 -11
  122. package/src/dto/output/language.ts +0 -11
  123. package/src/dto/output/location.ts +0 -21
  124. package/src/dto/output/patient.ts +0 -49
  125. package/src/dto/output/position.ts +0 -15
  126. package/src/dto/output/specialty.ts +0 -53
  127. package/src/dto/output/user.ts +0 -57
  128. package/src/enums/gender.ts +0 -4
  129. package/src/enums/language-levels.ts +0 -9
  130. package/src/enums/status-codes.ts +0 -28
  131. package/src/enums/user-role.ts +0 -5
  132. package/src/errors/BadRequestError.ts +0 -18
  133. package/src/errors/CustomError.ts +0 -18
  134. package/src/errors/NotFoundError.ts +0 -18
  135. package/src/errors/UnAuthorizedError.ts +0 -18
  136. package/src/interfaces/LoggedInUserToken.ts +0 -9
  137. package/src/middleware/errorHandler.ts +0 -31
  138. package/src/middleware/multer.ts +0 -74
  139. package/src/middleware/require-auth.ts +0 -46
  140. package/src/middleware/validate-request.ts +0 -40
  141. package/src/middleware/verify-roles.ts +0 -17
  142. package/src/models/base.ts +0 -52
  143. package/src/models/doctor.ts +0 -96
  144. package/src/models/education.ts +0 -14
  145. package/src/models/faq.ts +0 -14
  146. package/src/models/language.ts +0 -20
  147. package/src/models/patient.ts +0 -35
  148. package/src/models/position.ts +0 -19
  149. package/src/models/specialty.ts +0 -37
  150. package/src/models/user.ts +0 -67
  151. package/src/utils/orchestration-result.ts +0 -74
  152. package/src/utils/s3-helper.ts +0 -72
  153. package/src/utils/token-utils.ts +0 -86
  154. package/src/utils/validate-info.ts +0 -26
  155. package/src/utils/winston.ts +0 -33
  156. package/tsconfig.json +0 -120
  157. /package/{src/dto/input/index.ts → build/dto/input/index.d.ts} +0 -0
  158. /package/{src/dto/output/index.ts → build/dto/output/index.d.ts} +0 -0
  159. /package/{src/enums/index.ts → build/enums/index.d.ts} +0 -0
  160. /package/{src/errors/index.ts → build/errors/index.d.ts} +0 -0
  161. /package/{src/interfaces/index.ts → build/interfaces/index.d.ts} +0 -0
  162. /package/{src/middleware/index.ts → build/middleware/index.d.ts} +0 -0
  163. /package/{src/models/index.ts → build/models/index.d.ts} +0 -0
  164. /package/{src/utils/index.ts → build/utils/index.d.ts} +0 -0
@@ -1,120 +0,0 @@
1
- import {
2
- IsEmail,
3
- IsString,
4
- MaxLength,
5
- MinLength,
6
- IsStrongPassword,
7
- IsMongoId,
8
- IsOptional,
9
- IsNumber,
10
- Min,
11
- IsNotEmpty,
12
- IsBoolean,
13
- IsArray,
14
- ValidateNested,
15
- ArrayMaxSize,
16
- } from "class-validator";
17
- import { Type } from "class-transformer";
18
- import { EducationInputDto } from ".";
19
- import { PositionInputDto } from ".";
20
- import { LanguageInputDto } from ".";
21
- import { FaqInputDto } from ".";
22
- import { LocationInputDto } from ".";
23
-
24
- export class CreateDoctorDto {
25
- @IsString()
26
- @MinLength(3)
27
- @MaxLength(50)
28
- name: string;
29
-
30
- @IsEmail()
31
- email: string;
32
-
33
- @IsMongoId()
34
- specialtyId: string;
35
-
36
- @IsOptional()
37
- @IsString()
38
- @MaxLength(500)
39
- biography?: string;
40
-
41
- @IsOptional()
42
- @IsNumber()
43
- @Min(0)
44
- consultationFee?: number;
45
- }
46
-
47
- export class ActivateDoctorAccountDto {
48
- @IsString()
49
- @IsNotEmpty({ message: "Activation token token is required" })
50
- token: string;
51
-
52
- @IsString()
53
- @MinLength(6)
54
- @MaxLength(30)
55
- @IsStrongPassword()
56
- password: string;
57
- }
58
-
59
- export class UpdateDoctorDto {
60
- @IsOptional()
61
- @IsString()
62
- @MinLength(3)
63
- @MaxLength(50)
64
- name: string;
65
-
66
- @IsOptional()
67
- @IsString()
68
- @MaxLength(500)
69
- biography?: string;
70
-
71
- @IsOptional()
72
- @IsNumber()
73
- @Min(0)
74
- consultationFee?: number;
75
-
76
- @IsOptional()
77
- @IsBoolean()
78
- isVisible?: boolean;
79
-
80
- // Replace-all educations array
81
- @IsOptional()
82
- @IsArray()
83
- @ValidateNested({ each: true })
84
- @Type(() => EducationInputDto)
85
- educations?: EducationInputDto[];
86
-
87
- // Replace-all positions array
88
- @IsOptional()
89
- @IsArray()
90
- @ValidateNested({ each: true })
91
- @Type(() => PositionInputDto)
92
- positions?: PositionInputDto[];
93
-
94
- // Replace-all languages array
95
- @IsOptional()
96
- @IsArray()
97
- @ValidateNested({ each: true })
98
- @Type(() => LanguageInputDto)
99
- languages?: LanguageInputDto[];
100
-
101
- // Replace-all FAQs array
102
- @IsOptional()
103
- @IsArray()
104
- @ValidateNested({ each: true })
105
- @Type(() => FaqInputDto)
106
- faqs?: FaqInputDto[];
107
-
108
- // Replace-all expertises array (array of strings)
109
- @IsOptional()
110
- @IsArray()
111
- @ArrayMaxSize(5, { message: "A maximum of 5 expertises is allowed" })
112
- @IsString({ each: true })
113
- expertises?: string[];
114
-
115
- // Optional location object (replace-all when provided)
116
- @IsOptional()
117
- @ValidateNested()
118
- @Type(() => LocationInputDto)
119
- location?: LocationInputDto;
120
- }
@@ -1,11 +0,0 @@
1
- import { IsNotEmpty, IsNumber, IsString, Min } from "class-validator";
2
-
3
- export class EducationInputDto {
4
- @IsNumber({}, { message: "Year must be a number" })
5
- @Min(0, { message: "Year must be greater than or equal to 0" })
6
- year!: number;
7
-
8
- @IsString({ message: "Title must be a string" })
9
- @IsNotEmpty({ message: "Title is required" })
10
- title!: string;
11
- }
@@ -1,11 +0,0 @@
1
- import { IsNotEmpty, IsString } from "class-validator";
2
-
3
- export class FaqInputDto {
4
- @IsString({ message: "Title must be a string" })
5
- @IsNotEmpty({ message: "Title is required" })
6
- title!: string;
7
-
8
- @IsString({ message: "Description must be a string" })
9
- @IsNotEmpty({ message: "Description is required" })
10
- description!: string;
11
- }
@@ -1,13 +0,0 @@
1
- import { IsEnum, IsNotEmpty, IsString } from "class-validator";
2
- import { EnumLanguageLevel } from "../../enums";
3
-
4
- export class LanguageInputDto {
5
- @IsString({ message: "Title must be a string" })
6
- @IsNotEmpty({ message: "Title is required" })
7
- title!: string;
8
-
9
- @IsEnum(EnumLanguageLevel, {
10
- message: "Level must be a valid language level",
11
- })
12
- level!: EnumLanguageLevel;
13
- }
@@ -1,31 +0,0 @@
1
- import { IsNumber, IsOptional, IsString } from "class-validator";
2
-
3
- export class LocationInputDto {
4
- @IsOptional()
5
- @IsString()
6
- address?: string;
7
-
8
- @IsOptional()
9
- @IsString()
10
- city?: string;
11
-
12
- @IsOptional()
13
- @IsString()
14
- country?: string; // ISO code eg: fr
15
-
16
- @IsOptional()
17
- @IsNumber()
18
- lat?: number;
19
-
20
- @IsOptional()
21
- @IsNumber()
22
- lng?: number;
23
-
24
- @IsOptional()
25
- @IsString()
26
- zipcode?: string;
27
-
28
- @IsOptional()
29
- @IsNumber()
30
- distanceInMeters?: number | null;
31
- }
@@ -1,17 +0,0 @@
1
- import { IsEnum, IsNumber, IsOptional, IsString } from "class-validator";
2
- import { Gender } from "../../enums";
3
-
4
- export class UpdatePatientDto {
5
- @IsOptional()
6
- @IsString()
7
- @IsEnum(Gender)
8
- gender?: Gender;
9
-
10
- @IsOptional()
11
- @IsString()
12
- phoneNumber?: string;
13
-
14
- @IsOptional()
15
- @IsNumber()
16
- dob?: number;
17
- }
@@ -1,21 +0,0 @@
1
- import { IsNotEmpty, IsNumber, IsOptional, IsString, Min } from "class-validator";
2
-
3
- export class PositionInputDto {
4
- @IsNumber({}, { message: "Start date must be a number (timestamp in ms)" })
5
- @Min(0, { message: "Start date must be >= 0" })
6
- startDate!: number;
7
-
8
- @IsOptional()
9
- @IsNumber({}, { message: "End date must be a number (timestamp in ms)" })
10
- @Min(0, { message: "End date must be >= 0" })
11
- endDate?: number;
12
-
13
- @IsString({ message: "Title must be a string" })
14
- @IsNotEmpty({ message: "Title is required" })
15
- title!: string;
16
-
17
- @IsString({ message: "Company must be a string" })
18
- @IsNotEmpty({ message: "Company is required" })
19
- company!: string;
20
- }
21
-
@@ -1,40 +0,0 @@
1
- import {
2
- IsNotEmpty,
3
- IsOptional,
4
- IsString,
5
- ValidateNested,
6
- } from "class-validator";
7
- import { Type } from "class-transformer";
8
-
9
- export class LocalizedSpecialtyDto {
10
- @IsString()
11
- @IsNotEmpty()
12
- name!: string;
13
-
14
- @IsOptional()
15
- @IsString()
16
- description?: string | null;
17
- }
18
-
19
- export class CreateSpecialtyDto {
20
- @ValidateNested()
21
- @Type(() => LocalizedSpecialtyDto)
22
- en!: LocalizedSpecialtyDto;
23
-
24
- @IsOptional()
25
- @ValidateNested()
26
- @Type(() => LocalizedSpecialtyDto)
27
- fr?: LocalizedSpecialtyDto;
28
- }
29
-
30
- export class UpdateSpecialtyDto {
31
- @IsOptional()
32
- @ValidateNested()
33
- @Type(() => LocalizedSpecialtyDto)
34
- en?: LocalizedSpecialtyDto;
35
-
36
- @IsOptional()
37
- @ValidateNested()
38
- @Type(() => LocalizedSpecialtyDto)
39
- fr?: LocalizedSpecialtyDto;
40
- }
@@ -1,87 +0,0 @@
1
- import {
2
- IsEmail,
3
- IsNotEmpty,
4
- IsOptional,
5
- IsString,
6
- IsStrongPassword,
7
- MaxLength,
8
- MinLength,
9
- } from "class-validator";
10
-
11
- export class CreateUserDto {
12
- @IsString()
13
- @MinLength(3)
14
- @MaxLength(50)
15
- name: string;
16
-
17
- @IsEmail()
18
- email: string;
19
-
20
- @IsString()
21
- @MinLength(6)
22
- @MaxLength(30)
23
- @IsStrongPassword()
24
- password: string;
25
- }
26
-
27
- export class LoginDto {
28
- @IsEmail({}, { message: "Please enter a valid email address" })
29
- @IsNotEmpty({ message: "Email is required" })
30
- email: string;
31
-
32
- @IsString({ message: "Password must be a string" })
33
- @IsNotEmpty({ message: "Password is required" })
34
- password: string;
35
- }
36
-
37
- export class RefreshTokenDto {
38
- @IsString({ message: "Refresh token must be a string" })
39
- @IsNotEmpty({ message: "Refresh token is required" })
40
- refreshToken: string;
41
- }
42
-
43
- export class ActivateAccountDto {
44
- @IsString({ message: "Token must be a string" })
45
- @IsNotEmpty({ message: "Token is required" })
46
- token: string;
47
- }
48
-
49
- export class ForgotPasswordDto {
50
- @IsEmail({}, { message: "Please enter a valid email address" })
51
- @IsNotEmpty({ message: "Email is required" })
52
- email: string;
53
- }
54
-
55
- export class ResetPasswordDto {
56
- @IsString({ message: "Token must be a string" })
57
- @IsNotEmpty({ message: "Token is required" })
58
- token: string;
59
-
60
- @IsString()
61
- @MinLength(6)
62
- @MaxLength(30)
63
- @IsStrongPassword()
64
- password: string;
65
- }
66
-
67
- export class UpdateUserDto {
68
- @IsOptional()
69
- @IsString()
70
- @MinLength(3)
71
- @MaxLength(50)
72
- name: string;
73
- }
74
-
75
- export class UpdatePasswordDto {
76
- @IsString()
77
- @MinLength(6)
78
- @MaxLength(30)
79
- @IsStrongPassword()
80
- oldPassword: string;
81
-
82
- @IsString()
83
- @MinLength(6)
84
- @MaxLength(30)
85
- @IsStrongPassword()
86
- newPassword: string;
87
- }
@@ -1,90 +0,0 @@
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 ".";
9
-
10
- // Base DTO for everyone
11
- export class DoctorOutputDto {
12
- id: string;
13
- user: UserOutputDto;
14
- specialty: SpecialtyOutputDto;
15
- name: string;
16
- biography: string | null;
17
- slug: string;
18
- isActive: boolean;
19
- consultationFee: number | null;
20
- isVerified: boolean;
21
- isVisible: boolean;
22
- photo: string | null;
23
- educations: EducationOutputDto[];
24
- positions: PositionOutputDto[];
25
- languages: LanguageOutputDto[];
26
- faqs: FaqOutputDto[];
27
- expertises: string[];
28
- location: LocationOutputDto | null;
29
-
30
- isDeleted: boolean;
31
- createdAt: number;
32
- updatedAt: number;
33
-
34
- constructor(doctor: IDoctorDocument) {
35
- this.id = doctor.id.toString();
36
- this.user = new UserOutputDto(doctor.user);
37
- this.name = doctor.name;
38
- this.specialty = new SpecialtyOutputDto(doctor.specialty);
39
- this.slug = doctor.slug;
40
- this.biography = doctor.biography || null;
41
- this.isActive = doctor.isActive;
42
- this.consultationFee = doctor.consultationFee ?? null;
43
- this.isVerified = doctor.isVerified;
44
- this.isVisible = doctor.isVisible;
45
- this.photo = doctor.photo || null;
46
- this.educations = (doctor.educations || [])
47
- .map((e) => new EducationOutputDto(e))
48
- .sort((a, b) => b.year - a.year);
49
- this.positions = (doctor.positions || [])
50
- .map((p) => new PositionOutputDto(p))
51
- .sort((a, b) => b.startDate - a.startDate);
52
- this.languages = (doctor.languages || []).map(
53
- (l) => new LanguageOutputDto(l)
54
- );
55
- this.faqs = (doctor.faqs || []).map((f) => new FaqOutputDto(f));
56
- this.expertises = doctor.expertises || [];
57
- this.location = doctor.location
58
- ? new LocationOutputDto(doctor.location)
59
- : null;
60
- this.isDeleted = doctor.isDeleted;
61
- this.createdAt = doctor.createdAt;
62
- this.updatedAt = doctor.updatedAt;
63
- }
64
- }
65
-
66
- // Extended DTO for admin responses
67
- export class DoctorAdminOutputDto extends DoctorOutputDto {
68
- isDeactivatedByAdmin: boolean | null;
69
- createdBy: UserOutputDto | null;
70
- updatedBy: UserOutputDto | null;
71
- deletedBy: UserOutputDto | null;
72
-
73
- constructor(doctor: IDoctorDocument) {
74
- super(doctor); // call base constructor
75
-
76
- this.isDeactivatedByAdmin = doctor.isDeactivatedByAdmin ?? null;
77
-
78
- this.createdBy = doctor.createdBy
79
- ? new UserOutputDto(doctor.createdBy)
80
- : null;
81
-
82
- this.updatedBy = doctor.updatedBy
83
- ? new UserOutputDto(doctor.updatedBy)
84
- : null;
85
-
86
- this.deletedBy = doctor.deletedBy
87
- ? new UserOutputDto(doctor.deletedBy)
88
- : null;
89
- }
90
- }
@@ -1,11 +0,0 @@
1
- import { IEducation } from "../../models";
2
-
3
- export class EducationOutputDto {
4
- year: number;
5
- title: string;
6
-
7
- constructor(edu: IEducation) {
8
- this.year = edu.year;
9
- this.title = edu.title;
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- import { IFaq } from "../../models";
2
-
3
- export class FaqOutputDto {
4
- title: string;
5
- description: string;
6
-
7
- constructor(f: IFaq) {
8
- this.title = f.title;
9
- this.description = f.description;
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- import { ILanguage } from "../../models";
2
-
3
- export class LanguageOutputDto {
4
- title: string;
5
- level: string;
6
-
7
- constructor(lang: ILanguage) {
8
- this.title = lang.title;
9
- this.level = lang.level;
10
- }
11
- }
@@ -1,21 +0,0 @@
1
- import { ILocation } from "../../models";
2
-
3
- export class LocationOutputDto {
4
- address: string | null;
5
- city: string | null;
6
- country: string | null;
7
- lat: number | null;
8
- lng: number | null;
9
- zipcode: string | null;
10
- distanceInMeters: number | null;
11
-
12
- constructor(loc: ILocation) {
13
- this.address = loc.address ?? null;
14
- this.city = loc.city ?? null;
15
- this.country = loc.country ?? null;
16
- this.lat = loc.lat ?? null;
17
- this.lng = loc.lng ?? null;
18
- this.zipcode = loc.zipcode ?? null;
19
- this.distanceInMeters = loc.distanceInMeters ?? null;
20
- }
21
- }
@@ -1,49 +0,0 @@
1
- import { Gender } from "../../enums";
2
- import { IPatientDocument } from "../../models";
3
- import { UserOutputDto } from ".";
4
-
5
- // Base DTO for everyone
6
- export class PatientOutputDto {
7
- id: string;
8
- user: UserOutputDto;
9
- dob: number | null;
10
- phoneNumber: string | null;
11
- gender: Gender | null;
12
- isDeleted: boolean;
13
- createdAt: number;
14
- updatedAt: number;
15
-
16
- constructor(patient: IPatientDocument) {
17
- this.id = patient.id.toString();
18
- this.user = new UserOutputDto(patient.user);
19
- this.dob = patient.dob || null;
20
- this.phoneNumber = patient.phoneNumber || null;
21
- this.gender = patient.gender || null;
22
- this.isDeleted = patient.isDeleted;
23
- this.createdAt = patient.createdAt;
24
- this.updatedAt = patient.updatedAt;
25
- }
26
- }
27
-
28
- // Extended DTO for admin responses
29
- export class PatientAdminOutputDto extends PatientOutputDto {
30
- createdBy: UserOutputDto | null;
31
- updatedBy: UserOutputDto | null;
32
- deletedBy: UserOutputDto | null;
33
-
34
- constructor(patient: IPatientDocument) {
35
- super(patient); // call base constructor
36
-
37
- this.createdBy = patient.createdBy
38
- ? new UserOutputDto(patient.createdBy)
39
- : null;
40
-
41
- this.updatedBy = patient.updatedBy
42
- ? new UserOutputDto(patient.updatedBy)
43
- : null;
44
-
45
- this.deletedBy = patient.deletedBy
46
- ? new UserOutputDto(patient.deletedBy)
47
- : null;
48
- }
49
- }
@@ -1,15 +0,0 @@
1
- import { IPosition } from "../../models";
2
-
3
- export class PositionOutputDto {
4
- startDate: number;
5
- endDate: number | null;
6
- title: string;
7
- company: string;
8
-
9
- constructor(pos: IPosition) {
10
- this.startDate = pos.startDate;
11
- this.endDate = pos.endDate ?? null;
12
- this.title = pos.title;
13
- this.company = pos.company;
14
- }
15
- }
@@ -1,53 +0,0 @@
1
- import { ISpecialtyDocument } from "../../models";
2
- import { UserOutputDto } from ".";
3
-
4
- // Base DTO for everyone
5
- export class SpecialtyOutputDto {
6
- id: string;
7
- en: { name: string; description: string | null };
8
- fr: { name: string; description: string | null } | null;
9
-
10
- isDeleted: boolean;
11
- createdAt: number;
12
- updatedAt: number;
13
-
14
- constructor(specialty: ISpecialtyDocument) {
15
- this.id = specialty.id.toString();
16
- this.en = {
17
- name: specialty.en.name,
18
- description: specialty.en.description || null,
19
- };
20
- this.fr = specialty.fr
21
- ? {
22
- name: specialty.fr.name,
23
- description: specialty.fr.description || null,
24
- }
25
- : null;
26
- this.isDeleted = specialty.isDeleted;
27
- this.createdAt = specialty.createdAt;
28
- this.updatedAt = specialty.updatedAt;
29
- }
30
- }
31
-
32
- // Extended DTO for admin responses
33
- export class SpecialtyAdminOutputDto extends SpecialtyOutputDto {
34
- createdBy: UserOutputDto | null;
35
- updatedBy: UserOutputDto | null;
36
- deletedBy: UserOutputDto | null;
37
-
38
- constructor(specialty: ISpecialtyDocument) {
39
- super(specialty); // call base constructor
40
-
41
- this.createdBy = specialty.createdBy
42
- ? new UserOutputDto(specialty.createdBy)
43
- : null;
44
-
45
- this.updatedBy = specialty.updatedBy
46
- ? new UserOutputDto(specialty.updatedBy)
47
- : null;
48
-
49
- this.deletedBy = specialty.deletedBy
50
- ? new UserOutputDto(specialty.deletedBy)
51
- : null;
52
- }
53
- }
@@ -1,57 +0,0 @@
1
- import { IUserDocument } from "../../models";
2
-
3
- // Base DTO for everyone
4
- export class UserOutputDto {
5
- id: string;
6
- name: string;
7
- email: string;
8
- role: string;
9
- isActive: boolean;
10
- isDeleted: boolean;
11
- createdAt: number;
12
- updatedAt: number;
13
-
14
- constructor(user: IUserDocument) {
15
- this.id = user.id.toString();
16
- this.name = user.name;
17
- this.email = user.email;
18
- this.role = user.role;
19
-
20
- this.isActive = user.isActive;
21
- this.isDeleted = user.isDeleted;
22
- this.createdAt = user.createdAt;
23
- this.updatedAt = user.updatedAt;
24
- }
25
- }
26
-
27
- // Extended DTO for admin responses
28
- export class UserAdminOutputDto extends UserOutputDto {
29
- createdBy: UserOutputDto | null;
30
- updatedBy: UserOutputDto | null;
31
- deletedBy: UserOutputDto | null;
32
-
33
- constructor(user: IUserDocument) {
34
- super(user); // call base constructor
35
-
36
- this.createdBy = user.createdBy ? new UserOutputDto(user.createdBy) : null;
37
- this.updatedBy = user.updatedBy ? new UserOutputDto(user.updatedBy) : null;
38
- this.deletedBy = user.deletedBy ? new UserOutputDto(user.deletedBy) : null;
39
- }
40
- }
41
-
42
- // DTO for logged-in user responses
43
- export class LoggedInUserOutputDto {
44
- user: UserOutputDto | UserAdminOutputDto;
45
- accessToken: string;
46
- refreshToken: string;
47
-
48
- constructor(
49
- user: UserOutputDto | UserAdminOutputDto,
50
- accessToken: string,
51
- refreshToken: string
52
- ) {
53
- this.user = user;
54
- this.accessToken = accessToken;
55
- this.refreshToken = refreshToken;
56
- }
57
- }
@@ -1,4 +0,0 @@
1
- export enum Gender {
2
- MALE = "MALE",
3
- FEMALE = "FEMALE",
4
- }