@blackcode_sa/metaestetics-api 1.13.13 → 1.13.15

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.
@@ -843,131 +843,6 @@ interface ProcedureSummaryInfo {
843
843
  practitionerName: string;
844
844
  }
845
845
 
846
- /**
847
- * Osnovne informacije o zdravstvenom radniku
848
- */
849
- interface PractitionerBasicInfo {
850
- firstName: string;
851
- lastName: string;
852
- title: string;
853
- email: string;
854
- phoneNumber: string | null;
855
- dateOfBirth: Timestamp | Date | null;
856
- gender: "male" | "female" | "other";
857
- profileImageUrl?: MediaResource | null;
858
- bio?: string;
859
- languages: string[];
860
- }
861
- /**
862
- * Sertifikacija zdravstvenog radnika
863
- */
864
- interface PractitionerCertification {
865
- level: CertificationLevel;
866
- specialties: CertificationSpecialty[];
867
- licenseNumber: string;
868
- issuingAuthority: string;
869
- issueDate: Timestamp | Date;
870
- expiryDate?: Timestamp | Date | null;
871
- verificationStatus: "pending" | "verified" | "rejected";
872
- }
873
- /**
874
- * Interfejs za radno vreme zdravstvenog radnika u klinici
875
- */
876
- interface PractitionerClinicWorkingHours {
877
- clinicId: string;
878
- workingHours: {
879
- monday: {
880
- start: string;
881
- end: string;
882
- } | null;
883
- tuesday: {
884
- start: string;
885
- end: string;
886
- } | null;
887
- wednesday: {
888
- start: string;
889
- end: string;
890
- } | null;
891
- thursday: {
892
- start: string;
893
- end: string;
894
- } | null;
895
- friday: {
896
- start: string;
897
- end: string;
898
- } | null;
899
- saturday: {
900
- start: string;
901
- end: string;
902
- } | null;
903
- sunday: {
904
- start: string;
905
- end: string;
906
- } | null;
907
- };
908
- isActive: boolean;
909
- createdAt: Timestamp | Date;
910
- updatedAt: Timestamp | Date;
911
- }
912
- /**
913
- * Status of practitioner profile
914
- */
915
- declare enum PractitionerStatus {
916
- DRAFT = "draft",
917
- ACTIVE = "active"
918
- }
919
- /**
920
- * Token status for practitioner invitations
921
- */
922
- declare enum PractitionerTokenStatus {
923
- ACTIVE = "active",
924
- USED = "used",
925
- EXPIRED = "expired",
926
- REVOKED = "revoked"
927
- }
928
- /**
929
- * Interfejs za zdravstvenog radnika
930
- */
931
- interface Practitioner {
932
- id: string;
933
- userRef: string;
934
- basicInfo: PractitionerBasicInfo;
935
- fullNameLower: string;
936
- certification: PractitionerCertification;
937
- clinics: string[];
938
- clinicWorkingHours: PractitionerClinicWorkingHours[];
939
- clinicsInfo: ClinicInfo[];
940
- procedures: string[];
941
- freeConsultations?: Record<string, string> | null;
942
- proceduresInfo: ProcedureSummaryInfo[];
943
- reviewInfo: PractitionerReviewInfo;
944
- isActive: boolean;
945
- isVerified: boolean;
946
- status: PractitionerStatus;
947
- createdAt: Timestamp;
948
- updatedAt: Timestamp;
949
- }
950
- /**
951
- * Token za pozivanje zdravstvenog radnika
952
- */
953
- interface PractitionerToken {
954
- id: string;
955
- token: string;
956
- practitionerId: string;
957
- email: string;
958
- clinicId: string;
959
- status: PractitionerTokenStatus;
960
- createdBy: string;
961
- createdAt: Timestamp;
962
- expiresAt: Timestamp;
963
- usedBy?: string;
964
- usedAt?: Timestamp;
965
- emailSent?: boolean;
966
- emailSentAt?: Timestamp;
967
- emailError?: string;
968
- emailErrorAt?: Timestamp;
969
- }
970
-
971
846
  /**
972
847
  * Enum for all possible clinic tags
973
848
  */
@@ -1266,8 +1141,6 @@ interface DoctorInfo {
1266
1141
  photo: string | null;
1267
1142
  rating: number;
1268
1143
  services: string[];
1269
- status?: PractitionerStatus;
1270
- isActive?: boolean;
1271
1144
  }
