@blackcode_sa/metaestetics-api 1.14.78 → 1.14.79
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 +5 -0
- package/dist/admin/index.d.ts +5 -0
- package/dist/admin/index.js +47 -5
- package/dist/admin/index.mjs +47 -5
- package/dist/index.js +7 -5
- package/dist/index.mjs +7 -5
- package/package.json +1 -1
- package/src/admin/aggregation/appointment/appointment.aggregation.service.ts +59 -6
- package/src/services/__tests__/auth/auth.mock.test.ts +2 -2
- package/src/services/__tests__/auth/auth.setup.ts +6 -1
- package/src/services/__tests__/auth.service.test.ts +8 -44
- package/src/services/__tests__/base.service.test.ts +4 -45
- package/src/services/__tests__/user.service.test.ts +6 -4
- package/src/services/appointment/utils/appointment.utils.ts +0 -3
- package/src/services/appointment/utils/extended-procedure.utils.ts +1 -0
- package/src/services/auth/auth.v2.service.ts +7 -7
- package/src/services/clinic/__tests__/clinic-admin.service.test.ts +11 -33
- package/src/services/clinic/__tests__/clinic-group.service.test.ts +21 -151
- package/src/services/clinic/__tests__/clinic.service.test.ts +17 -69
- package/src/services/clinic/utils/clinic-group.utils.ts +2 -2
- package/src/services/clinic/utils/clinic.utils.ts +28 -22
- package/src/services/clinic/utils/index.ts +0 -1
- package/src/services/notifications/__tests__/notification.service.test.ts +5 -5
- package/src/services/patient/__tests__/patient.service.test.ts +17 -25
- package/src/services/patient/utils/docs.utils.ts +1 -1
- package/src/services/user/user.v2.service.ts +4 -3
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
NotificationStatus,
|
|
5
5
|
NotificationType,
|
|
6
6
|
NOTIFICATIONS_COLLECTION,
|
|
7
|
-
|
|
7
|
+
AppointmentStatusChangeNotification,
|
|
8
8
|
} from "../../../types/notifications";
|
|
9
9
|
import { UserRole } from "../../../types";
|
|
10
10
|
import {
|
|
@@ -37,18 +37,18 @@ jest.mock("../../../config/firebase", () => ({
|
|
|
37
37
|
describe("NotificationService", () => {
|
|
38
38
|
let service: NotificationService;
|
|
39
39
|
const mockNotification: Omit<
|
|
40
|
-
|
|
40
|
+
AppointmentStatusChangeNotification,
|
|
41
41
|
"id" | "createdAt" | "updatedAt"
|
|
42
42
|
> = {
|
|
43
43
|
title: "Test Notification",
|
|
44
44
|
body: "Test Body",
|
|
45
|
-
notificationType: NotificationType.
|
|
45
|
+
notificationType: NotificationType.APPOINTMENT_STATUS_CHANGE,
|
|
46
46
|
userId: "test-user-id",
|
|
47
47
|
status: NotificationStatus.PENDING,
|
|
48
48
|
isRead: false,
|
|
49
49
|
userRole: UserRole.PATIENT,
|
|
50
50
|
appointmentId: "test-appointment-id",
|
|
51
|
-
|
|
51
|
+
newStatus: "confirmed",
|
|
52
52
|
previousStatus: "pending",
|
|
53
53
|
notificationTime: Timestamp.now(),
|
|
54
54
|
notificationTokens: ["test-token"],
|
|
@@ -64,7 +64,7 @@ describe("NotificationService", () => {
|
|
|
64
64
|
|
|
65
65
|
beforeEach(async () => {
|
|
66
66
|
jest.clearAllMocks();
|
|
67
|
-
service = new NotificationService();
|
|
67
|
+
service = new NotificationService({} as any, {} as any, {} as any);
|
|
68
68
|
await (service as any).initialized;
|
|
69
69
|
}, 10000);
|
|
70
70
|
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
CreatePatientProfileData,
|
|
5
5
|
PATIENTS_COLLECTION,
|
|
6
6
|
Gender,
|
|
7
|
-
|
|
7
|
+
LocationData,
|
|
8
8
|
} from "../../../types/patient";
|
|
9
9
|
import { UserRole } from "../../../types";
|
|
10
10
|
import {
|
|
@@ -44,7 +44,7 @@ jest.mock("../../../config/firebase");
|
|
|
44
44
|
|
|
45
45
|
describe("PatientService", () => {
|
|
46
46
|
let service: PatientService;
|
|
47
|
-
const mockLocation:
|
|
47
|
+
const mockLocation: LocationData = {
|
|
48
48
|
latitude: 44.8125,
|
|
49
49
|
longitude: 20.4612,
|
|
50
50
|
geohash: "mock-geohash",
|
|
@@ -52,28 +52,26 @@ describe("PatientService", () => {
|
|
|
52
52
|
|
|
53
53
|
const mockCreateData: CreatePatientProfileData = {
|
|
54
54
|
userRef: "test-user-id",
|
|
55
|
-
|
|
56
|
-
lastName: "Patient",
|
|
57
|
-
gender: Gender.MALE,
|
|
58
|
-
contactInfo: {
|
|
59
|
-
email: "test@example.com",
|
|
60
|
-
phoneNumber: "+381601234567",
|
|
61
|
-
},
|
|
62
|
-
location: {
|
|
63
|
-
latitude: mockLocation.latitude,
|
|
64
|
-
longitude: mockLocation.longitude,
|
|
65
|
-
geohash: mockLocation.geohash,
|
|
66
|
-
},
|
|
55
|
+
displayName: "Test Patient",
|
|
67
56
|
expoTokens: [],
|
|
68
57
|
isActive: true,
|
|
69
58
|
isVerified: false,
|
|
59
|
+
isManual: false,
|
|
70
60
|
};
|
|
71
61
|
|
|
72
62
|
const mockPatientProfile: PatientProfile = {
|
|
73
63
|
...mockCreateData,
|
|
74
|
-
id: mockCreateData.userRef,
|
|
75
|
-
|
|
64
|
+
id: mockCreateData.userRef as string,
|
|
65
|
+
displayName: "Test Patient",
|
|
76
66
|
gamification: { level: 1, points: 0 },
|
|
67
|
+
expoTokens: [],
|
|
68
|
+
isActive: true,
|
|
69
|
+
isVerified: false,
|
|
70
|
+
isManual: false,
|
|
71
|
+
doctors: [],
|
|
72
|
+
clinics: [],
|
|
73
|
+
doctorIds: [],
|
|
74
|
+
clinicIds: [],
|
|
77
75
|
createdAt: Timestamp.now(),
|
|
78
76
|
updatedAt: Timestamp.now(),
|
|
79
77
|
};
|
|
@@ -90,7 +88,7 @@ describe("PatientService", () => {
|
|
|
90
88
|
analytics: null,
|
|
91
89
|
});
|
|
92
90
|
|
|
93
|
-
service = new PatientService();
|
|
91
|
+
service = new PatientService(mockDb as any, mockAuth as any, {} as any);
|
|
94
92
|
|
|
95
93
|
// Mock Firestore functions
|
|
96
94
|
(doc as jest.Mock).mockReturnValue("doc-ref");
|
|
@@ -159,10 +157,6 @@ describe("PatientService", () => {
|
|
|
159
157
|
expect.objectContaining({
|
|
160
158
|
...mockCreateData,
|
|
161
159
|
id: mockCreateData.userRef,
|
|
162
|
-
location: {
|
|
163
|
-
...mockCreateData.location,
|
|
164
|
-
geohash: "hash123",
|
|
165
|
-
},
|
|
166
160
|
gamification: { level: 1, points: 0 },
|
|
167
161
|
})
|
|
168
162
|
);
|
|
@@ -174,8 +168,7 @@ describe("PatientService", () => {
|
|
|
174
168
|
it("treba da vrati profil pacijenta ako postoji", async () => {
|
|
175
169
|
const mockProfile = {
|
|
176
170
|
id: "test-user-id",
|
|
177
|
-
|
|
178
|
-
lastName: "User",
|
|
171
|
+
displayName: "Test User",
|
|
179
172
|
createdAt: mockTimestamp.now().toDate(),
|
|
180
173
|
updatedAt: mockTimestamp.now().toDate(),
|
|
181
174
|
};
|
|
@@ -214,8 +207,7 @@ describe("PatientService", () => {
|
|
|
214
207
|
describe("updatePatientProfile", () => {
|
|
215
208
|
it("treba da ažurira profil pacijenta", async () => {
|
|
216
209
|
const updates = {
|
|
217
|
-
|
|
218
|
-
lastName: "Name",
|
|
210
|
+
displayName: "Updated Name",
|
|
219
211
|
};
|
|
220
212
|
const mockTimestamp = new Date();
|
|
221
213
|
(serverTimestamp as jest.Mock).mockReturnValue(mockTimestamp);
|
|
@@ -120,7 +120,7 @@ export const initSensitiveInfoDocIfNotExists = async (
|
|
|
120
120
|
)
|
|
121
121
|
);
|
|
122
122
|
|
|
123
|
-
await createSensitiveInfoUtil(db, defaultSensitiveInfo, userRef);
|
|
123
|
+
await createSensitiveInfoUtil(db, defaultSensitiveInfo, userRef, []);
|
|
124
124
|
|
|
125
125
|
// Verify document was created
|
|
126
126
|
const verifyDoc = await getDoc(sensitiveInfoRef);
|
|
@@ -170,6 +170,7 @@ export class UserServiceV2 extends BaseService {
|
|
|
170
170
|
},
|
|
171
171
|
isActive: true,
|
|
172
172
|
isVerified: false,
|
|
173
|
+
isManual: false,
|
|
173
174
|
});
|
|
174
175
|
profiles.patientProfile = patientProfile.id;
|
|
175
176
|
break;
|
|
@@ -260,7 +261,7 @@ export class UserServiceV2 extends BaseService {
|
|
|
260
261
|
}
|
|
261
262
|
|
|
262
263
|
const userData = userDoc.data();
|
|
263
|
-
return userSchema.parse(userData);
|
|
264
|
+
return userSchema.parse(userData) as User;
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
/**
|
|
@@ -274,7 +275,7 @@ export class UserServiceV2 extends BaseService {
|
|
|
274
275
|
if (querySnapshot.empty) return null;
|
|
275
276
|
|
|
276
277
|
const userData = querySnapshot.docs[0].data();
|
|
277
|
-
return userSchema.parse(userData);
|
|
278
|
+
return userSchema.parse(userData) as User;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
async getUsersByRole(role: UserRole): Promise<User[]> {
|
|
@@ -285,7 +286,7 @@ export class UserServiceV2 extends BaseService {
|
|
|
285
286
|
const querySnapshot = await getDocs(q);
|
|
286
287
|
|
|
287
288
|
const users = querySnapshot.docs.map((doc) => doc.data());
|
|
288
|
-
return Promise.all(users.map((userData) => userSchema.parse(userData)));
|
|
289
|
+
return Promise.all(users.map((userData) => userSchema.parse(userData) as User));
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
/**
|