@blackcode_sa/metaestetics-api 1.13.16 → 1.13.18

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/index.d.mts CHANGED
@@ -6793,9 +6793,10 @@ declare class ProcedureService extends BaseService {
6793
6793
  /**
6794
6794
  * Gets all procedures for a clinic branch
6795
6795
  * @param clinicBranchId - The ID of the clinic branch
6796
+ * @param excludeDraftPractitioners - Whether to exclude procedures if the practitioner is in DRAFT status (default: false for admin views)
6796
6797
  * @returns List of procedures
6797
6798
  */
6798
- getProceduresByClinicBranch(clinicBranchId: string): Promise<Procedure[]>;
6799
+ getProceduresByClinicBranch(clinicBranchId: string, excludeDraftPractitioners?: boolean): Promise<Procedure[]>;
6799
6800
  /**
6800
6801
  * Gets all procedures for a practitioner
6801
6802
  * @param practitionerId - The ID of the practitioner
@@ -7609,6 +7610,15 @@ declare class AppointmentService extends BaseService {
7609
7610
  * @returns The updated appointment
7610
7611
  */
7611
7612
  addAfterPhotoToEntry(appointmentId: string, zoneId: string, photoIndex: number, afterPhotoUrl: MediaResource, afterNote?: string): Promise<Appointment>;
7613
+ /**
7614
+ * Removes an after photo from an existing entry (keeps the before photo)
7615
+ *
7616
+ * @param appointmentId ID of the appointment
7617
+ * @param zoneId ID of the zone
7618
+ * @param photoIndex Index of the entry to remove after photo from
7619
+ * @returns The updated appointment
7620
+ */
7621
+ removeAfterPhotoFromEntry(appointmentId: string, zoneId: string, photoIndex: number): Promise<Appointment>;
7612
7622
  /**
7613
7623
  * Updates notes for a photo entry
7614
7624
  *
package/dist/index.d.ts CHANGED
@@ -6793,9 +6793,10 @@ declare class ProcedureService extends BaseService {
6793
6793
  /**
6794
6794
  * Gets all procedures for a clinic branch
6795
6795
  * @param clinicBranchId - The ID of the clinic branch
6796
+ * @param excludeDraftPractitioners - Whether to exclude procedures if the practitioner is in DRAFT status (default: false for admin views)
6796
6797
  * @returns List of procedures
6797
6798
  */
6798
- getProceduresByClinicBranch(clinicBranchId: string): Promise<Procedure[]>;
6799
+ getProceduresByClinicBranch(clinicBranchId: string, excludeDraftPractitioners?: boolean): Promise<Procedure[]>;
6799
6800
  /**
6800
6801
  * Gets all procedures for a practitioner
6801
6802
  * @param practitionerId - The ID of the practitioner
@@ -7609,6 +7610,15 @@ declare class AppointmentService extends BaseService {
7609
7610
  * @returns The updated appointment
7610
7611
  */
7611
7612
  addAfterPhotoToEntry(appointmentId: string, zoneId: string, photoIndex: number, afterPhotoUrl: MediaResource, afterNote?: string): Promise<Appointment>;
7613
+ /**
7614
+ * Removes an after photo from an existing entry (keeps the before photo)
7615
+ *
7616
+ * @param appointmentId ID of the appointment
7617
+ * @param zoneId ID of the zone
7618
+ * @param photoIndex Index of the entry to remove after photo from
7619
+ * @returns The updated appointment
7620
+ */
7621
+ removeAfterPhotoFromEntry(appointmentId: string, zoneId: string, photoIndex: number): Promise<Appointment>;
7612
7622
  /**
7613
7623
  * Updates notes for a photo entry
7614
7624
  *
package/dist/index.js CHANGED
@@ -5328,6 +5328,12 @@ async function updateZonePhotoNotesUtil(db, appointmentId, zoneId, photoIndex, b
5328
5328
  }
5329
5329
  return updateZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex, updates);
5330
5330
  }
5331
+ async function removeAfterPhotoFromEntryUtil(db, appointmentId, zoneId, photoIndex) {
5332
+ return updateZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex, {
5333
+ after: null,
5334
+ afterNote: null
5335
+ });
5336
+ }
5331
5337
  async function getZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex) {
5332
5338
  var _a;
5333
5339
  const appointment = await getAppointmentOrThrow(db, appointmentId);
@@ -6767,6 +6773,30 @@ var AppointmentService = class extends BaseService {
6767
6773
  throw error;
6768
6774
  }
6769
6775
  }
6776
+ /**
6777
+ * Removes an after photo from an existing entry (keeps the before photo)
6778
+ *
6779
+ * @param appointmentId ID of the appointment
6780
+ * @param zoneId ID of the zone
6781
+ * @param photoIndex Index of the entry to remove after photo from
6782
+ * @returns The updated appointment
6783
+ */
6784
+ async removeAfterPhotoFromEntry(appointmentId, zoneId, photoIndex) {
6785
+ try {
6786
+ console.log(
6787
+ `[APPOINTMENT_SERVICE] Removing after photo from entry at index ${photoIndex} for zone ${zoneId}`
6788
+ );
6789
+ return await removeAfterPhotoFromEntryUtil(
6790
+ this.db,
6791
+ appointmentId,
6792
+ zoneId,
6793
+ photoIndex
6794
+ );
6795
+ } catch (error) {
6796
+ console.error(`[APPOINTMENT_SERVICE] Error removing after photo from entry:`, error);
6797
+ throw error;
6798
+ }
6799
+ }
6770
6800
  /**
6771
6801
  * Updates notes for a photo entry
6772
6802
  *
@@ -20848,9 +20878,10 @@ var ProcedureService = class extends BaseService {
20848
20878
  /**
20849
20879
  * Gets all procedures for a clinic branch
20850
20880
  * @param clinicBranchId - The ID of the clinic branch
20881
+ * @param excludeDraftPractitioners - Whether to exclude procedures if the practitioner is in DRAFT status (default: false for admin views)
20851
20882
  * @returns List of procedures
20852
20883
  */
20853
- async getProceduresByClinicBranch(clinicBranchId) {
20884
+ async getProceduresByClinicBranch(clinicBranchId, excludeDraftPractitioners = false) {
20854
20885
  const q = (0, import_firestore58.query)(
20855
20886
  (0, import_firestore58.collection)(this.db, PROCEDURES_COLLECTION),
20856
20887
  (0, import_firestore58.where)("clinicBranchId", "==", clinicBranchId),
@@ -20858,7 +20889,10 @@ var ProcedureService = class extends BaseService {
20858
20889
  );
20859
20890
  const snapshot = await (0, import_firestore58.getDocs)(q);
20860
20891
  const procedures = snapshot.docs.map((doc47) => doc47.data());
20861
- return await this.filterDraftPractitionerProcedures(procedures);
20892
+ if (excludeDraftPractitioners) {
20893
+ return await this.filterDraftPractitionerProcedures(procedures);
20894
+ }
20895
+ return procedures;
20862
20896
  }
20863
20897
  /**
20864
20898
  * Gets all procedures for a practitioner
package/dist/index.mjs CHANGED
@@ -5215,6 +5215,12 @@ async function updateZonePhotoNotesUtil(db, appointmentId, zoneId, photoIndex, b
5215
5215
  }
5216
5216
  return updateZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex, updates);
5217
5217
  }
5218
+ async function removeAfterPhotoFromEntryUtil(db, appointmentId, zoneId, photoIndex) {
5219
+ return updateZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex, {
5220
+ after: null,
5221
+ afterNote: null
5222
+ });
5223
+ }
5218
5224
  async function getZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex) {
5219
5225
  var _a;
5220
5226
  const appointment = await getAppointmentOrThrow(db, appointmentId);
@@ -6654,6 +6660,30 @@ var AppointmentService = class extends BaseService {
6654
6660
  throw error;
6655
6661
  }
6656
6662
  }
6663
+ /**
6664
+ * Removes an after photo from an existing entry (keeps the before photo)
6665
+ *
6666
+ * @param appointmentId ID of the appointment
6667
+ * @param zoneId ID of the zone
6668
+ * @param photoIndex Index of the entry to remove after photo from
6669
+ * @returns The updated appointment
6670
+ */
6671
+ async removeAfterPhotoFromEntry(appointmentId, zoneId, photoIndex) {
6672
+ try {
6673
+ console.log(
6674
+ `[APPOINTMENT_SERVICE] Removing after photo from entry at index ${photoIndex} for zone ${zoneId}`
6675
+ );
6676
+ return await removeAfterPhotoFromEntryUtil(
6677
+ this.db,
6678
+ appointmentId,
6679
+ zoneId,
6680
+ photoIndex
6681
+ );
6682
+ } catch (error) {
6683
+ console.error(`[APPOINTMENT_SERVICE] Error removing after photo from entry:`, error);
6684
+ throw error;
6685
+ }
6686
+ }
6657
6687
  /**
6658
6688
  * Updates notes for a photo entry
6659
6689
  *
@@ -21084,9 +21114,10 @@ var ProcedureService = class extends BaseService {
21084
21114
  /**
21085
21115
  * Gets all procedures for a clinic branch
21086
21116
  * @param clinicBranchId - The ID of the clinic branch
21117
+ * @param excludeDraftPractitioners - Whether to exclude procedures if the practitioner is in DRAFT status (default: false for admin views)
21087
21118
  * @returns List of procedures
21088
21119
  */
21089
- async getProceduresByClinicBranch(clinicBranchId) {
21120
+ async getProceduresByClinicBranch(clinicBranchId, excludeDraftPractitioners = false) {
21090
21121
  const q = query33(
21091
21122
  collection33(this.db, PROCEDURES_COLLECTION),
21092
21123
  where33("clinicBranchId", "==", clinicBranchId),
@@ -21094,7 +21125,10 @@ var ProcedureService = class extends BaseService {
21094
21125
  );
21095
21126
  const snapshot = await getDocs33(q);
21096
21127
  const procedures = snapshot.docs.map((doc47) => doc47.data());
21097
- return await this.filterDraftPractitionerProcedures(procedures);
21128
+ if (excludeDraftPractitioners) {
21129
+ return await this.filterDraftPractitionerProcedures(procedures);
21130
+ }
21131
+ return procedures;
21098
21132
  }
21099
21133
  /**
21100
21134
  * Gets all procedures for a practitioner
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.16",
4
+ "version": "1.13.18",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -89,6 +89,7 @@ import {
89
89
  import {
90
90
  updateZonePhotoEntryUtil,
91
91
  addAfterPhotoToEntryUtil,
92
+ removeAfterPhotoFromEntryUtil,
92
93
  updateZonePhotoNotesUtil,
93
94
  getZonePhotoEntryUtil,
94
95
  } from './utils/zone-photo.utils';
@@ -2034,6 +2035,35 @@ export class AppointmentService extends BaseService {
2034
2035
  }
2035
2036
  }
2036
2037
 
2038
+ /**
2039
+ * Removes an after photo from an existing entry (keeps the before photo)
2040
+ *
2041
+ * @param appointmentId ID of the appointment
2042
+ * @param zoneId ID of the zone
2043
+ * @param photoIndex Index of the entry to remove after photo from
2044
+ * @returns The updated appointment
2045
+ */
2046
+ async removeAfterPhotoFromEntry(
2047
+ appointmentId: string,
2048
+ zoneId: string,
2049
+ photoIndex: number,
2050
+ ): Promise<Appointment> {
2051
+ try {
2052
+ console.log(
2053
+ `[APPOINTMENT_SERVICE] Removing after photo from entry at index ${photoIndex} for zone ${zoneId}`,
2054
+ );
2055
+ return await removeAfterPhotoFromEntryUtil(
2056
+ this.db,
2057
+ appointmentId,
2058
+ zoneId,
2059
+ photoIndex,
2060
+ );
2061
+ } catch (error) {
2062
+ console.error(`[APPOINTMENT_SERVICE] Error removing after photo from entry:`, error);
2063
+ throw error;
2064
+ }
2065
+ }
2066
+
2037
2067
  /**
2038
2068
  * Updates notes for a photo entry
2039
2069
  *
@@ -116,6 +116,27 @@ export async function updateZonePhotoNotesUtil(
116
116
  return updateZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex, updates);
117
117
  }
118
118
 
119
+ /**
120
+ * Removes an after photo from an existing entry (keeps the before photo)
121
+ *
122
+ * @param db Firestore instance
123
+ * @param appointmentId Appointment ID
124
+ * @param zoneId Zone ID
125
+ * @param photoIndex Index of the entry to remove after photo from
126
+ * @returns Updated appointment
127
+ */
128
+ export async function removeAfterPhotoFromEntryUtil(
129
+ db: Firestore,
130
+ appointmentId: string,
131
+ zoneId: string,
132
+ photoIndex: number
133
+ ): Promise<Appointment> {
134
+ return updateZonePhotoEntryUtil(db, appointmentId, zoneId, photoIndex, {
135
+ after: null,
136
+ afterNote: null,
137
+ });
138
+ }
139
+
119
140
  /**
120
141
  * Gets a specific photo entry from a zone
121
142
  *
@@ -1109,9 +1109,13 @@ export class ProcedureService extends BaseService {
1109
1109
  /**
1110
1110
  * Gets all procedures for a clinic branch
1111
1111
  * @param clinicBranchId - The ID of the clinic branch
1112
+ * @param excludeDraftPractitioners - Whether to exclude procedures if the practitioner is in DRAFT status (default: false for admin views)
1112
1113
  * @returns List of procedures
1113
1114
  */
1114
- async getProceduresByClinicBranch(clinicBranchId: string): Promise<Procedure[]> {
1115
+ async getProceduresByClinicBranch(
1116
+ clinicBranchId: string,
1117
+ excludeDraftPractitioners: boolean = false
1118
+ ): Promise<Procedure[]> {
1115
1119
  const q = query(
1116
1120
  collection(this.db, PROCEDURES_COLLECTION),
1117
1121
  where('clinicBranchId', '==', clinicBranchId),
@@ -1120,8 +1124,12 @@ export class ProcedureService extends BaseService {
1120
1124
  const snapshot = await getDocs(q);
1121
1125
  const procedures = snapshot.docs.map(doc => doc.data() as Procedure);
1122
1126
 
1123
- // Filter out procedures from draft practitioners
1124
- return await this.filterDraftPractitionerProcedures(procedures);
1127
+ // Filter out procedures from draft practitioners only if explicitly requested (for patient-facing apps)
1128
+ if (excludeDraftPractitioners) {
1129
+ return await this.filterDraftPractitionerProcedures(procedures);
1130
+ }
1131
+
1132
+ return procedures;
1125
1133
  }
1126
1134
 
1127
1135
  /**