@blackcode_sa/metaestetics-api 1.12.35 → 1.12.36
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.js +28 -6
- package/dist/index.mjs +28 -6
- package/package.json +1 -1
- package/src/services/appointment/appointment.service.ts +30 -8
package/dist/index.js
CHANGED
|
@@ -2835,7 +2835,10 @@ var AppointmentService = class extends BaseService {
|
|
|
2835
2835
|
zonesData: currentMetadata.zonesData || null,
|
|
2836
2836
|
appointmentProducts: currentMetadata.appointmentProducts || [],
|
|
2837
2837
|
extendedProcedures: currentMetadata.extendedProcedures || [],
|
|
2838
|
-
zoneBilling
|
|
2838
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
2839
|
+
...currentMetadata.zoneBilling !== void 0 && {
|
|
2840
|
+
zoneBilling: currentMetadata.zoneBilling
|
|
2841
|
+
},
|
|
2839
2842
|
finalbilling: currentMetadata.finalbilling,
|
|
2840
2843
|
finalizationNotes: currentMetadata.finalizationNotes
|
|
2841
2844
|
},
|
|
@@ -2940,7 +2943,10 @@ var AppointmentService = class extends BaseService {
|
|
|
2940
2943
|
zonesData: ((_c = appointment.metadata) == null ? void 0 : _c.zonesData) || null,
|
|
2941
2944
|
appointmentProducts: ((_d = appointment.metadata) == null ? void 0 : _d.appointmentProducts) || [],
|
|
2942
2945
|
extendedProcedures: ((_e = appointment.metadata) == null ? void 0 : _e.extendedProcedures) || [],
|
|
2943
|
-
|
|
2946
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
2947
|
+
...((_f = appointment.metadata) == null ? void 0 : _f.zoneBilling) !== void 0 && {
|
|
2948
|
+
zoneBilling: appointment.metadata.zoneBilling
|
|
2949
|
+
},
|
|
2944
2950
|
finalbilling: ((_g = appointment.metadata) == null ? void 0 : _g.finalbilling) || null,
|
|
2945
2951
|
finalizationNotes: ((_h = appointment.metadata) == null ? void 0 : _h.finalizationNotes) || null
|
|
2946
2952
|
},
|
|
@@ -3028,7 +3034,13 @@ var AppointmentService = class extends BaseService {
|
|
|
3028
3034
|
console.log(
|
|
3029
3035
|
`[APPOINTMENT_SERVICE] Overriding price for item ${itemIndex} in zone ${zoneId} to ${newPrice}`
|
|
3030
3036
|
);
|
|
3031
|
-
return await overridePriceForZoneItemUtil(
|
|
3037
|
+
return await overridePriceForZoneItemUtil(
|
|
3038
|
+
this.db,
|
|
3039
|
+
appointmentId,
|
|
3040
|
+
zoneId,
|
|
3041
|
+
itemIndex,
|
|
3042
|
+
newPrice
|
|
3043
|
+
);
|
|
3032
3044
|
} catch (error) {
|
|
3033
3045
|
console.error(`[APPOINTMENT_SERVICE] Error overriding price:`, error);
|
|
3034
3046
|
throw error;
|
|
@@ -3100,7 +3112,9 @@ var AppointmentService = class extends BaseService {
|
|
|
3100
3112
|
*/
|
|
3101
3113
|
async getExtendedProcedures(appointmentId) {
|
|
3102
3114
|
try {
|
|
3103
|
-
console.log(
|
|
3115
|
+
console.log(
|
|
3116
|
+
`[APPOINTMENT_SERVICE] Getting extended procedures for appointment ${appointmentId}`
|
|
3117
|
+
);
|
|
3104
3118
|
return await getExtendedProceduresUtil(this.db, appointmentId);
|
|
3105
3119
|
} catch (error) {
|
|
3106
3120
|
console.error(`[APPOINTMENT_SERVICE] Error getting extended procedures:`, error);
|
|
@@ -3116,7 +3130,9 @@ var AppointmentService = class extends BaseService {
|
|
|
3116
3130
|
*/
|
|
3117
3131
|
async getAppointmentProducts(appointmentId) {
|
|
3118
3132
|
try {
|
|
3119
|
-
console.log(
|
|
3133
|
+
console.log(
|
|
3134
|
+
`[APPOINTMENT_SERVICE] Getting appointment products for appointment ${appointmentId}`
|
|
3135
|
+
);
|
|
3120
3136
|
return await getAppointmentProductsUtil(this.db, appointmentId);
|
|
3121
3137
|
} catch (error) {
|
|
3122
3138
|
console.error(`[APPOINTMENT_SERVICE] Error getting appointment products:`, error);
|
|
@@ -3133,7 +3149,9 @@ var AppointmentService = class extends BaseService {
|
|
|
3133
3149
|
async recalculateFinalBilling(appointmentId, taxRate) {
|
|
3134
3150
|
var _a;
|
|
3135
3151
|
try {
|
|
3136
|
-
console.log(
|
|
3152
|
+
console.log(
|
|
3153
|
+
`[APPOINTMENT_SERVICE] Recalculating final billing for appointment ${appointmentId}`
|
|
3154
|
+
);
|
|
3137
3155
|
const appointment = await this.getAppointmentById(appointmentId);
|
|
3138
3156
|
if (!appointment) {
|
|
3139
3157
|
throw new Error(`Appointment with ID ${appointmentId} not found`);
|
|
@@ -3159,6 +3177,10 @@ var AppointmentService = class extends BaseService {
|
|
|
3159
3177
|
zonesData: currentMetadata.zonesData,
|
|
3160
3178
|
appointmentProducts: currentMetadata.appointmentProducts || [],
|
|
3161
3179
|
extendedProcedures: currentMetadata.extendedProcedures || [],
|
|
3180
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
3181
|
+
...currentMetadata.zoneBilling !== void 0 && {
|
|
3182
|
+
zoneBilling: currentMetadata.zoneBilling
|
|
3183
|
+
},
|
|
3162
3184
|
finalbilling,
|
|
3163
3185
|
finalizationNotes: currentMetadata.finalizationNotes
|
|
3164
3186
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -2734,7 +2734,10 @@ var AppointmentService = class extends BaseService {
|
|
|
2734
2734
|
zonesData: currentMetadata.zonesData || null,
|
|
2735
2735
|
appointmentProducts: currentMetadata.appointmentProducts || [],
|
|
2736
2736
|
extendedProcedures: currentMetadata.extendedProcedures || [],
|
|
2737
|
-
zoneBilling
|
|
2737
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
2738
|
+
...currentMetadata.zoneBilling !== void 0 && {
|
|
2739
|
+
zoneBilling: currentMetadata.zoneBilling
|
|
2740
|
+
},
|
|
2738
2741
|
finalbilling: currentMetadata.finalbilling,
|
|
2739
2742
|
finalizationNotes: currentMetadata.finalizationNotes
|
|
2740
2743
|
},
|
|
@@ -2839,7 +2842,10 @@ var AppointmentService = class extends BaseService {
|
|
|
2839
2842
|
zonesData: ((_c = appointment.metadata) == null ? void 0 : _c.zonesData) || null,
|
|
2840
2843
|
appointmentProducts: ((_d = appointment.metadata) == null ? void 0 : _d.appointmentProducts) || [],
|
|
2841
2844
|
extendedProcedures: ((_e = appointment.metadata) == null ? void 0 : _e.extendedProcedures) || [],
|
|
2842
|
-
|
|
2845
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
2846
|
+
...((_f = appointment.metadata) == null ? void 0 : _f.zoneBilling) !== void 0 && {
|
|
2847
|
+
zoneBilling: appointment.metadata.zoneBilling
|
|
2848
|
+
},
|
|
2843
2849
|
finalbilling: ((_g = appointment.metadata) == null ? void 0 : _g.finalbilling) || null,
|
|
2844
2850
|
finalizationNotes: ((_h = appointment.metadata) == null ? void 0 : _h.finalizationNotes) || null
|
|
2845
2851
|
},
|
|
@@ -2927,7 +2933,13 @@ var AppointmentService = class extends BaseService {
|
|
|
2927
2933
|
console.log(
|
|
2928
2934
|
`[APPOINTMENT_SERVICE] Overriding price for item ${itemIndex} in zone ${zoneId} to ${newPrice}`
|
|
2929
2935
|
);
|
|
2930
|
-
return await overridePriceForZoneItemUtil(
|
|
2936
|
+
return await overridePriceForZoneItemUtil(
|
|
2937
|
+
this.db,
|
|
2938
|
+
appointmentId,
|
|
2939
|
+
zoneId,
|
|
2940
|
+
itemIndex,
|
|
2941
|
+
newPrice
|
|
2942
|
+
);
|
|
2931
2943
|
} catch (error) {
|
|
2932
2944
|
console.error(`[APPOINTMENT_SERVICE] Error overriding price:`, error);
|
|
2933
2945
|
throw error;
|
|
@@ -2999,7 +3011,9 @@ var AppointmentService = class extends BaseService {
|
|
|
2999
3011
|
*/
|
|
3000
3012
|
async getExtendedProcedures(appointmentId) {
|
|
3001
3013
|
try {
|
|
3002
|
-
console.log(
|
|
3014
|
+
console.log(
|
|
3015
|
+
`[APPOINTMENT_SERVICE] Getting extended procedures for appointment ${appointmentId}`
|
|
3016
|
+
);
|
|
3003
3017
|
return await getExtendedProceduresUtil(this.db, appointmentId);
|
|
3004
3018
|
} catch (error) {
|
|
3005
3019
|
console.error(`[APPOINTMENT_SERVICE] Error getting extended procedures:`, error);
|
|
@@ -3015,7 +3029,9 @@ var AppointmentService = class extends BaseService {
|
|
|
3015
3029
|
*/
|
|
3016
3030
|
async getAppointmentProducts(appointmentId) {
|
|
3017
3031
|
try {
|
|
3018
|
-
console.log(
|
|
3032
|
+
console.log(
|
|
3033
|
+
`[APPOINTMENT_SERVICE] Getting appointment products for appointment ${appointmentId}`
|
|
3034
|
+
);
|
|
3019
3035
|
return await getAppointmentProductsUtil(this.db, appointmentId);
|
|
3020
3036
|
} catch (error) {
|
|
3021
3037
|
console.error(`[APPOINTMENT_SERVICE] Error getting appointment products:`, error);
|
|
@@ -3032,7 +3048,9 @@ var AppointmentService = class extends BaseService {
|
|
|
3032
3048
|
async recalculateFinalBilling(appointmentId, taxRate) {
|
|
3033
3049
|
var _a;
|
|
3034
3050
|
try {
|
|
3035
|
-
console.log(
|
|
3051
|
+
console.log(
|
|
3052
|
+
`[APPOINTMENT_SERVICE] Recalculating final billing for appointment ${appointmentId}`
|
|
3053
|
+
);
|
|
3036
3054
|
const appointment = await this.getAppointmentById(appointmentId);
|
|
3037
3055
|
if (!appointment) {
|
|
3038
3056
|
throw new Error(`Appointment with ID ${appointmentId} not found`);
|
|
@@ -3058,6 +3076,10 @@ var AppointmentService = class extends BaseService {
|
|
|
3058
3076
|
zonesData: currentMetadata.zonesData,
|
|
3059
3077
|
appointmentProducts: currentMetadata.appointmentProducts || [],
|
|
3060
3078
|
extendedProcedures: currentMetadata.extendedProcedures || [],
|
|
3079
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
3080
|
+
...currentMetadata.zoneBilling !== void 0 && {
|
|
3081
|
+
zoneBilling: currentMetadata.zoneBilling
|
|
3082
|
+
},
|
|
3061
3083
|
finalbilling,
|
|
3062
3084
|
finalizationNotes: currentMetadata.finalizationNotes
|
|
3063
3085
|
},
|
package/package.json
CHANGED
|
@@ -1313,7 +1313,10 @@ export class AppointmentService extends BaseService {
|
|
|
1313
1313
|
zonesData: currentMetadata.zonesData || null,
|
|
1314
1314
|
appointmentProducts: currentMetadata.appointmentProducts || [],
|
|
1315
1315
|
extendedProcedures: currentMetadata.extendedProcedures || [],
|
|
1316
|
-
zoneBilling
|
|
1316
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
1317
|
+
...(currentMetadata.zoneBilling !== undefined && {
|
|
1318
|
+
zoneBilling: currentMetadata.zoneBilling,
|
|
1319
|
+
}),
|
|
1317
1320
|
finalbilling: currentMetadata.finalbilling,
|
|
1318
1321
|
finalizationNotes: currentMetadata.finalizationNotes,
|
|
1319
1322
|
},
|
|
@@ -1448,7 +1451,10 @@ export class AppointmentService extends BaseService {
|
|
|
1448
1451
|
zonesData: appointment.metadata?.zonesData || null,
|
|
1449
1452
|
appointmentProducts: appointment.metadata?.appointmentProducts || [],
|
|
1450
1453
|
extendedProcedures: appointment.metadata?.extendedProcedures || [],
|
|
1451
|
-
|
|
1454
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
1455
|
+
...(appointment.metadata?.zoneBilling !== undefined && {
|
|
1456
|
+
zoneBilling: appointment.metadata.zoneBilling,
|
|
1457
|
+
}),
|
|
1452
1458
|
finalbilling: appointment.metadata?.finalbilling || null,
|
|
1453
1459
|
finalizationNotes: appointment.metadata?.finalizationNotes || null,
|
|
1454
1460
|
},
|
|
@@ -1479,7 +1485,7 @@ export class AppointmentService extends BaseService {
|
|
|
1479
1485
|
async addItemToZone(
|
|
1480
1486
|
appointmentId: string,
|
|
1481
1487
|
zoneId: string,
|
|
1482
|
-
item: Omit<ZoneItemData, 'subtotal' | 'parentZone'
|
|
1488
|
+
item: Omit<ZoneItemData, 'subtotal' | 'parentZone'>,
|
|
1483
1489
|
): Promise<Appointment> {
|
|
1484
1490
|
try {
|
|
1485
1491
|
console.log(
|
|
@@ -1561,7 +1567,13 @@ export class AppointmentService extends BaseService {
|
|
|
1561
1567
|
console.log(
|
|
1562
1568
|
`[APPOINTMENT_SERVICE] Overriding price for item ${itemIndex} in zone ${zoneId} to ${newPrice}`,
|
|
1563
1569
|
);
|
|
1564
|
-
return await overridePriceForZoneItemUtil(
|
|
1570
|
+
return await overridePriceForZoneItemUtil(
|
|
1571
|
+
this.db,
|
|
1572
|
+
appointmentId,
|
|
1573
|
+
zoneId,
|
|
1574
|
+
itemIndex,
|
|
1575
|
+
newPrice,
|
|
1576
|
+
);
|
|
1565
1577
|
} catch (error) {
|
|
1566
1578
|
console.error(`[APPOINTMENT_SERVICE] Error overriding price:`, error);
|
|
1567
1579
|
throw error;
|
|
@@ -1642,7 +1654,9 @@ export class AppointmentService extends BaseService {
|
|
|
1642
1654
|
*/
|
|
1643
1655
|
async getExtendedProcedures(appointmentId: string): Promise<ExtendedProcedureInfo[]> {
|
|
1644
1656
|
try {
|
|
1645
|
-
console.log(
|
|
1657
|
+
console.log(
|
|
1658
|
+
`[APPOINTMENT_SERVICE] Getting extended procedures for appointment ${appointmentId}`,
|
|
1659
|
+
);
|
|
1646
1660
|
return await getExtendedProceduresUtil(this.db, appointmentId);
|
|
1647
1661
|
} catch (error) {
|
|
1648
1662
|
console.error(`[APPOINTMENT_SERVICE] Error getting extended procedures:`, error);
|
|
@@ -1659,7 +1673,9 @@ export class AppointmentService extends BaseService {
|
|
|
1659
1673
|
*/
|
|
1660
1674
|
async getAppointmentProducts(appointmentId: string): Promise<AppointmentProductMetadata[]> {
|
|
1661
1675
|
try {
|
|
1662
|
-
console.log(
|
|
1676
|
+
console.log(
|
|
1677
|
+
`[APPOINTMENT_SERVICE] Getting appointment products for appointment ${appointmentId}`,
|
|
1678
|
+
);
|
|
1663
1679
|
return await getAppointmentProductsUtil(this.db, appointmentId);
|
|
1664
1680
|
} catch (error) {
|
|
1665
1681
|
console.error(`[APPOINTMENT_SERVICE] Error getting appointment products:`, error);
|
|
@@ -1676,8 +1692,10 @@ export class AppointmentService extends BaseService {
|
|
|
1676
1692
|
*/
|
|
1677
1693
|
async recalculateFinalBilling(appointmentId: string, taxRate?: number): Promise<Appointment> {
|
|
1678
1694
|
try {
|
|
1679
|
-
console.log(
|
|
1680
|
-
|
|
1695
|
+
console.log(
|
|
1696
|
+
`[APPOINTMENT_SERVICE] Recalculating final billing for appointment ${appointmentId}`,
|
|
1697
|
+
);
|
|
1698
|
+
|
|
1681
1699
|
const appointment = await this.getAppointmentById(appointmentId);
|
|
1682
1700
|
if (!appointment) {
|
|
1683
1701
|
throw new Error(`Appointment with ID ${appointmentId} not found`);
|
|
@@ -1707,6 +1725,10 @@ export class AppointmentService extends BaseService {
|
|
|
1707
1725
|
zonesData: currentMetadata.zonesData,
|
|
1708
1726
|
appointmentProducts: currentMetadata.appointmentProducts || [],
|
|
1709
1727
|
extendedProcedures: currentMetadata.extendedProcedures || [],
|
|
1728
|
+
// Only include zoneBilling if it exists (avoid undefined values in Firestore)
|
|
1729
|
+
...(currentMetadata.zoneBilling !== undefined && {
|
|
1730
|
+
zoneBilling: currentMetadata.zoneBilling,
|
|
1731
|
+
}),
|
|
1710
1732
|
finalbilling,
|
|
1711
1733
|
finalizationNotes: currentMetadata.finalizationNotes,
|
|
1712
1734
|
},
|