@blackcode_sa/metaestetics-api 1.4.11 → 1.4.13
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -24
- package/dist/index.mjs +13 -24
- package/package.json +1 -1
- package/src/services/clinic/utils/clinic-group.utils.ts +16 -27
- package/src/types/clinic/index.ts +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -876,8 +876,8 @@ declare const CLINICS_COLLECTION = "clinics";
|
|
|
876
876
|
interface ClinicContactInfo {
|
|
877
877
|
email: string;
|
|
878
878
|
phoneNumber: string;
|
|
879
|
-
alternativePhoneNumber?: string;
|
|
880
|
-
website?: string;
|
|
879
|
+
alternativePhoneNumber?: string | null;
|
|
880
|
+
website?: string | null;
|
|
881
881
|
}
|
|
882
882
|
/**
|
|
883
883
|
* Interface for clinic location
|
|
@@ -889,7 +889,7 @@ interface ClinicLocation {
|
|
|
889
889
|
postalCode: string;
|
|
890
890
|
latitude: number;
|
|
891
891
|
longitude: number;
|
|
892
|
-
geohash?: string;
|
|
892
|
+
geohash?: string | null;
|
|
893
893
|
}
|
|
894
894
|
/**
|
|
895
895
|
* Interface for working hours
|
package/dist/index.d.ts
CHANGED
|
@@ -876,8 +876,8 @@ declare const CLINICS_COLLECTION = "clinics";
|
|
|
876
876
|
interface ClinicContactInfo {
|
|
877
877
|
email: string;
|
|
878
878
|
phoneNumber: string;
|
|
879
|
-
alternativePhoneNumber?: string;
|
|
880
|
-
website?: string;
|
|
879
|
+
alternativePhoneNumber?: string | null;
|
|
880
|
+
website?: string | null;
|
|
881
881
|
}
|
|
882
882
|
/**
|
|
883
883
|
* Interface for clinic location
|
|
@@ -889,7 +889,7 @@ interface ClinicLocation {
|
|
|
889
889
|
postalCode: string;
|
|
890
890
|
latitude: number;
|
|
891
891
|
longitude: number;
|
|
892
|
-
geohash?: string;
|
|
892
|
+
geohash?: string | null;
|
|
893
893
|
}
|
|
894
894
|
/**
|
|
895
895
|
* Interface for working hours
|
package/dist/index.js
CHANGED
|
@@ -3780,7 +3780,6 @@ function generateId() {
|
|
|
3780
3780
|
return `${randomPart}-${timestamp}`;
|
|
3781
3781
|
}
|
|
3782
3782
|
async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdminService, app) {
|
|
3783
|
-
var _a, _b, _c, _d, _e;
|
|
3784
3783
|
console.log("[CLINIC_GROUP] Starting clinic group creation", {
|
|
3785
3784
|
ownerId,
|
|
3786
3785
|
isDefault
|
|
@@ -3853,29 +3852,10 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
|
|
|
3853
3852
|
name: validatedData.name,
|
|
3854
3853
|
logo: logoUrl,
|
|
3855
3854
|
// Use the uploaded logo URL or the original value
|
|
3856
|
-
description:
|
|
3857
|
-
hqLocation:
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
country: validatedData.hqLocation.country || "",
|
|
3861
|
-
postalCode: validatedData.hqLocation.postalCode || "",
|
|
3862
|
-
latitude: validatedData.hqLocation.latitude || 0,
|
|
3863
|
-
longitude: validatedData.hqLocation.longitude || 0,
|
|
3864
|
-
geohash: validatedData.hqLocation.geohash || void 0
|
|
3865
|
-
},
|
|
3866
|
-
contactInfo: {
|
|
3867
|
-
email: validatedData.contactInfo.email || "",
|
|
3868
|
-
phoneNumber: validatedData.contactInfo.phoneNumber || "",
|
|
3869
|
-
alternativePhoneNumber: isDefault ? void 0 : validatedData.contactInfo.alternativePhoneNumber || void 0,
|
|
3870
|
-
website: isDefault ? void 0 : validatedData.contactInfo.website || void 0
|
|
3871
|
-
},
|
|
3872
|
-
contactPerson: {
|
|
3873
|
-
firstName: ((_a = validatedData.contactPerson) == null ? void 0 : _a.firstName) || "",
|
|
3874
|
-
lastName: ((_b = validatedData.contactPerson) == null ? void 0 : _b.lastName) || "",
|
|
3875
|
-
email: ((_c = validatedData.contactPerson) == null ? void 0 : _c.email) || "",
|
|
3876
|
-
title: ((_d = validatedData.contactPerson) == null ? void 0 : _d.title) || null,
|
|
3877
|
-
phoneNumber: ((_e = validatedData.contactPerson) == null ? void 0 : _e.phoneNumber) || null
|
|
3878
|
-
},
|
|
3855
|
+
description: validatedData.description || "",
|
|
3856
|
+
hqLocation: validatedData.hqLocation,
|
|
3857
|
+
contactInfo: validatedData.contactInfo,
|
|
3858
|
+
contactPerson: validatedData.contactPerson,
|
|
3879
3859
|
subscriptionModel: validatedData.subscriptionModel || "no_subscription" /* NO_SUBSCRIPTION */,
|
|
3880
3860
|
clinics: [],
|
|
3881
3861
|
clinicsInfo: [],
|
|
@@ -3988,6 +3968,15 @@ async function updateClinicGroup(db, groupId, data, app) {
|
|
|
3988
3968
|
console.error("[CLINIC_GROUP] Error processing logo for update:", error);
|
|
3989
3969
|
}
|
|
3990
3970
|
}
|
|
3971
|
+
if (updatedData.contactInfo) {
|
|
3972
|
+
updatedData.contactInfo = {
|
|
3973
|
+
...updatedData.contactInfo,
|
|
3974
|
+
email: updatedData.contactInfo.email || "",
|
|
3975
|
+
phoneNumber: updatedData.contactInfo.phoneNumber || "",
|
|
3976
|
+
alternativePhoneNumber: updatedData.contactInfo.alternativePhoneNumber || "",
|
|
3977
|
+
website: updatedData.contactInfo.website || ""
|
|
3978
|
+
};
|
|
3979
|
+
}
|
|
3991
3980
|
updatedData = {
|
|
3992
3981
|
...updatedData,
|
|
3993
3982
|
updatedAt: import_firestore15.Timestamp.now()
|
package/dist/index.mjs
CHANGED
|
@@ -3736,7 +3736,6 @@ function generateId() {
|
|
|
3736
3736
|
return `${randomPart}-${timestamp}`;
|
|
3737
3737
|
}
|
|
3738
3738
|
async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdminService, app) {
|
|
3739
|
-
var _a, _b, _c, _d, _e;
|
|
3740
3739
|
console.log("[CLINIC_GROUP] Starting clinic group creation", {
|
|
3741
3740
|
ownerId,
|
|
3742
3741
|
isDefault
|
|
@@ -3809,29 +3808,10 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
|
|
|
3809
3808
|
name: validatedData.name,
|
|
3810
3809
|
logo: logoUrl,
|
|
3811
3810
|
// Use the uploaded logo URL or the original value
|
|
3812
|
-
description:
|
|
3813
|
-
hqLocation:
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
country: validatedData.hqLocation.country || "",
|
|
3817
|
-
postalCode: validatedData.hqLocation.postalCode || "",
|
|
3818
|
-
latitude: validatedData.hqLocation.latitude || 0,
|
|
3819
|
-
longitude: validatedData.hqLocation.longitude || 0,
|
|
3820
|
-
geohash: validatedData.hqLocation.geohash || void 0
|
|
3821
|
-
},
|
|
3822
|
-
contactInfo: {
|
|
3823
|
-
email: validatedData.contactInfo.email || "",
|
|
3824
|
-
phoneNumber: validatedData.contactInfo.phoneNumber || "",
|
|
3825
|
-
alternativePhoneNumber: isDefault ? void 0 : validatedData.contactInfo.alternativePhoneNumber || void 0,
|
|
3826
|
-
website: isDefault ? void 0 : validatedData.contactInfo.website || void 0
|
|
3827
|
-
},
|
|
3828
|
-
contactPerson: {
|
|
3829
|
-
firstName: ((_a = validatedData.contactPerson) == null ? void 0 : _a.firstName) || "",
|
|
3830
|
-
lastName: ((_b = validatedData.contactPerson) == null ? void 0 : _b.lastName) || "",
|
|
3831
|
-
email: ((_c = validatedData.contactPerson) == null ? void 0 : _c.email) || "",
|
|
3832
|
-
title: ((_d = validatedData.contactPerson) == null ? void 0 : _d.title) || null,
|
|
3833
|
-
phoneNumber: ((_e = validatedData.contactPerson) == null ? void 0 : _e.phoneNumber) || null
|
|
3834
|
-
},
|
|
3811
|
+
description: validatedData.description || "",
|
|
3812
|
+
hqLocation: validatedData.hqLocation,
|
|
3813
|
+
contactInfo: validatedData.contactInfo,
|
|
3814
|
+
contactPerson: validatedData.contactPerson,
|
|
3835
3815
|
subscriptionModel: validatedData.subscriptionModel || "no_subscription" /* NO_SUBSCRIPTION */,
|
|
3836
3816
|
clinics: [],
|
|
3837
3817
|
clinicsInfo: [],
|
|
@@ -3944,6 +3924,15 @@ async function updateClinicGroup(db, groupId, data, app) {
|
|
|
3944
3924
|
console.error("[CLINIC_GROUP] Error processing logo for update:", error);
|
|
3945
3925
|
}
|
|
3946
3926
|
}
|
|
3927
|
+
if (updatedData.contactInfo) {
|
|
3928
|
+
updatedData.contactInfo = {
|
|
3929
|
+
...updatedData.contactInfo,
|
|
3930
|
+
email: updatedData.contactInfo.email || "",
|
|
3931
|
+
phoneNumber: updatedData.contactInfo.phoneNumber || "",
|
|
3932
|
+
alternativePhoneNumber: updatedData.contactInfo.alternativePhoneNumber || "",
|
|
3933
|
+
website: updatedData.contactInfo.website || ""
|
|
3934
|
+
};
|
|
3935
|
+
}
|
|
3947
3936
|
updatedData = {
|
|
3948
3937
|
...updatedData,
|
|
3949
3938
|
updatedAt: Timestamp10.now()
|
package/package.json
CHANGED
|
@@ -152,33 +152,10 @@ export async function createClinicGroup(
|
|
|
152
152
|
id: groupId,
|
|
153
153
|
name: validatedData.name,
|
|
154
154
|
logo: logoUrl, // Use the uploaded logo URL or the original value
|
|
155
|
-
description:
|
|
156
|
-
hqLocation:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
country: validatedData.hqLocation.country || "",
|
|
160
|
-
postalCode: validatedData.hqLocation.postalCode || "",
|
|
161
|
-
latitude: validatedData.hqLocation.latitude || 0,
|
|
162
|
-
longitude: validatedData.hqLocation.longitude || 0,
|
|
163
|
-
geohash: validatedData.hqLocation.geohash || undefined,
|
|
164
|
-
},
|
|
165
|
-
contactInfo: {
|
|
166
|
-
email: validatedData.contactInfo.email || "",
|
|
167
|
-
phoneNumber: validatedData.contactInfo.phoneNumber || "",
|
|
168
|
-
alternativePhoneNumber: isDefault
|
|
169
|
-
? undefined
|
|
170
|
-
: validatedData.contactInfo.alternativePhoneNumber || undefined,
|
|
171
|
-
website: isDefault
|
|
172
|
-
? undefined
|
|
173
|
-
: validatedData.contactInfo.website || undefined,
|
|
174
|
-
},
|
|
175
|
-
contactPerson: {
|
|
176
|
-
firstName: validatedData.contactPerson?.firstName || "",
|
|
177
|
-
lastName: validatedData.contactPerson?.lastName || "",
|
|
178
|
-
email: validatedData.contactPerson?.email || "",
|
|
179
|
-
title: validatedData.contactPerson?.title || null,
|
|
180
|
-
phoneNumber: validatedData.contactPerson?.phoneNumber || null,
|
|
181
|
-
},
|
|
155
|
+
description: validatedData.description || "",
|
|
156
|
+
hqLocation: validatedData.hqLocation,
|
|
157
|
+
contactInfo: validatedData.contactInfo,
|
|
158
|
+
contactPerson: validatedData.contactPerson,
|
|
182
159
|
subscriptionModel:
|
|
183
160
|
validatedData.subscriptionModel || SubscriptionModel.NO_SUBSCRIPTION,
|
|
184
161
|
clinics: [],
|
|
@@ -346,6 +323,18 @@ export async function updateClinicGroup(
|
|
|
346
323
|
}
|
|
347
324
|
}
|
|
348
325
|
|
|
326
|
+
// Ensure contactInfo fields are never undefined
|
|
327
|
+
if (updatedData.contactInfo) {
|
|
328
|
+
updatedData.contactInfo = {
|
|
329
|
+
...updatedData.contactInfo,
|
|
330
|
+
email: updatedData.contactInfo.email || "",
|
|
331
|
+
phoneNumber: updatedData.contactInfo.phoneNumber || "",
|
|
332
|
+
alternativePhoneNumber:
|
|
333
|
+
updatedData.contactInfo.alternativePhoneNumber || "",
|
|
334
|
+
website: updatedData.contactInfo.website || "",
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
349
338
|
// Add timestamp
|
|
350
339
|
updatedData = {
|
|
351
340
|
...updatedData,
|
|
@@ -20,8 +20,8 @@ export * from "./preferences.types";
|
|
|
20
20
|
export interface ClinicContactInfo {
|
|
21
21
|
email: string;
|
|
22
22
|
phoneNumber: string;
|
|
23
|
-
alternativePhoneNumber?: string;
|
|
24
|
-
website?: string;
|
|
23
|
+
alternativePhoneNumber?: string | null;
|
|
24
|
+
website?: string | null;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -34,7 +34,7 @@ export interface ClinicLocation {
|
|
|
34
34
|
postalCode: string;
|
|
35
35
|
latitude: number;
|
|
36
36
|
longitude: number;
|
|
37
|
-
geohash?: string;
|
|
37
|
+
geohash?: string | null;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|