1272
1145
  /**
1273
1146
  * Interface for clinic
@@ -1301,6 +1174,131 @@ interface Clinic {
1301
1174
  logo?: MediaResource | null;
1302
1175
  }
1303
1176
 
1177
+ /**
1178
+ * Osnovne informacije o zdravstvenom radniku
1179
+ */
1180
+ interface PractitionerBasicInfo {
1181
+ firstName: string;
1182
+ lastName: string;
1183
+ title: string;
1184
+ email: string;
1185
+ phoneNumber: string | null;
1186
+ dateOfBirth: Timestamp | Date | null;
1187
+ gender: "male" | "female" | "other";
1188
+ profileImageUrl?: MediaResource | null;
1189
+ bio?: string;
1190
+ languages: string[];
1191
+ }
1192
+ /**
1193
+ * Sertifikacija zdravstvenog radnika
1194
+ */
1195
+ interface PractitionerCertification {
1196
+ level: CertificationLevel;
1197
+ specialties: CertificationSpecialty[];
1198
+ licenseNumber: string;
1199
+ issuingAuthority: string;
1200
+ issueDate: Timestamp | Date;
1201
+ expiryDate?: Timestamp | Date | null;
1202
+ verificationStatus: "pending" | "verified" | "rejected";
1203
+ }
1204
+ /**
1205
+ * Interfejs za radno vreme zdravstvenog radnika u klinici
1206
+ */
1207
+ interface PractitionerClinicWorkingHours {
1208
+ clinicId: string;
1209
+ workingHours: {
1210
+ monday: {
1211
+ start: string;
1212
+ end: string;
1213
+ } | null;
1214
+ tuesday: {
1215
+ start: string;
1216
+ end: string;
1217
+ } | null;
1218
+ wednesday: {
1219
+ start: string;
1220
+ end: string;
1221
+ } | null;
1222
+ thursday: {
1223
+ start: string;
1224
+ end: string;
1225
+ } | null;
1226
+ friday: {
1227
+ start: string;
1228
+ end: string;
1229
+ } | null;
1230
+ saturday: {
1231
+ start: string;
1232
+ end: string;
1233
+ } | null;
1234
+ sunday: {
1235
+ start: string;
1236
+ end: string;
1237
+ } | null;
1238
+ };
1239
+ isActive: boolean;
1240
+ createdAt: Timestamp | Date;
1241
+ updatedAt: Timestamp | Date;
1242
+ }
1243
+ /**
1244
+ * Status of practitioner profile
1245
+ */
1246
+ declare enum PractitionerStatus {
1247
+ DRAFT = "draft",
1248
+ ACTIVE = "active"
1249
+ }
1250
+ /**
1251
+ * Token status for practitioner invitations
1252
+ */
1253
+ declare enum PractitionerTokenStatus {
1254
+ ACTIVE = "active",
1255
+ USED = "used",
1256
+ EXPIRED = "expired",
1257
+ REVOKED = "revoked"
1258
+ }
1259
+ /**
1260
+ * Interfejs za zdravstvenog radnika
1261
+ */
1262
+ interface Practitioner {
1263
+ id: string;
1264
+ userRef: string;
1265
+ basicInfo: PractitionerBasicInfo;
1266
+ fullNameLower: string;
1267
+ certification: PractitionerCertification;
1268
+ clinics: string[];
1269
+ clinicWorkingHours: PractitionerClinicWorkingHours[];
1270
+ clinicsInfo: ClinicInfo[];
1271
+ procedures: string[];
1272
+ freeConsultations?: Record<string, string> | null;
1273
+ proceduresInfo: ProcedureSummaryInfo[];
1274
+ reviewInfo: PractitionerReviewInfo;
1275
+ isActive: boolean;
1276
+ isVerified: boolean;
1277
+ status: PractitionerStatus;
1278
+ createdAt: Timestamp;
1279
+ updatedAt: Timestamp;
1280
+ }
1281
+ /**
1282
+ * Token za pozivanje zdravstvenog radnika
1283
+ */
1284
+ interface PractitionerToken {
1285
+ id: string;
1286
+ token: string;
1287
+ practitionerId: string;
1288
+ email: string;
1289
+ clinicId: string;
1290
+ status: PractitionerTokenStatus;
1291
+ createdBy: string;
1292
+ createdAt: Timestamp;
1293
+ expiresAt: Timestamp;
1294
+ usedBy?: string;
1295
+ usedAt?: Timestamp;
1296
+ emailSent?: boolean;
1297
+ emailSentAt?: Timestamp;
1298
+ emailError?: string;
1299
+ emailErrorAt?: Timestamp;
1300
+ }
1301
+
1304
1302
  declare enum AllergyType {
1305
1303
  MEDICATION = "medication",
1306
1304
  FOOD = "food",
@@ -843,131 +843,6 @@ interface ProcedureSummaryInfo {
843
843
  practitionerName: string;
844
844
  }
845
845
 
846
- /**
847
- * Osnovne informacije o zdravstvenom radniku
848
- */
849
- interface PractitionerBasicInfo {
850
- firstName: string;
851
- lastName: string;
852
- title: string;
853
- email: string;
854
- phoneNumber: string | null;
855
- dateOfBirth: Timestamp | Date | null;
856
- gender: "male" | "female" | "other";
857
- profileImageUrl?: MediaResource | null;
858
- bio?: string;
859
- languages: string[];
860
- }
861
- /**
862
- * Sertifikacija zdravstvenog radnika
863
- */
864
- interface PractitionerCertification {
865
- level: CertificationLevel;
866
- specialties: CertificationSpecialty[];
867
- licenseNumber: string;
868
- issuingAuthority: string;
869
- issueDate: Timestamp | Date;
870
- expiryDate?: Timestamp | Date | null;
871
- verificationStatus: "pending" | "verified" | "rejected";
872
- }
873
- /**
874
- * Interfejs za radno vreme zdravstvenog radnika u klinici
875
- */
876
- interface PractitionerClinicWorkingHours {
877
- clinicId: string;
878
- workingHours: {
879
- monday: {
880
- start: string;
881
- end: string;
882
- } | null;
883
- tuesday: {
884
- start: string;
885
- end: string;
886
- } | null;
887
- wednesday: {
888
- start: string;
889
- end: string;
890
- } | null;
891
- thursday: {
892
- start: string;
893
- end: string;
894
- } | null;
895
- friday: {
896
- start: string;
897
- end: string;
898
- } | null;
899
- saturday: {
900
- start: string;
901
- end: string;
902
- } | null;
903
- sunday: {
904
- start: string;
905
- end: string;
906
- } | null;
907
- };
908
- isActive: boolean;
909
- createdAt: Timestamp | Date;
910
- updatedAt: Timestamp | Date;
911
- }
912
- /**
913
- * Status of practitioner profile
914
- */
915
- declare enum PractitionerStatus {
916
- DRAFT = "draft",
917
- ACTIVE = "active"
918
- }
919
- /**
920
- * Token status for practitioner invitations
921
- */
922
- declare enum PractitionerTokenStatus {
923
- ACTIVE = "active",
924
- USED = "used",
925
- EXPIRED = "expired",
926
- REVOKED = "revoked"
927
- }
928
- /**
929
- * Interfejs za zdravstvenog radnika
930
- */
931
- interface Practitioner {
932
- id: string;
933
- userRef: string;
934
- basicInfo: PractitionerBasicInfo;
935
- fullNameLower: string;
936
- certification: PractitionerCertification;
937
- clinics: string[];
938
- clinicWorkingHours: PractitionerClinicWorkingHours[];
939
- clinicsInfo: ClinicInfo[];
940
- procedures: string[];
941
- freeConsultations?: Record<string, string> | null;
942
- proceduresInfo: ProcedureSummaryInfo[];
943
- reviewInfo: PractitionerReviewInfo;
944
- isActive: boolean;
945
- isVerified: boolean;
946
- status: PractitionerStatus;
947
- createdAt: Timestamp;
948
- updatedAt: Timestamp;
949
- }
950
- /**
951
- * Token za pozivanje zdravstvenog radnika
952
- */
953
- interface PractitionerToken {
954
- id: string;
955
- token: string;
956
- practitionerId: string;
957
- email: string;
958
- clinicId: string;
959
- status: PractitionerTokenStatus;
960
- createdBy: string;
961
- createdAt: Timestamp;
962
- expiresAt: Timestamp;
963
- usedBy?: string;
964
- usedAt?: Timestamp;
965
- emailSent?: boolean;
966
- emailSentAt?: Timestamp;
967
- emailError?: string;
968
- emailErrorAt?: Timestamp;
969
- }
970
-
971
846
  /**
972
847
  * Enum for all possible clinic tags
973
848
  */
@@ -1266,8 +1141,6 @@ interface DoctorInfo {
1266
1141
  photo: string | null;
1267
1142
  rating: number;
1268
1143
  services: string[];
1269
- status?: PractitionerStatus;
1270
- isActive?: boolean;
1271
1144
  }
1272
1145
  /**
1273
1146
  * Interface for clinic
@@ -1301,6 +1174,131 @@ interface Clinic {
1301
1174
  logo?: MediaResource | null;
1302
1175
  }
1303
1176
 
1177
+ /**
1178
+ * Osnovne informacije o zdravstvenom radniku
1179
+ */
1180
+ interface PractitionerBasicInfo {
1181
+ firstName: string;
1182
+ lastName: string;
1183
+ title: string;
1184
+ email: string;
1185
+ phoneNumber: string | null;
1186
+ dateOfBirth: Timestamp | Date | null;
1187
+ gender: "male" | "female" | "other";
1188
+ profileImageUrl?: MediaResource | null;
1189
+ bio?: string;
1190
+ languages: string[];
1191
+ }
1192
+ /**
1193
+ * Sertifikacija zdravstvenog radnika
1194
+ */
1195
+ interface PractitionerCertification {
1196
+ level: CertificationLevel;
1197
+ specialties: CertificationSpecialty[];
1198
+ licenseNumber: string;
1199
+ issuingAuthority: string;
1200
+ issueDate: Timestamp | Date;
1201
+ expiryDate?: Timestamp | Date | null;
1202
+ verificationStatus: "pending" | "verified" | "rejected";
1203
+ }
1204
+ /**
1205
+ * Interfejs za radno vreme zdravstvenog radnika u klinici
1206
+ */
1207
+ interface PractitionerClinicWorkingHours {
1208
+ clinicId: string;
1209
+ workingHours: {
1210
+ monday: {
1211
+ start: string;
1212
+ end: string;
1213
+ } | null;
1214
+ tuesday: {
1215
+ start: string;
1216
+ end: string;
1217
+ } | null;
1218
+ wednesday: {
1219
+ start: string;
1220
+ end: string;
1221
+ } | null;
1222
+ thursday: {
1223
+ start: string;
1224
+ end: string;
1225
+ } | null;
1226
+ friday: {
1227
+ start: string;
1228
+ end: string;
1229
+ } | null;
1230
+ saturday: {
1231
+ start: string;
1232
+ end: string;
1233
+ } | null;
1234
+ sunday: {
1235
+ start: string;
1236
+ end: string;
1237
+ } | null;
1238
+ };
1239
+ isActive: boolean;
1240
+ createdAt: Timestamp | Date;
1241
+ updatedAt: Timestamp | Date;
1242
+ }
1243
+ /**
1244
+ * Status of practitioner profile
1245
+ */
1246
+ declare enum PractitionerStatus {
1247
+ DRAFT = "draft",
1248
+ ACTIVE = "active"
1249
+ }
1250
+ /**
1251
+ * Token status for practitioner invitations
1252
+ */
1253
+ declare enum PractitionerTokenStatus {
1254
+ ACTIVE = "active",
1255
+ USED = "used",
1256
+ EXPIRED = "expired",
1257
+ REVOKED = "revoked"
1258
+ }
1259
+ /**
1260
+ * Interfejs za zdravstvenog radnika
1261
+ */
1262
+ interface Practitioner {
1263
+ id: string;
1264
+ userRef: string;
1265
+ basicInfo: PractitionerBasicInfo;
1266
+ fullNameLower: string;
1267
+ certification: PractitionerCertification;
1268
+ clinics: string[];
1269
+ clinicWorkingHours: PractitionerClinicWorkingHours[];
1270
+ clinicsInfo: ClinicInfo[];
1271
+ procedures: string[];
1272
+ freeConsultations?: Record<string, string> | null;
1273
+ proceduresInfo: ProcedureSummaryInfo[];
1274
+ reviewInfo: PractitionerReviewInfo;
1275
+ isActive: boolean;
1276
+ isVerified: boolean;
1277
+ status: PractitionerStatus;
1278
+ createdAt: Timestamp;
1279
+ updatedAt: Timestamp;
1280
+ }
1281
+ /**
1282
+ * Token za pozivanje zdravstvenog radnika
1283
+ */
1284
+ interface PractitionerToken {
1285
+ id: string;
1286
+ token: string;
1287
+ practitionerId: string;
1288
+ email: string;
1289
+ clinicId: string;
1290
+ status: PractitionerTokenStatus;
1291
+ createdBy: string;
1292
+ createdAt: Timestamp;
1293
+ expiresAt: Timestamp;
1294
+ usedBy?: string;
1295
+ usedAt?: Timestamp;
1296
+ emailSent?: boolean;
1297
+ emailSentAt?: Timestamp;
1298
+ emailError?: string;
1299
+ emailErrorAt?: Timestamp;
1300
+ }
1301
+
1304
1302
  declare enum AllergyType {
1305
1303
  MEDICATION = "medication",
1306
1304
  FOOD = "food",
@@ -1307,6 +1307,29 @@ interface ProcedureSummaryInfo {
1307
1307
  practitionerName: string;
1308
1308
  }
1309
1309
 
1310
+ /**
1311
+ * Interface for clinic contact information
1312
+ */
1313
+ interface ClinicContactInfo {
1314
+ email: string;
1315
+ phoneNumber: string;
1316
+ alternativePhoneNumber?: string | null;
1317
+ website?: string | null;
1318
+ }
1319
+ /**
1320
+ * Interface for clinic location
1321
+ */
1322
+ interface ClinicLocation {
1323
+ address: string;
1324
+ city: string;
1325
+ country: string;
1326
+ postalCode: string;
1327
+ latitude: number;
1328
+ longitude: number;
1329
+ geohash?: string | null;
1330
+ tz?: string | null;
1331
+ }
1332
+
1310
1333
  /**
1311
1334
  * Osnovne informacije o zdravstvenom radniku
1312
1335
  */
@@ -1403,29 +1426,6 @@ interface Practitioner {
1403
1426
  updatedAt: Timestamp;
1404
1427
  }
1405
1428
 
1406
- /**
1407
- * Interface for clinic contact information
1408
- */
1409
- interface ClinicContactInfo {
1410
- email: string;
1411
- phoneNumber: string;
1412
- alternativePhoneNumber?: string | null;
1413
- website?: string | null;
1414
- }
1415
- /**
1416
- * Interface for clinic location
1417
- */
1418
- interface ClinicLocation {
1419
- address: string;
1420
- city: string;
1421
- country: string;
1422
- postalCode: string;
1423
- latitude: number;
1424
- longitude: number;
1425
- geohash?: string | null;
1426
- tz?: string | null;
1427
- }
1428
-
1429
1429
  /**
1430
1430
  * Interface for clinic profile information
1431
1431
  */
@@ -1307,6 +1307,29 @@ interface ProcedureSummaryInfo {
1307
1307
  practitionerName: string;
1308
1308
  }
1309
1309
 
1310
+ /**
1311
+ * Interface for clinic contact information
1312
+ */
1313
+ interface ClinicContactInfo {
1314
+ email: string;
1315
+ phoneNumber: string;
1316
+ alternativePhoneNumber?: string | null;
1317
+ website?: string | null;
1318
+ }
1319
+ /**
1320
+ * Interface for clinic location
1321
+ */
1322
+ interface ClinicLocation {
1323
+ address: string;
1324
+ city: string;
1325
+ country: string;
1326
+ postalCode: string;
1327
+ latitude: number;
1328
+ longitude: number;
1329
+ geohash?: string | null;
1330
+ tz?: string | null;
1331
+ }
1332
+
1310
1333
  /**
1311
1334
  * Osnovne informacije o zdravstvenom radniku
1312
1335
  */
@@ -1403,29 +1426,6 @@ interface Practitioner {
1403
1426
  updatedAt: Timestamp;
1404
1427
  }
1405
1428
 
1406
- /**
1407
- * Interface for clinic contact information
1408
- */
1409
- interface ClinicContactInfo {
1410
- email: string;
1411
- phoneNumber: string;
1412
- alternativePhoneNumber?: string | null;
1413
- website?: string | null;
1414
- }
1415
- /**
1416
- * Interface for clinic location
1417
- */
1418
- interface ClinicLocation {
1419
- address: string;
1420
- city: string;
1421
- country: string;
1422
- postalCode: string;
1423
- latitude: number;
1424
- longitude: number;
1425
- geohash?: string | null;
1426
- tz?: string | null;
1427
- }
1428
-
1429
1429
  /**
1430
1430
  * Interface for clinic profile information
1431
1431
  */
package/dist/index.d.mts CHANGED
@@ -5300,8 +5300,6 @@ interface DoctorInfo {
5300
5300
  photo: string | null;
5301
5301
  rating: number;
5302
5302
  services: string[];
5303
- status?: PractitionerStatus;
5304
- isActive?: boolean;
5305
5303
  }
5306
5304
  /**
5307
5305
  * Interface for clinic
@@ -6897,6 +6895,7 @@ declare class ProcedureService extends BaseService {
6897
6895
  isActive?: boolean;
6898
6896
  practitionerId?: string;
6899
6897
  clinicId?: string;
6898
+ excludeDraftPractitioners?: boolean;
6900
6899
  }): Promise<{
6901
6900
  procedures: (Procedure & {
6902
6901
  distance?: number;
package/dist/index.d.ts CHANGED
@@ -5300,8 +5300,6 @@ interface DoctorInfo {
5300
5300
  photo: string | null;
5301
5301
  rating: number;
5302
5302
  services: string[];
5303
- status?: PractitionerStatus;
5304
- isActive?: boolean;
5305
5303
  }
5306
5304
  /**
5307
5305
  * Interface for clinic
@@ -6897,6 +6895,7 @@ declare class ProcedureService extends BaseService {
6897
6895
  isActive?: boolean;
6898
6896
  practitionerId?: string;
6899
6897
  clinicId?: string;
6898
+ excludeDraftPractitioners?: boolean;
6900
6899
  }): Promise<{
6901
6900
  procedures: (Procedure & {
6902
6901
  distance?: number;
package/dist/index.js CHANGED
@@ -13532,25 +13532,17 @@ var import_geofire_common4 = require("geofire-common");
13532
13532
  var import_zod20 = require("zod");
13533
13533
  function filterDoctorsInfo(doctorsInfo) {
13534
13534
  if (!doctorsInfo || doctorsInfo.length === 0) {
13535
- return [];
13535
+ return doctorsInfo || [];
13536
13536
  }
13537
- return doctorsInfo.filter((doctor) => {
13538
- if (doctor.status === "draft" /* DRAFT */) {
13539
- console.log(`[CLINIC_UTILS] Filtering out draft practitioner ${doctor.id} from doctorsInfo`);
13540
- return false;
13541
- }
13542
- if (doctor.isActive === false) {
13543
- console.log(`[CLINIC_UTILS] Filtering out inactive practitioner ${doctor.id} from doctorsInfo`);
13544
- return false;
13545
- }
13546
- return true;
13547
- });
13537
+ return doctorsInfo;
13548
13538
  }
