@blackcode_sa/metaestetics-api 1.7.20 → 1.7.21
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/dist/admin/index.d.mts +0 -1
- package/dist/admin/index.d.ts +0 -1
- package/dist/index.d.mts +39 -19
- package/dist/index.d.ts +39 -19
- package/dist/index.js +1116 -951
- package/dist/index.mjs +1132 -965
- package/package.json +1 -1
- package/src/services/patient/patient.service.ts +162 -10
- package/src/services/patient/utils/profile.utils.ts +124 -135
- package/src/services/patient/utils/sensitive.utils.ts +76 -2
- package/src/types/patient/index.ts +25 -23
- package/src/validations/patient.schema.ts +4 -4
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { Timestamp, FieldValue } from
|
|
2
|
-
import { User } from
|
|
3
|
-
import type { PatientMedicalInfo } from
|
|
4
|
-
import { PATIENT_MEDICAL_INFO_COLLECTION } from
|
|
1
|
+
import { Timestamp, FieldValue } from "firebase/firestore";
|
|
2
|
+
import { User } from "..";
|
|
3
|
+
import type { PatientMedicalInfo } from "./medical-info.types";
|
|
4
|
+
import { PATIENT_MEDICAL_INFO_COLLECTION } from "./medical-info.types";
|
|
5
|
+
import type { MediaResource } from "../../services/media/media.service";
|
|
5
6
|
|
|
6
|
-
export const PATIENTS_COLLECTION =
|
|
7
|
-
export const PATIENT_SENSITIVE_INFO_COLLECTION =
|
|
8
|
-
export const PATIENT_MEDICAL_HISTORY_COLLECTION =
|
|
9
|
-
export const PATIENT_APPOINTMENTS_COLLECTION =
|
|
10
|
-
export const PATIENT_LOCATION_INFO_COLLECTION =
|
|
7
|
+
export const PATIENTS_COLLECTION = "patients";
|
|
8
|
+
export const PATIENT_SENSITIVE_INFO_COLLECTION = "sensitive-info";
|
|
9
|
+
export const PATIENT_MEDICAL_HISTORY_COLLECTION = "medical-history";
|
|
10
|
+
export const PATIENT_APPOINTMENTS_COLLECTION = "appointments";
|
|
11
|
+
export const PATIENT_LOCATION_INFO_COLLECTION = "location-info";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Enumeracija za pol pacijenta
|
|
14
15
|
*/
|
|
15
16
|
export enum Gender {
|
|
16
|
-
MALE =
|
|
17
|
-
FEMALE =
|
|
18
|
-
TRANSGENDER_MALE =
|
|
19
|
-
TRANSGENDER_FEMALE =
|
|
20
|
-
PREFER_NOT_TO_SAY =
|
|
21
|
-
OTHER =
|
|
17
|
+
MALE = "male",
|
|
18
|
+
FEMALE = "female",
|
|
19
|
+
TRANSGENDER_MALE = "transgender_male",
|
|
20
|
+
TRANSGENDER_FEMALE = "transgender_female",
|
|
21
|
+
PREFER_NOT_TO_SAY = "prefer_not_to_say",
|
|
22
|
+
OTHER = "other",
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -83,7 +84,8 @@ export interface CreatePatientLocationInfoData {
|
|
|
83
84
|
/**
|
|
84
85
|
* Tip za ažuriranje lokacijskih informacija
|
|
85
86
|
*/
|
|
86
|
-
export interface UpdatePatientLocationInfoData
|
|
87
|
+
export interface UpdatePatientLocationInfoData
|
|
88
|
+
extends Partial<CreatePatientLocationInfoData> {
|
|
87
89
|
updatedAt?: FieldValue;
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -93,7 +95,7 @@ export interface UpdatePatientLocationInfoData extends Partial<CreatePatientLoca
|
|
|
93
95
|
export interface PatientSensitiveInfo {
|
|
94
96
|
patientId: string;
|
|
95
97
|
userRef: string;
|
|
96
|
-
photoUrl?: string;
|
|
98
|
+
photoUrl?: string | null;
|
|
97
99
|
firstName: string;
|
|
98
100
|
lastName: string;
|
|
99
101
|
dateOfBirth: Timestamp | null;
|
|
@@ -113,7 +115,7 @@ export interface PatientSensitiveInfo {
|
|
|
113
115
|
export interface CreatePatientSensitiveInfoData {
|
|
114
116
|
patientId: string;
|
|
115
117
|
userRef: string;
|
|
116
|
-
photoUrl?:
|
|
118
|
+
photoUrl?: MediaResource | null;
|
|
117
119
|
firstName: string;
|
|
118
120
|
lastName: string;
|
|
119
121
|
dateOfBirth: Timestamp | null;
|
|
@@ -128,7 +130,8 @@ export interface CreatePatientSensitiveInfoData {
|
|
|
128
130
|
/**
|
|
129
131
|
* Tip za ažuriranje osetljivih informacija
|
|
130
132
|
*/
|
|
131
|
-
export interface UpdatePatientSensitiveInfoData
|
|
133
|
+
export interface UpdatePatientSensitiveInfoData
|
|
134
|
+
extends Partial<CreatePatientSensitiveInfoData> {
|
|
132
135
|
updatedAt?: FieldValue;
|
|
133
136
|
}
|
|
134
137
|
|
|
@@ -161,7 +164,6 @@ export interface PatientProfile {
|
|
|
161
164
|
id: string;
|
|
162
165
|
userRef: string;
|
|
163
166
|
displayName: string; // Inicijali ili pseudonim
|
|
164
|
-
profilePhoto: string | null; // URL slike
|
|
165
167
|
gamification: GamificationInfo;
|
|
166
168
|
expoTokens: string[];
|
|
167
169
|
isActive: boolean;
|
|
@@ -196,7 +198,7 @@ export interface CreatePatientProfileData {
|
|
|
196
198
|
* Tip za ažuriranje Patient profila
|
|
197
199
|
*/
|
|
198
200
|
export interface UpdatePatientProfileData
|
|
199
|
-
extends Partial<Omit<PatientProfile,
|
|
201
|
+
extends Partial<Omit<PatientProfile, "id" | "createdAt" | "updatedAt">> {
|
|
200
202
|
// Use Omit to exclude base fields
|
|
201
203
|
updatedAt?: FieldValue;
|
|
202
204
|
// Note: doctors, clinics, doctorIds, clinicIds should ideally be updated via specific methods (add/removeDoctor/Clinic)
|
|
@@ -219,14 +221,14 @@ export interface RequesterInfo {
|
|
|
219
221
|
/** ID of the clinic admin user or practitioner user making the request. */
|
|
220
222
|
id: string;
|
|
221
223
|
/** Role of the requester, determining the search context. */
|
|
222
|
-
role:
|
|
224
|
+
role: "clinic_admin" | "practitioner";
|
|
223
225
|
/** If role is 'clinic_admin', this is the associated clinic ID. */
|
|
224
226
|
associatedClinicId?: string;
|
|
225
227
|
/** If role is 'practitioner', this is the associated practitioner profile ID. */
|
|
226
228
|
associatedPractitionerId?: string;
|
|
227
229
|
}
|
|
228
230
|
|
|
229
|
-
export * from
|
|
231
|
+
export * from "./medical-info.types";
|
|
230
232
|
|
|
231
233
|
// This is a type that combines all the patient data - used only in UI Frontend App
|
|
232
234
|
export interface PatientProfileComplete {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Timestamp } from "firebase/firestore";
|
|
3
3
|
import { Gender } from "../types/patient";
|
|
4
|
+
import { mediaResourceSchema } from "./media.schema";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Šema za validaciju geoprostornih podataka
|
|
@@ -65,7 +66,6 @@ export const createPatientLocationInfoSchema = z.object({
|
|
|
65
66
|
export const patientSensitiveInfoSchema = z.object({
|
|
66
67
|
patientId: z.string(),
|
|
67
68
|
userRef: z.string(),
|
|
68
|
-
photoUrl: z.string().optional(),
|
|
69
69
|
firstName: z.string().min(2),
|
|
70
70
|
lastName: z.string().min(2),
|
|
71
71
|
dateOfBirth: z.instanceof(Timestamp).nullable(),
|
|
@@ -108,11 +108,12 @@ export const patientProfileSchema = z.object({
|
|
|
108
108
|
id: z.string(),
|
|
109
109
|
userRef: z.string(),
|
|
110
110
|
displayName: z.string(),
|
|
111
|
-
profilePhoto: z.string().url().nullable(),
|
|
112
111
|
gamification: gamificationSchema,
|
|
113
112
|
expoTokens: z.array(z.string()),
|
|
114
113
|
isActive: z.boolean(),
|
|
115
114
|
isVerified: z.boolean(),
|
|
115
|
+
phoneNumber: z.string().nullable().optional(),
|
|
116
|
+
dateOfBirth: z.instanceof(Timestamp).nullable().optional(),
|
|
116
117
|
doctors: z.array(patientDoctorSchema),
|
|
117
118
|
clinics: z.array(patientClinicSchema),
|
|
118
119
|
doctorIds: z.array(z.string()),
|
|
@@ -127,7 +128,6 @@ export const patientProfileSchema = z.object({
|
|
|
127
128
|
export const createPatientProfileSchema = z.object({
|
|
128
129
|
userRef: z.string(),
|
|
129
130
|
displayName: z.string(),
|
|
130
|
-
profilePhoto: z.string().url().nullable().optional(),
|
|
131
131
|
expoTokens: z.array(z.string()),
|
|
132
132
|
gamification: gamificationSchema.optional(),
|
|
133
133
|
isActive: z.boolean(),
|
|
@@ -144,7 +144,7 @@ export const createPatientProfileSchema = z.object({
|
|
|
144
144
|
export const createPatientSensitiveInfoSchema = z.object({
|
|
145
145
|
patientId: z.string(),
|
|
146
146
|
userRef: z.string(),
|
|
147
|
-
photoUrl:
|
|
147
|
+
photoUrl: mediaResourceSchema.nullable().optional(),
|
|
148
148
|
firstName: z.string().min(2),
|
|
149
149
|
lastName: z.string().min(2),
|
|
150
150
|
dateOfBirth: z.instanceof(Timestamp).nullable(),
|