@blackcode_sa/metaestetics-api 1.5.42 → 1.5.44
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 +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +62 -1
- package/dist/index.mjs +63 -2
- package/package.json +1 -1
- package/src/services/appointment/appointment.service.ts +78 -2
package/dist/index.d.mts
CHANGED
|
@@ -6374,6 +6374,18 @@ declare class AppointmentService extends BaseService {
|
|
|
6374
6374
|
* @param clinicService Clinic service instance
|
|
6375
6375
|
*/
|
|
6376
6376
|
constructor(db: Firestore, auth: Auth, app: FirebaseApp, calendarService: CalendarServiceV2, patientService: PatientService, practitionerService: PractitionerService, clinicService: ClinicService);
|
|
6377
|
+
/**
|
|
6378
|
+
* Test method using the callable function version of getAvailableBookingSlots
|
|
6379
|
+
* For development and testing purposes only - not for production use
|
|
6380
|
+
*
|
|
6381
|
+
* @param clinicId ID of the clinic
|
|
6382
|
+
* @param practitionerId ID of the practitioner
|
|
6383
|
+
* @param procedureId ID of the procedure
|
|
6384
|
+
* @param startDate Start date of the time range to check
|
|
6385
|
+
* @param endDate End date of the time range to check
|
|
6386
|
+
* @returns Test result from the callable function
|
|
6387
|
+
*/
|
|
6388
|
+
testGetAvailableBookingSlots(clinicId: string, practitionerId: string, procedureId: string, startDate: Date, endDate: Date): Promise<any>;
|
|
6377
6389
|
/**
|
|
6378
6390
|
* Gets available booking slots for a specific clinic, practitioner, and procedure.
|
|
6379
6391
|
*
|
|
@@ -6576,6 +6588,11 @@ declare class AppointmentService extends BaseService {
|
|
|
6576
6588
|
* @returns The updated appointment
|
|
6577
6589
|
*/
|
|
6578
6590
|
updateInternalNotes(appointmentId: string, notes: string | null): Promise<Appointment>;
|
|
6591
|
+
/**
|
|
6592
|
+
* Debug helper: Get the current user's ID token for testing purposes
|
|
6593
|
+
* Use this token in Postman with Authorization: Bearer TOKEN
|
|
6594
|
+
*/
|
|
6595
|
+
getDebugToken(): Promise<string | null>;
|
|
6579
6596
|
}
|
|
6580
6597
|
|
|
6581
6598
|
declare class AuthError extends Error {
|
package/dist/index.d.ts
CHANGED
|
@@ -6374,6 +6374,18 @@ declare class AppointmentService extends BaseService {
|
|
|
6374
6374
|
* @param clinicService Clinic service instance
|
|
6375
6375
|
*/
|
|
6376
6376
|
constructor(db: Firestore, auth: Auth, app: FirebaseApp, calendarService: CalendarServiceV2, patientService: PatientService, practitionerService: PractitionerService, clinicService: ClinicService);
|
|
6377
|
+
/**
|
|
6378
|
+
* Test method using the callable function version of getAvailableBookingSlots
|
|
6379
|
+
* For development and testing purposes only - not for production use
|
|
6380
|
+
*
|
|
6381
|
+
* @param clinicId ID of the clinic
|
|
6382
|
+
* @param practitionerId ID of the practitioner
|
|
6383
|
+
* @param procedureId ID of the procedure
|
|
6384
|
+
* @param startDate Start date of the time range to check
|
|
6385
|
+
* @param endDate End date of the time range to check
|
|
6386
|
+
* @returns Test result from the callable function
|
|
6387
|
+
*/
|
|
6388
|
+
testGetAvailableBookingSlots(clinicId: string, practitionerId: string, procedureId: string, startDate: Date, endDate: Date): Promise<any>;
|
|
6377
6389
|
/**
|
|
6378
6390
|
* Gets available booking slots for a specific clinic, practitioner, and procedure.
|
|
6379
6391
|
*
|
|
@@ -6576,6 +6588,11 @@ declare class AppointmentService extends BaseService {
|
|
|
6576
6588
|
* @returns The updated appointment
|
|
6577
6589
|
*/
|
|
6578
6590
|
updateInternalNotes(appointmentId: string, notes: string | null): Promise<Appointment>;
|
|
6591
|
+
/**
|
|
6592
|
+
* Debug helper: Get the current user's ID token for testing purposes
|
|
6593
|
+
* Use this token in Postman with Authorization: Bearer TOKEN
|
|
6594
|
+
*/
|
|
6595
|
+
getDebugToken(): Promise<string | null>;
|
|
6579
6596
|
}
|
|
6580
6597
|
|
|
6581
6598
|
declare class AuthError extends Error {
|
package/dist/index.js
CHANGED
|
@@ -11771,6 +11771,48 @@ var AppointmentService = class extends BaseService {
|
|
|
11771
11771
|
this.clinicService = clinicService;
|
|
11772
11772
|
this.functions = (0, import_functions.getFunctions)(app, "europe-west6");
|
|
11773
11773
|
}
|
|
11774
|
+
/**
|
|
11775
|
+
* Test method using the callable function version of getAvailableBookingSlots
|
|
11776
|
+
* For development and testing purposes only - not for production use
|
|
11777
|
+
*
|
|
11778
|
+
* @param clinicId ID of the clinic
|
|
11779
|
+
* @param practitionerId ID of the practitioner
|
|
11780
|
+
* @param procedureId ID of the procedure
|
|
11781
|
+
* @param startDate Start date of the time range to check
|
|
11782
|
+
* @param endDate End date of the time range to check
|
|
11783
|
+
* @returns Test result from the callable function
|
|
11784
|
+
*/
|
|
11785
|
+
async testGetAvailableBookingSlots(clinicId, practitionerId, procedureId, startDate, endDate) {
|
|
11786
|
+
try {
|
|
11787
|
+
console.log(
|
|
11788
|
+
`[APPOINTMENT_SERVICE] Testing callable function for clinic: ${clinicId}, practitioner: ${practitionerId}, procedure: ${procedureId}`
|
|
11789
|
+
);
|
|
11790
|
+
const getAvailableBookingSlotsCallable = (0, import_functions.httpsCallable)(
|
|
11791
|
+
this.functions,
|
|
11792
|
+
"getAvailableBookingSlots"
|
|
11793
|
+
);
|
|
11794
|
+
const result = await getAvailableBookingSlotsCallable({
|
|
11795
|
+
clinicId,
|
|
11796
|
+
practitionerId,
|
|
11797
|
+
procedureId,
|
|
11798
|
+
timeframe: {
|
|
11799
|
+
start: startDate.getTime(),
|
|
11800
|
+
end: endDate.getTime()
|
|
11801
|
+
}
|
|
11802
|
+
});
|
|
11803
|
+
console.log(
|
|
11804
|
+
"[APPOINTMENT_SERVICE] Callable function test result:",
|
|
11805
|
+
result.data
|
|
11806
|
+
);
|
|
11807
|
+
return result.data;
|
|
11808
|
+
} catch (error) {
|
|
11809
|
+
console.error(
|
|
11810
|
+
"[APPOINTMENT_SERVICE] Error testing callable function:",
|
|
11811
|
+
error
|
|
11812
|
+
);
|
|
11813
|
+
throw error;
|
|
11814
|
+
}
|
|
11815
|
+
}
|
|
11774
11816
|
/**
|
|
11775
11817
|
* Gets available booking slots for a specific clinic, practitioner, and procedure.
|
|
11776
11818
|
*
|
|
@@ -11831,7 +11873,7 @@ var AppointmentService = class extends BaseService {
|
|
|
11831
11873
|
"User must be authenticated to get available booking slots"
|
|
11832
11874
|
);
|
|
11833
11875
|
}
|
|
11834
|
-
const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/
|
|
11876
|
+
const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/bookingApi/getAvailableBookingSlots`;
|
|
11835
11877
|
const idToken = await currentUser.getIdToken();
|
|
11836
11878
|
console.log(
|
|
11837
11879
|
`[APPOINTMENT_SERVICE] Got user token, user ID: ${currentUser.uid}`
|
|
@@ -12287,6 +12329,25 @@ var AppointmentService = class extends BaseService {
|
|
|
12287
12329
|
};
|
|
12288
12330
|
return this.updateAppointment(appointmentId, updateData);
|
|
12289
12331
|
}
|
|
12332
|
+
/**
|
|
12333
|
+
* Debug helper: Get the current user's ID token for testing purposes
|
|
12334
|
+
* Use this token in Postman with Authorization: Bearer TOKEN
|
|
12335
|
+
*/
|
|
12336
|
+
async getDebugToken() {
|
|
12337
|
+
try {
|
|
12338
|
+
const currentUser = this.auth.currentUser;
|
|
12339
|
+
if (!currentUser) {
|
|
12340
|
+
console.log("[APPOINTMENT_SERVICE] No user is signed in");
|
|
12341
|
+
return null;
|
|
12342
|
+
}
|
|
12343
|
+
const idToken = await currentUser.getIdToken();
|
|
12344
|
+
console.log("[APPOINTMENT_SERVICE] Debug token:", idToken);
|
|
12345
|
+
return idToken;
|
|
12346
|
+
} catch (error) {
|
|
12347
|
+
console.error("[APPOINTMENT_SERVICE] Error getting debug token:", error);
|
|
12348
|
+
return null;
|
|
12349
|
+
}
|
|
12350
|
+
}
|
|
12290
12351
|
};
|
|
12291
12352
|
|
|
12292
12353
|
// src/backoffice/services/brand.service.ts
|
package/dist/index.mjs
CHANGED
|
@@ -11471,7 +11471,7 @@ var ReviewService = class extends BaseService {
|
|
|
11471
11471
|
import {
|
|
11472
11472
|
Timestamp as Timestamp28
|
|
11473
11473
|
} from "firebase/firestore";
|
|
11474
|
-
import { getFunctions } from "firebase/functions";
|
|
11474
|
+
import { getFunctions, httpsCallable } from "firebase/functions";
|
|
11475
11475
|
|
|
11476
11476
|
// src/services/appointment/utils/appointment.utils.ts
|
|
11477
11477
|
import {
|
|
@@ -11860,6 +11860,48 @@ var AppointmentService = class extends BaseService {
|
|
|
11860
11860
|
this.clinicService = clinicService;
|
|
11861
11861
|
this.functions = getFunctions(app, "europe-west6");
|
|
11862
11862
|
}
|
|
11863
|
+
/**
|
|
11864
|
+
* Test method using the callable function version of getAvailableBookingSlots
|
|
11865
|
+
* For development and testing purposes only - not for production use
|
|
11866
|
+
*
|
|
11867
|
+
* @param clinicId ID of the clinic
|
|
11868
|
+
* @param practitionerId ID of the practitioner
|
|
11869
|
+
* @param procedureId ID of the procedure
|
|
11870
|
+
* @param startDate Start date of the time range to check
|
|
11871
|
+
* @param endDate End date of the time range to check
|
|
11872
|
+
* @returns Test result from the callable function
|
|
11873
|
+
*/
|
|
11874
|
+
async testGetAvailableBookingSlots(clinicId, practitionerId, procedureId, startDate, endDate) {
|
|
11875
|
+
try {
|
|
11876
|
+
console.log(
|
|
11877
|
+
`[APPOINTMENT_SERVICE] Testing callable function for clinic: ${clinicId}, practitioner: ${practitionerId}, procedure: ${procedureId}`
|
|
11878
|
+
);
|
|
11879
|
+
const getAvailableBookingSlotsCallable = httpsCallable(
|
|
11880
|
+
this.functions,
|
|
11881
|
+
"getAvailableBookingSlots"
|
|
11882
|
+
);
|
|
11883
|
+
const result = await getAvailableBookingSlotsCallable({
|
|
11884
|
+
clinicId,
|
|
11885
|
+
practitionerId,
|
|
11886
|
+
procedureId,
|
|
11887
|
+
timeframe: {
|
|
11888
|
+
start: startDate.getTime(),
|
|
11889
|
+
end: endDate.getTime()
|
|
11890
|
+
}
|
|
11891
|
+
});
|
|
11892
|
+
console.log(
|
|
11893
|
+
"[APPOINTMENT_SERVICE] Callable function test result:",
|
|
11894
|
+
result.data
|
|
11895
|
+
);
|
|
11896
|
+
return result.data;
|
|
11897
|
+
} catch (error) {
|
|
11898
|
+
console.error(
|
|
11899
|
+
"[APPOINTMENT_SERVICE] Error testing callable function:",
|
|
11900
|
+
error
|
|
11901
|
+
);
|
|
11902
|
+
throw error;
|
|
11903
|
+
}
|
|
11904
|
+
}
|
|
11863
11905
|
/**
|
|
11864
11906
|
* Gets available booking slots for a specific clinic, practitioner, and procedure.
|
|
11865
11907
|
*
|
|
@@ -11920,7 +11962,7 @@ var AppointmentService = class extends BaseService {
|
|
|
11920
11962
|
"User must be authenticated to get available booking slots"
|
|
11921
11963
|
);
|
|
11922
11964
|
}
|
|
11923
|
-
const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/
|
|
11965
|
+
const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/bookingApi/getAvailableBookingSlots`;
|
|
11924
11966
|
const idToken = await currentUser.getIdToken();
|
|
11925
11967
|
console.log(
|
|
11926
11968
|
`[APPOINTMENT_SERVICE] Got user token, user ID: ${currentUser.uid}`
|
|
@@ -12376,6 +12418,25 @@ var AppointmentService = class extends BaseService {
|
|
|
12376
12418
|
};
|
|
12377
12419
|
return this.updateAppointment(appointmentId, updateData);
|
|
12378
12420
|
}
|
|
12421
|
+
/**
|
|
12422
|
+
* Debug helper: Get the current user's ID token for testing purposes
|
|
12423
|
+
* Use this token in Postman with Authorization: Bearer TOKEN
|
|
12424
|
+
*/
|
|
12425
|
+
async getDebugToken() {
|
|
12426
|
+
try {
|
|
12427
|
+
const currentUser = this.auth.currentUser;
|
|
12428
|
+
if (!currentUser) {
|
|
12429
|
+
console.log("[APPOINTMENT_SERVICE] No user is signed in");
|
|
12430
|
+
return null;
|
|
12431
|
+
}
|
|
12432
|
+
const idToken = await currentUser.getIdToken();
|
|
12433
|
+
console.log("[APPOINTMENT_SERVICE] Debug token:", idToken);
|
|
12434
|
+
return idToken;
|
|
12435
|
+
} catch (error) {
|
|
12436
|
+
console.error("[APPOINTMENT_SERVICE] Error getting debug token:", error);
|
|
12437
|
+
return null;
|
|
12438
|
+
}
|
|
12439
|
+
}
|
|
12379
12440
|
};
|
|
12380
12441
|
|
|
12381
12442
|
// src/backoffice/services/brand.service.ts
|
package/package.json
CHANGED
|
@@ -84,6 +84,61 @@ export class AppointmentService extends BaseService {
|
|
|
84
84
|
this.functions = getFunctions(app, "europe-west6"); // Initialize Firebase Functions with the correct region
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Test method using the callable function version of getAvailableBookingSlots
|
|
89
|
+
* For development and testing purposes only - not for production use
|
|
90
|
+
*
|
|
91
|
+
* @param clinicId ID of the clinic
|
|
92
|
+
* @param practitionerId ID of the practitioner
|
|
93
|
+
* @param procedureId ID of the procedure
|
|
94
|
+
* @param startDate Start date of the time range to check
|
|
95
|
+
* @param endDate End date of the time range to check
|
|
96
|
+
* @returns Test result from the callable function
|
|
97
|
+
*/
|
|
98
|
+
async testGetAvailableBookingSlots(
|
|
99
|
+
clinicId: string,
|
|
100
|
+
practitionerId: string,
|
|
101
|
+
procedureId: string,
|
|
102
|
+
startDate: Date,
|
|
103
|
+
endDate: Date
|
|
104
|
+
): Promise<any> {
|
|
105
|
+
try {
|
|
106
|
+
console.log(
|
|
107
|
+
`[APPOINTMENT_SERVICE] Testing callable function for clinic: ${clinicId}, practitioner: ${practitionerId}, procedure: ${procedureId}`
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Get the callable function
|
|
111
|
+
const getAvailableBookingSlotsCallable = httpsCallable(
|
|
112
|
+
this.functions,
|
|
113
|
+
"getAvailableBookingSlots"
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
// Call the function with the required parameters
|
|
117
|
+
const result = await getAvailableBookingSlotsCallable({
|
|
118
|
+
clinicId,
|
|
119
|
+
practitionerId,
|
|
120
|
+
procedureId,
|
|
121
|
+
timeframe: {
|
|
122
|
+
start: startDate.getTime(),
|
|
123
|
+
end: endDate.getTime(),
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
console.log(
|
|
128
|
+
"[APPOINTMENT_SERVICE] Callable function test result:",
|
|
129
|
+
result.data
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
return result.data;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
console.error(
|
|
135
|
+
"[APPOINTMENT_SERVICE] Error testing callable function:",
|
|
136
|
+
error
|
|
137
|
+
);
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
87
142
|
/**
|
|
88
143
|
* Gets available booking slots for a specific clinic, practitioner, and procedure.
|
|
89
144
|
*
|
|
@@ -171,8 +226,8 @@ export class AppointmentService extends BaseService {
|
|
|
171
226
|
);
|
|
172
227
|
}
|
|
173
228
|
|
|
174
|
-
// Construct the function URL
|
|
175
|
-
const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/
|
|
229
|
+
// Construct the function URL for the Express app endpoint
|
|
230
|
+
const functionUrl = `https://europe-west6-metaestetics.cloudfunctions.net/bookingApi/getAvailableBookingSlots`;
|
|
176
231
|
|
|
177
232
|
// Get the authenticated user's ID token
|
|
178
233
|
// By default, getIdToken doesn't allow setting audience for web/mobile clients
|
|
@@ -789,4 +844,25 @@ export class AppointmentService extends BaseService {
|
|
|
789
844
|
|
|
790
845
|
return this.updateAppointment(appointmentId, updateData);
|
|
791
846
|
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Debug helper: Get the current user's ID token for testing purposes
|
|
850
|
+
* Use this token in Postman with Authorization: Bearer TOKEN
|
|
851
|
+
*/
|
|
852
|
+
async getDebugToken(): Promise<string | null> {
|
|
853
|
+
try {
|
|
854
|
+
const currentUser = this.auth.currentUser;
|
|
855
|
+
if (!currentUser) {
|
|
856
|
+
console.log("[APPOINTMENT_SERVICE] No user is signed in");
|
|
857
|
+
return null;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
const idToken = await currentUser.getIdToken();
|
|
861
|
+
console.log("[APPOINTMENT_SERVICE] Debug token:", idToken);
|
|
862
|
+
return idToken;
|
|
863
|
+
} catch (error) {
|
|
864
|
+
console.error("[APPOINTMENT_SERVICE] Error getting debug token:", error);
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
792
868
|
}
|