13549
13539
  function filterClinicEmbeddedArrays(clinic, excludeDraftPractitioners = false) {
13550
13540
  if (!clinic) {
13551
13541
  return clinic;
13552
13542
  }
13543
+ console.log(`[CLINIC_UTILS] filterClinicEmbeddedArrays called for clinic ${clinic.id} with excludeDraftPractitioners: ${excludeDraftPractitioners}`);
13553
13544
  if (!excludeDraftPractitioners) {
13545
+ console.log(`[CLINIC_UTILS] Skipping filtering for clinic ${clinic.id} (excludeDraftPractitioners is false)`);
13554
13546
  return clinic;
13555
13547
  }
13556
13548
  const filteredClinic = { ...clinic };
@@ -14046,6 +14038,7 @@ async function getClinicsByFilters(db, filters) {
14046
14038
  }
14047
14039
  let clinics = Array.from(uniqueMap.values());
14048
14040
  const excludeDrafts = filters.excludeDraftPractitioners === true;
14041
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
14049
14042
  clinics = clinics.map((clinic) => filterClinicEmbeddedArrays(clinic, excludeDrafts));
14050
14043
  clinics = applyInMemoryFilters(clinics, filters);
14051
14044
  const pageSize = filters.pagination || 5;
@@ -14101,6 +14094,7 @@ async function getClinicsByFilters(db, filters) {
14101
14094
  const querySnapshot = await (0, import_firestore38.getDocs)(q);
14102
14095
  let clinics = querySnapshot.docs.map((doc47) => ({ ...doc47.data(), id: doc47.id }));
14103
14096
  const excludeDrafts = filters.excludeDraftPractitioners === true;
14097
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
14104
14098
  clinics = clinics.map((clinic) => filterClinicEmbeddedArrays(clinic, excludeDrafts));
14105
14099
  clinics = applyInMemoryFilters(clinics, filters);
14106
14100
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -14135,6 +14129,7 @@ async function getClinicsByFilters(db, filters) {
14135
14129
  const querySnapshot = await (0, import_firestore38.getDocs)(q);
14136
14130
  let clinics = querySnapshot.docs.map((doc47) => ({ ...doc47.data(), id: doc47.id }));
14137
14131
  const excludeDrafts = filters.excludeDraftPractitioners === true;
14132
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
14138
14133
  clinics = clinics.map((clinic) => filterClinicEmbeddedArrays(clinic, excludeDrafts));
14139
14134
  clinics = applyInMemoryFilters(clinics, filters);
14140
14135
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -20086,7 +20081,11 @@ var ProcedureService = class extends BaseService {
20086
20081
  * @returns Filtered array of procedures (excluding invalid/inactive/draft practitioners)
20087
20082
  */
20088
20083
  async filterDraftPractitionerProcedures(procedures) {
20084
+ console.log(`[ProcedureService] filterDraftPractitionerProcedures called with ${procedures.length} procedures, practitionerService available: ${!!this.practitionerService}`);
20089
20085
  if (!this.practitionerService || procedures.length === 0) {
20086
+ if (!this.practitionerService) {
20087
+ console.warn("[ProcedureService] practitionerService not available - skipping filtering");
20088
+ }
20090
20089
  return procedures;
20091
20090
  }
20092
20091
  try {
@@ -20322,11 +20321,7 @@ var ProcedureService = class extends BaseService {
20322
20321
  photo: typeof practitioner.basicInfo.profileImageUrl === "string" ? practitioner.basicInfo.profileImageUrl : "",
20323
20322
  // Default to empty string if not a processed URL
20324
20323
  rating: ((_a = practitioner.reviewInfo) == null ? void 0 : _a.averageRating) || 0,
20325
- services: practitioner.procedures || [],
20326
- status: practitioner.status,
20327
- // Include practitioner status for client-side filtering
20328
- isActive: practitioner.isActive
20329
- // Include isActive flag for client-side filtering
20324
+ services: practitioner.procedures || []
20330
20325
  };
20331
20326
  const { productsMetadata: _, productId: __, photos: ___, ...validatedDataWithoutProductsMetadata } = validatedData;
20332
20327
  const newProcedure = {
@@ -20485,9 +20480,7 @@ var ProcedureService = class extends BaseService {
20485
20480
  description: practitioner.basicInfo.bio || "",
20486
20481
  photo: typeof practitioner.basicInfo.profileImageUrl === "string" ? practitioner.basicInfo.profileImageUrl : "",
20487
20482
  rating: ((_c = practitioner.reviewInfo) == null ? void 0 : _c.averageRating) || 0,
20488
- services: practitioner.procedures || [],
20489
- status: practitioner.status,
20490
- isActive: practitioner.isActive
20483
+ services: practitioner.procedures || []
20491
20484
  };
20492
20485
  const newProcedure = {
20493
20486
  ...sourceProcedure,
@@ -20984,9 +20977,7 @@ var ProcedureService = class extends BaseService {
20984
20977
  photo: typeof newPractitioner.basicInfo.profileImageUrl === "string" ? newPractitioner.basicInfo.profileImageUrl : "",
20985
20978
  // Default to empty string if not a processed URL
20986
20979
  rating: ((_b = newPractitioner.reviewInfo) == null ? void 0 : _b.averageRating) || 0,
20987
- services: newPractitioner.procedures || [],
20988
- status: newPractitioner.status,
20989
- isActive: newPractitioner.isActive
20980
+ services: newPractitioner.procedures || []
20990
20981
  };
20991
20982
  }
20992
20983
  if (validatedData.clinicBranchId && validatedData.clinicBranchId !== oldClinicId) {
@@ -21181,6 +21172,7 @@ var ProcedureService = class extends BaseService {
21181
21172
  async getProceduresByFilters(filters) {
21182
21173
  try {
21183
21174
  console.log("[PROCEDURE_SERVICE] Starting procedure filtering with multiple strategies");
21175
+ console.log("excludeDraftPractitioners is : ", filters.excludeDraftPractitioners);
21184
21176
  if (filters.location && filters.radiusInKm) {
21185
21177
  console.log("[PROCEDURE_SERVICE] Executing geo query:", {
21186
21178
  location: filters.location,
@@ -21270,10 +21262,12 @@ var ProcedureService = class extends BaseService {
21270
21262
  if (hasNestedFilters) {
21271
21263
  procedures = this.applyInMemoryFilters(procedures, filters);
21272
21264
  }
21273
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21265
+ if (filters.excludeDraftPractitioners) {
21266
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21267
+ }
21274
21268
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
21275
21269
  console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures`);
21276
- if (procedures.length < (filters.pagination || 10)) {
21270
+ if (querySnapshot.docs.length < (filters.pagination || 10)) {
21277
21271
  return { procedures, lastDoc: null };
21278
21272
  }
21279
21273
  return { procedures, lastDoc };
@@ -21311,7 +21305,9 @@ var ProcedureService = class extends BaseService {
21311
21305
  if (hasNestedFilters) {
21312
21306
  procedures = this.applyInMemoryFilters(procedures, filters);
21313
21307
  }
21314
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21308
+ if (filters.excludeDraftPractitioners) {
21309
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21310
+ }
21315
21311
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
21316
21312
  console.log(`[PROCEDURE_SERVICE] Strategy 2 success: ${procedures.length} procedures`);
21317
21313
  if (procedures.length < (filters.pagination || 10)) {
@@ -21392,7 +21388,9 @@ var ProcedureService = class extends BaseService {
21392
21388
  }
21393
21389
  });
21394
21390
  procedures = this.applyInMemoryFilters(procedures, filters);
21395
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21391
+ if (filters.excludeDraftPractitioners) {
21392
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21393
+ }
21396
21394
  console.log("[PROCEDURE_SERVICE] After applyInMemoryFilters (Strategy 3):", {
21397
21395
  procedureCount: procedures.length
21398
21396
  });
@@ -21424,7 +21422,9 @@ var ProcedureService = class extends BaseService {
21424
21422
  (doc47) => ({ ...doc47.data(), id: doc47.id })
21425
21423
  );
21426
21424
  procedures = this.applyInMemoryFilters(procedures, filters);
21427
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21425
+ if (filters.excludeDraftPractitioners) {
21426
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21427
+ }
21428
21428
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
21429
21429
  console.log(`[PROCEDURE_SERVICE] Strategy 4 success: ${procedures.length} procedures`);
21430
21430
  if (procedures.length < (filters.pagination || 10)) {
package/dist/index.mjs CHANGED
@@ -13606,25 +13606,17 @@ import {
13606
13606
  import { z as z20 } from "zod";
13607
13607
  function filterDoctorsInfo(doctorsInfo) {
13608
13608
  if (!doctorsInfo || doctorsInfo.length === 0) {
13609
- return [];
13609
+ return doctorsInfo || [];
13610
13610
  }
13611
- return doctorsInfo.filter((doctor) => {
13612
- if (doctor.status === "draft" /* DRAFT */) {
13613
- console.log(`[CLINIC_UTILS] Filtering out draft practitioner ${doctor.id} from doctorsInfo`);
13614
- return false;
13615
- }
13616
- if (doctor.isActive === false) {
13617
- console.log(`[CLINIC_UTILS] Filtering out inactive practitioner ${doctor.id} from doctorsInfo`);
13618
- return false;
13619
- }
13620
- return true;
13621
- });
13611
+ return doctorsInfo;
13622
13612
  }
13623
13613
  function filterClinicEmbeddedArrays(clinic, excludeDraftPractitioners = false) {
13624
13614
  if (!clinic) {
13625
13615
  return clinic;
13626
13616
  }
13617
+ console.log(`[CLINIC_UTILS] filterClinicEmbeddedArrays called for clinic ${clinic.id} with excludeDraftPractitioners: ${excludeDraftPractitioners}`);
13627
13618
  if (!excludeDraftPractitioners) {
13619
+ console.log(`[CLINIC_UTILS] Skipping filtering for clinic ${clinic.id} (excludeDraftPractitioners is false)`);
13628
13620
  return clinic;
13629
13621
  }
13630
13622
  const filteredClinic = { ...clinic };
@@ -14133,6 +14125,7 @@ async function getClinicsByFilters(db, filters) {
14133
14125
  }
14134
14126
  let clinics = Array.from(uniqueMap.values());
14135
14127
  const excludeDrafts = filters.excludeDraftPractitioners === true;
14128
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
14136
14129
  clinics = clinics.map((clinic) => filterClinicEmbeddedArrays(clinic, excludeDrafts));
14137
14130
  clinics = applyInMemoryFilters(clinics, filters);
14138
14131
  const pageSize = filters.pagination || 5;
@@ -14188,6 +14181,7 @@ async function getClinicsByFilters(db, filters) {
14188
14181
  const querySnapshot = await getDocs19(q);
14189
14182
  let clinics = querySnapshot.docs.map((doc47) => ({ ...doc47.data(), id: doc47.id }));
14190
14183
  const excludeDrafts = filters.excludeDraftPractitioners === true;
14184
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
14191
14185
  clinics = clinics.map((clinic) => filterClinicEmbeddedArrays(clinic, excludeDrafts));
14192
14186
  clinics = applyInMemoryFilters(clinics, filters);
14193
14187
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -14222,6 +14216,7 @@ async function getClinicsByFilters(db, filters) {
14222
14216
  const querySnapshot = await getDocs19(q);
14223
14217
  let clinics = querySnapshot.docs.map((doc47) => ({ ...doc47.data(), id: doc47.id }));
14224
14218
  const excludeDrafts = filters.excludeDraftPractitioners === true;
14219
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
14225
14220
  clinics = clinics.map((clinic) => filterClinicEmbeddedArrays(clinic, excludeDrafts));
14226
14221
  clinics = applyInMemoryFilters(clinics, filters);
14227
14222
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -20322,7 +20317,11 @@ var ProcedureService = class extends BaseService {
20322
20317
  * @returns Filtered array of procedures (excluding invalid/inactive/draft practitioners)
20323
20318
  */
20324
20319
  async filterDraftPractitionerProcedures(procedures) {
20320
+ console.log(`[ProcedureService] filterDraftPractitionerProcedures called with ${procedures.length} procedures, practitionerService available: ${!!this.practitionerService}`);
20325
20321
  if (!this.practitionerService || procedures.length === 0) {
20322
+ if (!this.practitionerService) {
20323
+ console.warn("[ProcedureService] practitionerService not available - skipping filtering");
20324
+ }
20326
20325
  return procedures;
20327
20326
  }
20328
20327
  try {
@@ -20558,11 +20557,7 @@ var ProcedureService = class extends BaseService {
20558
20557
  photo: typeof practitioner.basicInfo.profileImageUrl === "string" ? practitioner.basicInfo.profileImageUrl : "",
20559
20558
  // Default to empty string if not a processed URL
20560
20559
  rating: ((_a = practitioner.reviewInfo) == null ? void 0 : _a.averageRating) || 0,
20561
- services: practitioner.procedures || [],
20562
- status: practitioner.status,
20563
- // Include practitioner status for client-side filtering
20564
- isActive: practitioner.isActive
20565
- // Include isActive flag for client-side filtering
20560
+ services: practitioner.procedures || []
20566
20561
  };
20567
20562
  const { productsMetadata: _, productId: __, photos: ___, ...validatedDataWithoutProductsMetadata } = validatedData;
20568
20563
  const newProcedure = {
@@ -20721,9 +20716,7 @@ var ProcedureService = class extends BaseService {
20721
20716
  description: practitioner.basicInfo.bio || "",
20722
20717
  photo: typeof practitioner.basicInfo.profileImageUrl === "string" ? practitioner.basicInfo.profileImageUrl : "",
20723
20718
  rating: ((_c = practitioner.reviewInfo) == null ? void 0 : _c.averageRating) || 0,
20724
- services: practitioner.procedures || [],
20725
- status: practitioner.status,
20726
- isActive: practitioner.isActive
20719
+ services: practitioner.procedures || []
20727
20720
  };
20728
20721
  const newProcedure = {
20729
20722
  ...sourceProcedure,
@@ -21220,9 +21213,7 @@ var ProcedureService = class extends BaseService {
21220
21213
  photo: typeof newPractitioner.basicInfo.profileImageUrl === "string" ? newPractitioner.basicInfo.profileImageUrl : "",
21221
21214
  // Default to empty string if not a processed URL
21222
21215
  rating: ((_b = newPractitioner.reviewInfo) == null ? void 0 : _b.averageRating) || 0,
21223
- services: newPractitioner.procedures || [],
21224
- status: newPractitioner.status,
21225
- isActive: newPractitioner.isActive
21216
+ services: newPractitioner.procedures || []
21226
21217
  };
21227
21218
  }
21228
21219
  if (validatedData.clinicBranchId && validatedData.clinicBranchId !== oldClinicId) {
@@ -21417,6 +21408,7 @@ var ProcedureService = class extends BaseService {
21417
21408
  async getProceduresByFilters(filters) {
21418
21409
  try {
21419
21410
  console.log("[PROCEDURE_SERVICE] Starting procedure filtering with multiple strategies");
21411
+ console.log("excludeDraftPractitioners is : ", filters.excludeDraftPractitioners);
21420
21412
  if (filters.location && filters.radiusInKm) {
21421
21413
  console.log("[PROCEDURE_SERVICE] Executing geo query:", {
21422
21414
  location: filters.location,
@@ -21506,10 +21498,12 @@ var ProcedureService = class extends BaseService {
21506
21498
  if (hasNestedFilters) {
21507
21499
  procedures = this.applyInMemoryFilters(procedures, filters);
21508
21500
  }
21509
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21501
+ if (filters.excludeDraftPractitioners) {
21502
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21503
+ }
21510
21504
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
21511
21505
  console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures`);
21512
- if (procedures.length < (filters.pagination || 10)) {
21506
+ if (querySnapshot.docs.length < (filters.pagination || 10)) {
21513
21507
  return { procedures, lastDoc: null };
21514
21508
  }
21515
21509
  return { procedures, lastDoc };
@@ -21547,7 +21541,9 @@ var ProcedureService = class extends BaseService {
21547
21541
  if (hasNestedFilters) {
21548
21542
  procedures = this.applyInMemoryFilters(procedures, filters);
21549
21543
  }
21550
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21544
+ if (filters.excludeDraftPractitioners) {
21545
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21546
+ }
21551
21547
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
21552
21548
  console.log(`[PROCEDURE_SERVICE] Strategy 2 success: ${procedures.length} procedures`);
21553
21549
  if (procedures.length < (filters.pagination || 10)) {
@@ -21628,7 +21624,9 @@ var ProcedureService = class extends BaseService {
21628
21624
  }
21629
21625
  });
21630
21626
  procedures = this.applyInMemoryFilters(procedures, filters);
21631
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21627
+ if (filters.excludeDraftPractitioners) {
21628
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21629
+ }
21632
21630
  console.log("[PROCEDURE_SERVICE] After applyInMemoryFilters (Strategy 3):", {
21633
21631
  procedureCount: procedures.length
21634
21632
  });
@@ -21660,7 +21658,9 @@ var ProcedureService = class extends BaseService {
21660
21658
  (doc47) => ({ ...doc47.data(), id: doc47.id })
21661
21659
  );
21662
21660
  procedures = this.applyInMemoryFilters(procedures, filters);
21663
- procedures = await this.filterDraftPractitionerProcedures(procedures);
21661
+ if (filters.excludeDraftPractitioners) {
21662
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
21663
+ }
21664
21664
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
21665
21665
  console.log(`[PROCEDURE_SERVICE] Strategy 4 success: ${procedures.length} procedures`);
21666
21666
  if (procedures.length < (filters.pagination || 10)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.13.13",
4
+ "version": "1.13.15",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -26,7 +26,6 @@ import {
26
26
  ClinicLocation,
27
27
  DoctorInfo,
28
28
  } from "../../../types/clinic";
29
- import { PractitionerStatus } from "../../../types/practitioner";
30
29
  import {
31
30
  geohashForLocation,
32
31
  distanceBetween,
@@ -388,30 +387,19 @@ export async function createClinic(
388
387
  */
389
388
  /**
390
389
  * Filters out draft/inactive practitioners from doctorsInfo array
390
+ * Note: Since doctorInfo no longer contains status/isActive fields,
391
+ * filtering is handled at the procedure level by ProcedureService.
392
+ * This function now returns all doctors as-is.
391
393
  * @param doctorsInfo Array of doctor info objects
392
- * @returns Filtered array excluding draft or inactive practitioners
394
+ * @returns Array of doctor info objects (no filtering applied)
393
395
  */
394
396
  function filterDoctorsInfo(doctorsInfo: DoctorInfo[]): DoctorInfo[] {
395
397
  if (!doctorsInfo || doctorsInfo.length === 0) {
396
- return [];
398
+ return doctorsInfo || [];
397
399
  }
398
400
 
399
- return doctorsInfo.filter((doctor) => {
400
- // Filter out if status is DRAFT
401
- if (doctor.status === PractitionerStatus.DRAFT) {
402
- console.log(`[CLINIC_UTILS] Filtering out draft practitioner ${doctor.id} from doctorsInfo`);
403
- return false;
404
- }
405
-
406
- // Filter out if isActive is explicitly false
407
- if (doctor.isActive === false) {
408
- console.log(`[CLINIC_UTILS] Filtering out inactive practitioner ${doctor.id} from doctorsInfo`);
409
- return false;
410
- }
411
-
412
- // Include if status is ACTIVE or undefined (backward compatibility) and isActive is true or undefined
413
- return true;
414
- });
401
+ // Return all doctors - filtering is handled at procedure level
402
+ return doctorsInfo;
415
403
  }
416
404
 
417
405
  /**
@@ -425,8 +413,11 @@ export function filterClinicEmbeddedArrays(clinic: Clinic, excludeDraftPractitio
425
413
  return clinic;
426
414
  }
427
415
 
416
+ console.log(`[CLINIC_UTILS] filterClinicEmbeddedArrays called for clinic ${clinic.id} with excludeDraftPractitioners: ${excludeDraftPractitioners}`);
417
+
428
418
  // If excluding drafts is disabled (default), return clinic as-is (for admin views)
429
419
  if (!excludeDraftPractitioners) {
420
+ console.log(`[CLINIC_UTILS] Skipping filtering for clinic ${clinic.id} (excludeDraftPractitioners is false)`);
430
421
  return clinic;
431
422
  }
432
423
 
@@ -98,6 +98,7 @@ export async function getClinicsByFilters(
98
98
 
99
99
  // Filter embedded arrays (draft/inactive practitioners) only if explicitly requested
100
100
  const excludeDrafts = filters.excludeDraftPractitioners === true; // Default to false (show all)
101
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
101
102
  clinics = clinics.map(clinic => filterClinicEmbeddedArrays(clinic, excludeDrafts));
102
103
 
103
104
  // Apply all remaining filters and compute exact distance + sorting
@@ -170,6 +171,7 @@ export async function getClinicsByFilters(
170
171
 
171
172
  // Filter embedded arrays (draft/inactive practitioners) only if explicitly requested
172
173
  const excludeDrafts = filters.excludeDraftPractitioners === true; // Default to false (show all)
174
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
173
175
  clinics = clinics.map(clinic => filterClinicEmbeddedArrays(clinic, excludeDrafts));
174
176
 
175
177
  // Apply in-memory filters
@@ -217,6 +219,7 @@ export async function getClinicsByFilters(
217
219
 
218
220
  // Filter embedded arrays (draft/inactive practitioners) only if explicitly requested
219
221
  const excludeDrafts = filters.excludeDraftPractitioners === true; // Default to false (show all)
222
+ console.log(`[CLINIC_SERVICE] getClinicsByFilters - excludeDraftPractitioners from filters: ${filters.excludeDraftPractitioners}, resolved to: ${excludeDrafts}`);
220
223
  clinics = clinics.map(clinic => filterClinicEmbeddedArrays(clinic, excludeDrafts));
221
224
 
222
225
  // Apply in-memory filters
@@ -105,7 +105,11 @@ export class ProcedureService extends BaseService {
105
105
  private async filterDraftPractitionerProcedures(
106
106
  procedures: Procedure[]
107
107
  ): Promise<Procedure[]> {
108
+ console.log(`[ProcedureService] filterDraftPractitionerProcedures called with ${procedures.length} procedures, practitionerService available: ${!!this.practitionerService}`);
108
109
  if (!this.practitionerService || procedures.length === 0) {
110
+ if (!this.practitionerService) {
111
+ console.warn('[ProcedureService] practitionerService not available - skipping filtering');
112
+ }
109
113
  return procedures;
110
114
  }
111
115
 
@@ -439,8 +443,6 @@ export class ProcedureService extends BaseService {
439
443
  : '', // Default to empty string if not a processed URL
440
444
  rating: practitioner.reviewInfo?.averageRating || 0,
441
445
  services: practitioner.procedures || [],
442
- status: practitioner.status, // Include practitioner status for client-side filtering
443
- isActive: practitioner.isActive, // Include isActive flag for client-side filtering
444
446
  };
445
447
 
446
448
  // Create the procedure object
@@ -630,8 +632,6 @@ export class ProcedureService extends BaseService {
630
632
  : '',
631
633
  rating: practitioner.reviewInfo?.averageRating || 0,
632
634
  services: practitioner.procedures || [],
633
- status: practitioner.status,
634
- isActive: practitioner.isActive,
635
635
  };
636
636
 
637
637
  // Construct the new procedure object
@@ -1269,8 +1269,6 @@ export class ProcedureService extends BaseService {
1269
1269
  : '', // Default to empty string if not a processed URL
1270
1270
  rating: newPractitioner.reviewInfo?.averageRating || 0,
1271
1271
  services: newPractitioner.procedures || [],
1272
- status: newPractitioner.status,
1273
- isActive: newPractitioner.isActive,
1274
1272
  };
1275
1273
  }
1276
1274
 
@@ -1533,12 +1531,14 @@ export class ProcedureService extends BaseService {
1533
1531
  isActive?: boolean;
1534
1532
  practitionerId?: string;
1535
1533
  clinicId?: string;
1534
+ excludeDraftPractitioners?: boolean;
1536
1535
  }): Promise<{
1537
1536
  procedures: (Procedure & { distance?: number })[];
1538
1537
  lastDoc: any;
1539
1538
  }> {
1540
1539
  try {
1541
1540
  console.log('[PROCEDURE_SERVICE] Starting procedure filtering with multiple strategies');
1541
+ console.log("excludeDraftPractitioners is : ", filters.excludeDraftPractitioners)
1542
1542
 
1543
1543
  // Geo query debug i validacija
1544
1544
  if (filters.location && filters.radiusInKm) {
@@ -1652,8 +1652,10 @@ export class ProcedureService extends BaseService {
1652
1652
  procedures = this.applyInMemoryFilters(procedures, filters);
1653
1653
  }
1654
1654
 
1655
- // Filter out procedures from draft practitioners
1656
- procedures = await this.filterDraftPractitionerProcedures(procedures);
1655
+ // Filter out procedures from draft practitioners if requested
1656
+ if (filters.excludeDraftPractitioners) {
1657
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
1658
+ }
1657
1659
 
1658
1660
  const lastDoc =
1659
1661
  querySnapshot.docs.length > 0
@@ -1663,7 +1665,7 @@ export class ProcedureService extends BaseService {
1663
1665
  console.log(`[PROCEDURE_SERVICE] Strategy 1 success: ${procedures.length} procedures`);
1664
1666
 
1665
1667
  // Fix Load More - ako je broj rezultata manji od pagination, nema više
1666
- if (procedures.length < (filters.pagination || 10)) {
1668
+ if (querySnapshot.docs.length < (filters.pagination || 10)) {
1667
1669
  return { procedures, lastDoc: null };
1668
1670
  }
1669
1671
  return { procedures, lastDoc };
@@ -1713,7 +1715,9 @@ export class ProcedureService extends BaseService {
1713
1715
  }
1714
1716
 
1715
1717
  // Filter out procedures from draft practitioners
1716
- procedures = await this.filterDraftPractitionerProcedures(procedures);
1718
+ if(filters.excludeDraftPractitioners){
1719
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
1720
+ }
1717
1721
 
1718
1722
  const lastDoc =
1719
1723
  querySnapshot.docs.length > 0
@@ -1826,7 +1830,9 @@ export class ProcedureService extends BaseService {
1826
1830
  procedures = this.applyInMemoryFilters(procedures, filters);
1827
1831
 
1828
1832
  // Filter out procedures from draft practitioners
1829
- procedures = await this.filterDraftPractitionerProcedures(procedures);
1833
+ if(filters.excludeDraftPractitioners){
1834
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
1835
+ }
1830
1836
 
1831
1837
  console.log('[PROCEDURE_SERVICE] After applyInMemoryFilters (Strategy 3):', {
1832
1838
  procedureCount: procedures.length,
@@ -1870,7 +1876,9 @@ export class ProcedureService extends BaseService {
1870
1876
  procedures = this.applyInMemoryFilters(procedures, filters);
1871
1877
 
1872
1878
  // Filter out procedures from draft practitioners
1873
- procedures = await this.filterDraftPractitionerProcedures(procedures);
1879
+ if(filters.excludeDraftPractitioners){
1880
+ procedures = await this.filterDraftPractitionerProcedures(procedures);
1881
+ }
1874
1882
 
1875
1883
  const lastDoc =
1876
1884
  querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -3,7 +3,6 @@ import { Timestamp, FieldValue } from 'firebase/firestore';
3
3
  import type { ClinicInfo } from '../profile';
4
4
  import { ClinicReviewInfo } from '../reviews';
5
5
  import { ProcedureSummaryInfo } from '../procedure';
6
- import { PractitionerStatus } from '../practitioner';
7
6
 
8
7
  export const CLINIC_GROUPS_COLLECTION = 'clinic_groups';
9
8
  export const CLINIC_ADMINS_COLLECTION = 'clinic_admins';
@@ -352,8 +351,6 @@ export interface DoctorInfo {
352
351
  photo: string | null;
353
352
  rating: number;
354
353
  services: string[]; // Used for search and filtering
355
- status?: PractitionerStatus; // Practitioner status (DRAFT, ACTIVE, etc.)
356
- isActive?: boolean; // Whether practitioner is active
357
354
  // TODO: Add aggregated fields, like rating, reviews, services this doctor provides in this clinic and similar
358
355
  }
359
356