@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.
@@ -6,6 +6,5 @@
6
6
  export * from "./clinic.utils";
7
7
  export * from "./clinic-group.utils";
8
8
  export * from "./admin.utils";
9
- export * from "./review.utils";
10
9
  export * from "./tag.utils";
11
10
  export * from "./search.utils";
@@ -4,7 +4,7 @@ import {
4
4
  NotificationStatus,
5
5
  NotificationType,
6
6
  NOTIFICATIONS_COLLECTION,
7
- AppointmentNotification,
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
- AppointmentNotification,
40
+ AppointmentStatusChangeNotification,
41
41
  "id" | "createdAt" | "updatedAt"
42
42
  > = {
43
43
  title: "Test Notification",
44
44
  body: "Test Body",
45
- notificationType: NotificationType.APPOINTMENT_NOTIFICATION,
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
- appointmentStatus: "confirmed",
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
- Location,
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: Location = {
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
- firstName: "Test",
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
- location: mockLocation,
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
- firstName: "Test",
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
- firstName: "Updated",
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
  /**