@blackcode_sa/metaestetics-api 1.4.17 → 1.4.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 +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +37 -41
- package/dist/index.mjs +37 -41
- package/package.json +1 -1
- package/src/services/clinic/clinic.service.ts +2 -2
- package/src/services/clinic/utils/clinic.utils.ts +49 -47
- package/src/types/clinic/index.ts +3 -3
- package/src/validations/clinic.schema.ts +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1186,7 +1186,7 @@ interface Clinic {
|
|
|
1186
1186
|
workingHours: WorkingHours;
|
|
1187
1187
|
tags: ClinicTag[];
|
|
1188
1188
|
featuredPhotos: string[];
|
|
1189
|
-
|
|
1189
|
+
coverPhoto: string | null;
|
|
1190
1190
|
photosWithTags?: {
|
|
1191
1191
|
url: string;
|
|
1192
1192
|
tag: string;
|
|
@@ -1219,7 +1219,7 @@ interface CreateClinicData {
|
|
|
1219
1219
|
contactInfo: ClinicContactInfo;
|
|
1220
1220
|
workingHours: WorkingHours;
|
|
1221
1221
|
tags: ClinicTag[];
|
|
1222
|
-
|
|
1222
|
+
coverPhoto: string | null;
|
|
1223
1223
|
photosWithTags?: {
|
|
1224
1224
|
url: string;
|
|
1225
1225
|
tag: string;
|
|
@@ -1296,7 +1296,7 @@ interface ClinicBranchSetupData {
|
|
|
1296
1296
|
workingHours: WorkingHours;
|
|
1297
1297
|
tags: ClinicTag[];
|
|
1298
1298
|
logo?: string;
|
|
1299
|
-
|
|
1299
|
+
coverPhoto: string | null;
|
|
1300
1300
|
photosWithTags?: {
|
|
1301
1301
|
url: string;
|
|
1302
1302
|
tag: string;
|
|
@@ -8888,7 +8888,7 @@ declare const clinicSchema: z.ZodObject<{
|
|
|
8888
8888
|
}>;
|
|
8889
8889
|
tags: z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">;
|
|
8890
8890
|
featuredPhotos: z.ZodArray<z.ZodString, "many">;
|
|
8891
|
-
|
|
8891
|
+
coverPhoto: z.ZodNullable<z.ZodString>;
|
|
8892
8892
|
photosWithTags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
8893
8893
|
url: z.ZodString;
|
|
8894
8894
|
tag: z.ZodString;
|
|
@@ -9100,7 +9100,7 @@ declare const clinicSchema: z.ZodObject<{
|
|
|
9100
9100
|
}[] | undefined;
|
|
9101
9101
|
} | null;
|
|
9102
9102
|
};
|
|
9103
|
-
|
|
9103
|
+
coverPhoto: string | null;
|
|
9104
9104
|
services: string[];
|
|
9105
9105
|
admins: string[];
|
|
9106
9106
|
featuredPhotos: string[];
|
|
@@ -9233,7 +9233,7 @@ declare const clinicSchema: z.ZodObject<{
|
|
|
9233
9233
|
}[] | undefined;
|
|
9234
9234
|
} | null;
|
|
9235
9235
|
};
|
|
9236
|
-
|
|
9236
|
+
coverPhoto: string | null;
|
|
9237
9237
|
services: string[];
|
|
9238
9238
|
admins: string[];
|
|
9239
9239
|
featuredPhotos: string[];
|
|
@@ -9847,7 +9847,7 @@ declare const createClinicSchema: z.ZodObject<{
|
|
|
9847
9847
|
} | null;
|
|
9848
9848
|
}>;
|
|
9849
9849
|
tags: z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">;
|
|
9850
|
-
|
|
9850
|
+
coverPhoto: z.ZodNullable<z.ZodString>;
|
|
9851
9851
|
photosWithTags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9852
9852
|
url: z.ZodString;
|
|
9853
9853
|
tag: z.ZodString;
|
|
@@ -9945,7 +9945,7 @@ declare const createClinicSchema: z.ZodObject<{
|
|
|
9945
9945
|
}[] | undefined;
|
|
9946
9946
|
} | null;
|
|
9947
9947
|
};
|
|
9948
|
-
|
|
9948
|
+
coverPhoto: string | null;
|
|
9949
9949
|
services: string[];
|
|
9950
9950
|
admins: string[];
|
|
9951
9951
|
description?: string | undefined;
|
|
@@ -10035,7 +10035,7 @@ declare const createClinicSchema: z.ZodObject<{
|
|
|
10035
10035
|
}[] | undefined;
|
|
10036
10036
|
} | null;
|
|
10037
10037
|
};
|
|
10038
|
-
|
|
10038
|
+
coverPhoto: string | null;
|
|
10039
10039
|
services: string[];
|
|
10040
10040
|
admins: string[];
|
|
10041
10041
|
description?: string | undefined;
|
|
@@ -10722,7 +10722,7 @@ declare const clinicBranchSetupSchema: z.ZodObject<{
|
|
|
10722
10722
|
}>;
|
|
10723
10723
|
tags: z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">;
|
|
10724
10724
|
logo: z.ZodOptional<z.ZodString>;
|
|
10725
|
-
|
|
10725
|
+
coverPhoto: z.ZodNullable<z.ZodString>;
|
|
10726
10726
|
photosWithTags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10727
10727
|
url: z.ZodString;
|
|
10728
10728
|
tag: z.ZodString;
|
|
@@ -10810,7 +10810,7 @@ declare const clinicBranchSetupSchema: z.ZodObject<{
|
|
|
10810
10810
|
}[] | undefined;
|
|
10811
10811
|
} | null;
|
|
10812
10812
|
};
|
|
10813
|
-
|
|
10813
|
+
coverPhoto: string | null;
|
|
10814
10814
|
description?: string | undefined;
|
|
10815
10815
|
logo?: string | undefined;
|
|
10816
10816
|
photosWithTags?: {
|
|
@@ -10894,7 +10894,7 @@ declare const clinicBranchSetupSchema: z.ZodObject<{
|
|
|
10894
10894
|
}[] | undefined;
|
|
10895
10895
|
} | null;
|
|
10896
10896
|
};
|
|
10897
|
-
|
|
10897
|
+
coverPhoto: string | null;
|
|
10898
10898
|
description?: string | undefined;
|
|
10899
10899
|
logo?: string | undefined;
|
|
10900
10900
|
photosWithTags?: {
|
|
@@ -11466,7 +11466,7 @@ declare const updateClinicSchema: z.ZodObject<{
|
|
|
11466
11466
|
} | null;
|
|
11467
11467
|
}>>;
|
|
11468
11468
|
tags: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">>;
|
|
11469
|
-
|
|
11469
|
+
coverPhoto: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11470
11470
|
photosWithTags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11471
11471
|
url: z.ZodString;
|
|
11472
11472
|
tag: z.ZodString;
|
|
@@ -11566,7 +11566,7 @@ declare const updateClinicSchema: z.ZodObject<{
|
|
|
11566
11566
|
}[] | undefined;
|
|
11567
11567
|
} | null;
|
|
11568
11568
|
} | undefined;
|
|
11569
|
-
|
|
11569
|
+
coverPhoto?: string | null | undefined;
|
|
11570
11570
|
photosWithTags?: {
|
|
11571
11571
|
url: string;
|
|
11572
11572
|
tag: string;
|
|
@@ -11656,7 +11656,7 @@ declare const updateClinicSchema: z.ZodObject<{
|
|
|
11656
11656
|
}[] | undefined;
|
|
11657
11657
|
} | null;
|
|
11658
11658
|
} | undefined;
|
|
11659
|
-
|
|
11659
|
+
coverPhoto?: string | null | undefined;
|
|
11660
11660
|
photosWithTags?: {
|
|
11661
11661
|
url: string;
|
|
11662
11662
|
tag: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1186,7 +1186,7 @@ interface Clinic {
|
|
|
1186
1186
|
workingHours: WorkingHours;
|
|
1187
1187
|
tags: ClinicTag[];
|
|
1188
1188
|
featuredPhotos: string[];
|
|
1189
|
-
|
|
1189
|
+
coverPhoto: string | null;
|
|
1190
1190
|
photosWithTags?: {
|
|
1191
1191
|
url: string;
|
|
1192
1192
|
tag: string;
|
|
@@ -1219,7 +1219,7 @@ interface CreateClinicData {
|
|
|
1219
1219
|
contactInfo: ClinicContactInfo;
|
|
1220
1220
|
workingHours: WorkingHours;
|
|
1221
1221
|
tags: ClinicTag[];
|
|
1222
|
-
|
|
1222
|
+
coverPhoto: string | null;
|
|
1223
1223
|
photosWithTags?: {
|
|
1224
1224
|
url: string;
|
|
1225
1225
|
tag: string;
|
|
@@ -1296,7 +1296,7 @@ interface ClinicBranchSetupData {
|
|
|
1296
1296
|
workingHours: WorkingHours;
|
|
1297
1297
|
tags: ClinicTag[];
|
|
1298
1298
|
logo?: string;
|
|
1299
|
-
|
|
1299
|
+
coverPhoto: string | null;
|
|
1300
1300
|
photosWithTags?: {
|
|
1301
1301
|
url: string;
|
|
1302
1302
|
tag: string;
|
|
@@ -8888,7 +8888,7 @@ declare const clinicSchema: z.ZodObject<{
|
|
|
8888
8888
|
}>;
|
|
8889
8889
|
tags: z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">;
|
|
8890
8890
|
featuredPhotos: z.ZodArray<z.ZodString, "many">;
|
|
8891
|
-
|
|
8891
|
+
coverPhoto: z.ZodNullable<z.ZodString>;
|
|
8892
8892
|
photosWithTags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
8893
8893
|
url: z.ZodString;
|
|
8894
8894
|
tag: z.ZodString;
|
|
@@ -9100,7 +9100,7 @@ declare const clinicSchema: z.ZodObject<{
|
|
|
9100
9100
|
}[] | undefined;
|
|
9101
9101
|
} | null;
|
|
9102
9102
|
};
|
|
9103
|
-
|
|
9103
|
+
coverPhoto: string | null;
|
|
9104
9104
|
services: string[];
|
|
9105
9105
|
admins: string[];
|
|
9106
9106
|
featuredPhotos: string[];
|
|
@@ -9233,7 +9233,7 @@ declare const clinicSchema: z.ZodObject<{
|
|
|
9233
9233
|
}[] | undefined;
|
|
9234
9234
|
} | null;
|
|
9235
9235
|
};
|
|
9236
|
-
|
|
9236
|
+
coverPhoto: string | null;
|
|
9237
9237
|
services: string[];
|
|
9238
9238
|
admins: string[];
|
|
9239
9239
|
featuredPhotos: string[];
|
|
@@ -9847,7 +9847,7 @@ declare const createClinicSchema: z.ZodObject<{
|
|
|
9847
9847
|
} | null;
|
|
9848
9848
|
}>;
|
|
9849
9849
|
tags: z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">;
|
|
9850
|
-
|
|
9850
|
+
coverPhoto: z.ZodNullable<z.ZodString>;
|
|
9851
9851
|
photosWithTags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9852
9852
|
url: z.ZodString;
|
|
9853
9853
|
tag: z.ZodString;
|
|
@@ -9945,7 +9945,7 @@ declare const createClinicSchema: z.ZodObject<{
|
|
|
9945
9945
|
}[] | undefined;
|
|
9946
9946
|
} | null;
|
|
9947
9947
|
};
|
|
9948
|
-
|
|
9948
|
+
coverPhoto: string | null;
|
|
9949
9949
|
services: string[];
|
|
9950
9950
|
admins: string[];
|
|
9951
9951
|
description?: string | undefined;
|
|
@@ -10035,7 +10035,7 @@ declare const createClinicSchema: z.ZodObject<{
|
|
|
10035
10035
|
}[] | undefined;
|
|
10036
10036
|
} | null;
|
|
10037
10037
|
};
|
|
10038
|
-
|
|
10038
|
+
coverPhoto: string | null;
|
|
10039
10039
|
services: string[];
|
|
10040
10040
|
admins: string[];
|
|
10041
10041
|
description?: string | undefined;
|
|
@@ -10722,7 +10722,7 @@ declare const clinicBranchSetupSchema: z.ZodObject<{
|
|
|
10722
10722
|
}>;
|
|
10723
10723
|
tags: z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">;
|
|
10724
10724
|
logo: z.ZodOptional<z.ZodString>;
|
|
10725
|
-
|
|
10725
|
+
coverPhoto: z.ZodNullable<z.ZodString>;
|
|
10726
10726
|
photosWithTags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10727
10727
|
url: z.ZodString;
|
|
10728
10728
|
tag: z.ZodString;
|
|
@@ -10810,7 +10810,7 @@ declare const clinicBranchSetupSchema: z.ZodObject<{
|
|
|
10810
10810
|
}[] | undefined;
|
|
10811
10811
|
} | null;
|
|
10812
10812
|
};
|
|
10813
|
-
|
|
10813
|
+
coverPhoto: string | null;
|
|
10814
10814
|
description?: string | undefined;
|
|
10815
10815
|
logo?: string | undefined;
|
|
10816
10816
|
photosWithTags?: {
|
|
@@ -10894,7 +10894,7 @@ declare const clinicBranchSetupSchema: z.ZodObject<{
|
|
|
10894
10894
|
}[] | undefined;
|
|
10895
10895
|
} | null;
|
|
10896
10896
|
};
|
|
10897
|
-
|
|
10897
|
+
coverPhoto: string | null;
|
|
10898
10898
|
description?: string | undefined;
|
|
10899
10899
|
logo?: string | undefined;
|
|
10900
10900
|
photosWithTags?: {
|
|
@@ -11466,7 +11466,7 @@ declare const updateClinicSchema: z.ZodObject<{
|
|
|
11466
11466
|
} | null;
|
|
11467
11467
|
}>>;
|
|
11468
11468
|
tags: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof ClinicTag>, "many">>;
|
|
11469
|
-
|
|
11469
|
+
coverPhoto: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11470
11470
|
photosWithTags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11471
11471
|
url: z.ZodString;
|
|
11472
11472
|
tag: z.ZodString;
|
|
@@ -11566,7 +11566,7 @@ declare const updateClinicSchema: z.ZodObject<{
|
|
|
11566
11566
|
}[] | undefined;
|
|
11567
11567
|
} | null;
|
|
11568
11568
|
} | undefined;
|
|
11569
|
-
|
|
11569
|
+
coverPhoto?: string | null | undefined;
|
|
11570
11570
|
photosWithTags?: {
|
|
11571
11571
|
url: string;
|
|
11572
11572
|
tag: string;
|
|
@@ -11656,7 +11656,7 @@ declare const updateClinicSchema: z.ZodObject<{
|
|
|
11656
11656
|
}[] | undefined;
|
|
11657
11657
|
} | null;
|
|
11658
11658
|
} | undefined;
|
|
11659
|
-
|
|
11659
|
+
coverPhoto?: string | null | undefined;
|
|
11660
11660
|
photosWithTags?: {
|
|
11661
11661
|
url: string;
|
|
11662
11662
|
tag: string;
|
package/dist/index.js
CHANGED
|
@@ -2507,7 +2507,7 @@ var clinicSchema = import_zod9.z.object({
|
|
|
2507
2507
|
workingHours: workingHoursSchema,
|
|
2508
2508
|
tags: import_zod9.z.array(import_zod9.z.nativeEnum(ClinicTag)),
|
|
2509
2509
|
featuredPhotos: import_zod9.z.array(import_zod9.z.string()),
|
|
2510
|
-
|
|
2510
|
+
coverPhoto: import_zod9.z.string().nullable(),
|
|
2511
2511
|
photosWithTags: import_zod9.z.array(
|
|
2512
2512
|
import_zod9.z.object({
|
|
2513
2513
|
url: import_zod9.z.string(),
|
|
@@ -2566,7 +2566,7 @@ var createClinicSchema = import_zod9.z.object({
|
|
|
2566
2566
|
contactInfo: clinicContactInfoSchema,
|
|
2567
2567
|
workingHours: workingHoursSchema,
|
|
2568
2568
|
tags: import_zod9.z.array(import_zod9.z.nativeEnum(ClinicTag)),
|
|
2569
|
-
|
|
2569
|
+
coverPhoto: import_zod9.z.string().nullable(),
|
|
2570
2570
|
photosWithTags: import_zod9.z.array(
|
|
2571
2571
|
import_zod9.z.object({
|
|
2572
2572
|
url: import_zod9.z.string(),
|
|
@@ -2627,7 +2627,7 @@ var clinicBranchSetupSchema = import_zod9.z.object({
|
|
|
2627
2627
|
workingHours: workingHoursSchema,
|
|
2628
2628
|
tags: import_zod9.z.array(import_zod9.z.nativeEnum(ClinicTag)),
|
|
2629
2629
|
logo: import_zod9.z.string().optional(),
|
|
2630
|
-
|
|
2630
|
+
coverPhoto: import_zod9.z.string().nullable(),
|
|
2631
2631
|
photosWithTags: import_zod9.z.array(
|
|
2632
2632
|
import_zod9.z.object({
|
|
2633
2633
|
url: import_zod9.z.string(),
|
|
@@ -4423,25 +4423,23 @@ async function createClinic(db, data, creatorAdminId, clinicGroupService, clinic
|
|
|
4423
4423
|
console.error("[CLINIC] Error processing logo:", logoError);
|
|
4424
4424
|
}
|
|
4425
4425
|
}
|
|
4426
|
-
let
|
|
4427
|
-
if (validatedData.
|
|
4428
|
-
console.log("[CLINIC] Processing
|
|
4426
|
+
let processedCoverPhoto = null;
|
|
4427
|
+
if (validatedData.coverPhoto) {
|
|
4428
|
+
console.log("[CLINIC] Processing cover photo");
|
|
4429
4429
|
try {
|
|
4430
|
-
|
|
4431
|
-
validatedData.
|
|
4430
|
+
processedCoverPhoto = await uploadPhoto(
|
|
4431
|
+
validatedData.coverPhoto,
|
|
4432
4432
|
"clinics",
|
|
4433
4433
|
clinicId,
|
|
4434
|
-
"
|
|
4434
|
+
"cover",
|
|
4435
4435
|
app
|
|
4436
4436
|
);
|
|
4437
|
-
console.log("[CLINIC]
|
|
4438
|
-
|
|
4437
|
+
console.log("[CLINIC] Cover photo processed", {
|
|
4438
|
+
coverPhoto: processedCoverPhoto
|
|
4439
4439
|
});
|
|
4440
|
-
} catch (
|
|
4441
|
-
console.error("[CLINIC] Error processing
|
|
4442
|
-
|
|
4443
|
-
(photo) => !photo.startsWith("data:")
|
|
4444
|
-
);
|
|
4440
|
+
} catch (coverPhotoError) {
|
|
4441
|
+
console.error("[CLINIC] Error processing cover photo:", coverPhotoError);
|
|
4442
|
+
processedCoverPhoto = validatedData.coverPhoto.startsWith("data:") ? null : validatedData.coverPhoto;
|
|
4445
4443
|
}
|
|
4446
4444
|
}
|
|
4447
4445
|
let processedFeaturedPhotos = [];
|
|
@@ -4527,7 +4525,7 @@ async function createClinic(db, data, creatorAdminId, clinicGroupService, clinic
|
|
|
4527
4525
|
logo: logoUrl || "",
|
|
4528
4526
|
tags: validatedData.tags || [],
|
|
4529
4527
|
featuredPhotos: processedFeaturedPhotos || [],
|
|
4530
|
-
|
|
4528
|
+
coverPhoto: processedCoverPhoto,
|
|
4531
4529
|
photosWithTags: processedPhotosWithTags,
|
|
4532
4530
|
doctors: [],
|
|
4533
4531
|
doctorsInfo: [],
|
|
@@ -4682,36 +4680,32 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
4682
4680
|
console.error("[CLINIC] Error processing logo update:", logoError);
|
|
4683
4681
|
}
|
|
4684
4682
|
}
|
|
4685
|
-
if (data.
|
|
4686
|
-
console.log("[CLINIC] Processing
|
|
4683
|
+
if (data.coverPhoto) {
|
|
4684
|
+
console.log("[CLINIC] Processing cover photo update");
|
|
4687
4685
|
try {
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
const existingPhotos = data.photos.filter(
|
|
4692
|
-
(photo) => typeof photo === "string" && !photo.startsWith("data:")
|
|
4693
|
-
);
|
|
4694
|
-
if (dataUrlPhotos.length > 0) {
|
|
4695
|
-
const uploadedPhotos = await uploadMultiplePhotos(
|
|
4696
|
-
dataUrlPhotos,
|
|
4686
|
+
if (typeof data.coverPhoto === "string" && data.coverPhoto.startsWith("data:")) {
|
|
4687
|
+
const uploadedPhoto = await uploadPhoto(
|
|
4688
|
+
data.coverPhoto,
|
|
4697
4689
|
"clinics",
|
|
4698
4690
|
clinicId,
|
|
4699
|
-
"
|
|
4691
|
+
"cover",
|
|
4700
4692
|
app
|
|
4701
4693
|
);
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
}
|
|
4705
|
-
|
|
4694
|
+
if (uploadedPhoto) {
|
|
4695
|
+
updatedData.coverPhoto = uploadedPhoto;
|
|
4696
|
+
}
|
|
4697
|
+
} else {
|
|
4698
|
+
updatedData.coverPhoto = data.coverPhoto;
|
|
4706
4699
|
}
|
|
4707
|
-
|
|
4700
|
+
console.log("[CLINIC] Cover photo update processed");
|
|
4701
|
+
} catch (photoError) {
|
|
4708
4702
|
console.error(
|
|
4709
|
-
"[CLINIC] Error processing
|
|
4710
|
-
|
|
4711
|
-
);
|
|
4712
|
-
updatedData.photos = data.photos.filter(
|
|
4713
|
-
(photo) => typeof photo === "string" && !photo.startsWith("data:")
|
|
4703
|
+
"[CLINIC] Error processing cover photo update:",
|
|
4704
|
+
photoError
|
|
4714
4705
|
);
|
|
4706
|
+
if (typeof data.coverPhoto === "string" && !data.coverPhoto.startsWith("data:")) {
|
|
4707
|
+
updatedData.coverPhoto = data.coverPhoto;
|
|
4708
|
+
}
|
|
4715
4709
|
}
|
|
4716
4710
|
}
|
|
4717
4711
|
if (data.featuredPhotos && data.featuredPhotos.length > 0) {
|
|
@@ -4735,6 +4729,8 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
4735
4729
|
count: uploadedPhotos.length
|
|
4736
4730
|
});
|
|
4737
4731
|
updatedData.featuredPhotos = [...existingPhotos, ...uploadedPhotos];
|
|
4732
|
+
} else {
|
|
4733
|
+
updatedData.featuredPhotos = existingPhotos;
|
|
4738
4734
|
}
|
|
4739
4735
|
} catch (featuredError) {
|
|
4740
4736
|
console.error(
|
|
@@ -5163,7 +5159,7 @@ var ClinicService = class extends BaseService {
|
|
|
5163
5159
|
contactInfo: setupData.contactInfo,
|
|
5164
5160
|
workingHours: setupData.workingHours,
|
|
5165
5161
|
tags: setupData.tags,
|
|
5166
|
-
|
|
5162
|
+
coverPhoto: setupData.coverPhoto || null,
|
|
5167
5163
|
photosWithTags: setupData.photosWithTags || [],
|
|
5168
5164
|
doctors: [],
|
|
5169
5165
|
services: [],
|
|
@@ -5176,7 +5172,7 @@ var ClinicService = class extends BaseService {
|
|
|
5176
5172
|
console.log("[CLINIC_SERVICE] Creating clinic branch with data", {
|
|
5177
5173
|
name: createClinicData.name,
|
|
5178
5174
|
hasLogo: !!createClinicData.logo,
|
|
5179
|
-
|
|
5175
|
+
hasCoverPhoto: !!createClinicData.coverPhoto,
|
|
5180
5176
|
featuredPhotosCount: ((_a = createClinicData.featuredPhotos) == null ? void 0 : _a.length) || 0,
|
|
5181
5177
|
photosWithTagsCount: ((_b = createClinicData.photosWithTags) == null ? void 0 : _b.length) || 0
|
|
5182
5178
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -2434,7 +2434,7 @@ var clinicSchema = z9.object({
|
|
|
2434
2434
|
workingHours: workingHoursSchema,
|
|
2435
2435
|
tags: z9.array(z9.nativeEnum(ClinicTag)),
|
|
2436
2436
|
featuredPhotos: z9.array(z9.string()),
|
|
2437
|
-
|
|
2437
|
+
coverPhoto: z9.string().nullable(),
|
|
2438
2438
|
photosWithTags: z9.array(
|
|
2439
2439
|
z9.object({
|
|
2440
2440
|
url: z9.string(),
|
|
@@ -2493,7 +2493,7 @@ var createClinicSchema = z9.object({
|
|
|
2493
2493
|
contactInfo: clinicContactInfoSchema,
|
|
2494
2494
|
workingHours: workingHoursSchema,
|
|
2495
2495
|
tags: z9.array(z9.nativeEnum(ClinicTag)),
|
|
2496
|
-
|
|
2496
|
+
coverPhoto: z9.string().nullable(),
|
|
2497
2497
|
photosWithTags: z9.array(
|
|
2498
2498
|
z9.object({
|
|
2499
2499
|
url: z9.string(),
|
|
@@ -2554,7 +2554,7 @@ var clinicBranchSetupSchema = z9.object({
|
|
|
2554
2554
|
workingHours: workingHoursSchema,
|
|
2555
2555
|
tags: z9.array(z9.nativeEnum(ClinicTag)),
|
|
2556
2556
|
logo: z9.string().optional(),
|
|
2557
|
-
|
|
2557
|
+
coverPhoto: z9.string().nullable(),
|
|
2558
2558
|
photosWithTags: z9.array(
|
|
2559
2559
|
z9.object({
|
|
2560
2560
|
url: z9.string(),
|
|
@@ -4388,25 +4388,23 @@ async function createClinic(db, data, creatorAdminId, clinicGroupService, clinic
|
|
|
4388
4388
|
console.error("[CLINIC] Error processing logo:", logoError);
|
|
4389
4389
|
}
|
|
4390
4390
|
}
|
|
4391
|
-
let
|
|
4392
|
-
if (validatedData.
|
|
4393
|
-
console.log("[CLINIC] Processing
|
|
4391
|
+
let processedCoverPhoto = null;
|
|
4392
|
+
if (validatedData.coverPhoto) {
|
|
4393
|
+
console.log("[CLINIC] Processing cover photo");
|
|
4394
4394
|
try {
|
|
4395
|
-
|
|
4396
|
-
validatedData.
|
|
4395
|
+
processedCoverPhoto = await uploadPhoto(
|
|
4396
|
+
validatedData.coverPhoto,
|
|
4397
4397
|
"clinics",
|
|
4398
4398
|
clinicId,
|
|
4399
|
-
"
|
|
4399
|
+
"cover",
|
|
4400
4400
|
app
|
|
4401
4401
|
);
|
|
4402
|
-
console.log("[CLINIC]
|
|
4403
|
-
|
|
4402
|
+
console.log("[CLINIC] Cover photo processed", {
|
|
4403
|
+
coverPhoto: processedCoverPhoto
|
|
4404
4404
|
});
|
|
4405
|
-
} catch (
|
|
4406
|
-
console.error("[CLINIC] Error processing
|
|
4407
|
-
|
|
4408
|
-
(photo) => !photo.startsWith("data:")
|
|
4409
|
-
);
|
|
4405
|
+
} catch (coverPhotoError) {
|
|
4406
|
+
console.error("[CLINIC] Error processing cover photo:", coverPhotoError);
|
|
4407
|
+
processedCoverPhoto = validatedData.coverPhoto.startsWith("data:") ? null : validatedData.coverPhoto;
|
|
4410
4408
|
}
|
|
4411
4409
|
}
|
|
4412
4410
|
let processedFeaturedPhotos = [];
|
|
@@ -4492,7 +4490,7 @@ async function createClinic(db, data, creatorAdminId, clinicGroupService, clinic
|
|
|
4492
4490
|
logo: logoUrl || "",
|
|
4493
4491
|
tags: validatedData.tags || [],
|
|
4494
4492
|
featuredPhotos: processedFeaturedPhotos || [],
|
|
4495
|
-
|
|
4493
|
+
coverPhoto: processedCoverPhoto,
|
|
4496
4494
|
photosWithTags: processedPhotosWithTags,
|
|
4497
4495
|
doctors: [],
|
|
4498
4496
|
doctorsInfo: [],
|
|
@@ -4647,36 +4645,32 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
4647
4645
|
console.error("[CLINIC] Error processing logo update:", logoError);
|
|
4648
4646
|
}
|
|
4649
4647
|
}
|
|
4650
|
-
if (data.
|
|
4651
|
-
console.log("[CLINIC] Processing
|
|
4648
|
+
if (data.coverPhoto) {
|
|
4649
|
+
console.log("[CLINIC] Processing cover photo update");
|
|
4652
4650
|
try {
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
const existingPhotos = data.photos.filter(
|
|
4657
|
-
(photo) => typeof photo === "string" && !photo.startsWith("data:")
|
|
4658
|
-
);
|
|
4659
|
-
if (dataUrlPhotos.length > 0) {
|
|
4660
|
-
const uploadedPhotos = await uploadMultiplePhotos(
|
|
4661
|
-
dataUrlPhotos,
|
|
4651
|
+
if (typeof data.coverPhoto === "string" && data.coverPhoto.startsWith("data:")) {
|
|
4652
|
+
const uploadedPhoto = await uploadPhoto(
|
|
4653
|
+
data.coverPhoto,
|
|
4662
4654
|
"clinics",
|
|
4663
4655
|
clinicId,
|
|
4664
|
-
"
|
|
4656
|
+
"cover",
|
|
4665
4657
|
app
|
|
4666
4658
|
);
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
}
|
|
4670
|
-
|
|
4659
|
+
if (uploadedPhoto) {
|
|
4660
|
+
updatedData.coverPhoto = uploadedPhoto;
|
|
4661
|
+
}
|
|
4662
|
+
} else {
|
|
4663
|
+
updatedData.coverPhoto = data.coverPhoto;
|
|
4671
4664
|
}
|
|
4672
|
-
|
|
4665
|
+
console.log("[CLINIC] Cover photo update processed");
|
|
4666
|
+
} catch (photoError) {
|
|
4673
4667
|
console.error(
|
|
4674
|
-
"[CLINIC] Error processing
|
|
4675
|
-
|
|
4676
|
-
);
|
|
4677
|
-
updatedData.photos = data.photos.filter(
|
|
4678
|
-
(photo) => typeof photo === "string" && !photo.startsWith("data:")
|
|
4668
|
+
"[CLINIC] Error processing cover photo update:",
|
|
4669
|
+
photoError
|
|
4679
4670
|
);
|
|
4671
|
+
if (typeof data.coverPhoto === "string" && !data.coverPhoto.startsWith("data:")) {
|
|
4672
|
+
updatedData.coverPhoto = data.coverPhoto;
|
|
4673
|
+
}
|
|
4680
4674
|
}
|
|
4681
4675
|
}
|
|
4682
4676
|
if (data.featuredPhotos && data.featuredPhotos.length > 0) {
|
|
@@ -4700,6 +4694,8 @@ async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app
|
|
|
4700
4694
|
count: uploadedPhotos.length
|
|
4701
4695
|
});
|
|
4702
4696
|
updatedData.featuredPhotos = [...existingPhotos, ...uploadedPhotos];
|
|
4697
|
+
} else {
|
|
4698
|
+
updatedData.featuredPhotos = existingPhotos;
|
|
4703
4699
|
}
|
|
4704
4700
|
} catch (featuredError) {
|
|
4705
4701
|
console.error(
|
|
@@ -5139,7 +5135,7 @@ var ClinicService = class extends BaseService {
|
|
|
5139
5135
|
contactInfo: setupData.contactInfo,
|
|
5140
5136
|
workingHours: setupData.workingHours,
|
|
5141
5137
|
tags: setupData.tags,
|
|
5142
|
-
|
|
5138
|
+
coverPhoto: setupData.coverPhoto || null,
|
|
5143
5139
|
photosWithTags: setupData.photosWithTags || [],
|
|
5144
5140
|
doctors: [],
|
|
5145
5141
|
services: [],
|
|
@@ -5152,7 +5148,7 @@ var ClinicService = class extends BaseService {
|
|
|
5152
5148
|
console.log("[CLINIC_SERVICE] Creating clinic branch with data", {
|
|
5153
5149
|
name: createClinicData.name,
|
|
5154
5150
|
hasLogo: !!createClinicData.logo,
|
|
5155
|
-
|
|
5151
|
+
hasCoverPhoto: !!createClinicData.coverPhoto,
|
|
5156
5152
|
featuredPhotosCount: ((_a = createClinicData.featuredPhotos) == null ? void 0 : _a.length) || 0,
|
|
5157
5153
|
photosWithTagsCount: ((_b = createClinicData.photosWithTags) == null ? void 0 : _b.length) || 0
|
|
5158
5154
|
});
|
package/package.json
CHANGED
|
@@ -267,7 +267,7 @@ export class ClinicService extends BaseService {
|
|
|
267
267
|
contactInfo: setupData.contactInfo,
|
|
268
268
|
workingHours: setupData.workingHours,
|
|
269
269
|
tags: setupData.tags,
|
|
270
|
-
|
|
270
|
+
coverPhoto: setupData.coverPhoto || null,
|
|
271
271
|
photosWithTags: setupData.photosWithTags || [],
|
|
272
272
|
doctors: [],
|
|
273
273
|
services: [],
|
|
@@ -281,7 +281,7 @@ export class ClinicService extends BaseService {
|
|
|
281
281
|
console.log("[CLINIC_SERVICE] Creating clinic branch with data", {
|
|
282
282
|
name: createClinicData.name,
|
|
283
283
|
hasLogo: !!createClinicData.logo,
|
|
284
|
-
|
|
284
|
+
hasCoverPhoto: !!createClinicData.coverPhoto,
|
|
285
285
|
featuredPhotosCount: createClinicData.featuredPhotos?.length || 0,
|
|
286
286
|
photosWithTagsCount: createClinicData.photosWithTags?.length || 0,
|
|
287
287
|
});
|
|
@@ -153,27 +153,27 @@ export async function createClinic(
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
// Handle
|
|
157
|
-
let
|
|
158
|
-
if (validatedData.
|
|
159
|
-
console.log("[CLINIC] Processing
|
|
156
|
+
// Handle cover photo upload
|
|
157
|
+
let processedCoverPhoto: string | null = null;
|
|
158
|
+
if (validatedData.coverPhoto) {
|
|
159
|
+
console.log("[CLINIC] Processing cover photo");
|
|
160
160
|
try {
|
|
161
|
-
|
|
162
|
-
validatedData.
|
|
161
|
+
processedCoverPhoto = await uploadPhoto(
|
|
162
|
+
validatedData.coverPhoto,
|
|
163
163
|
"clinics",
|
|
164
164
|
clinicId,
|
|
165
|
-
"
|
|
165
|
+
"cover",
|
|
166
166
|
app
|
|
167
167
|
);
|
|
168
|
-
console.log("[CLINIC]
|
|
169
|
-
|
|
168
|
+
console.log("[CLINIC] Cover photo processed", {
|
|
169
|
+
coverPhoto: processedCoverPhoto,
|
|
170
170
|
});
|
|
171
|
-
} catch (
|
|
172
|
-
console.error("[CLINIC] Error processing
|
|
173
|
-
// Continue with clinic creation even if
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
} catch (coverPhotoError) {
|
|
172
|
+
console.error("[CLINIC] Error processing cover photo:", coverPhotoError);
|
|
173
|
+
// Continue with clinic creation even if cover photo upload fails
|
|
174
|
+
processedCoverPhoto = validatedData.coverPhoto.startsWith("data:")
|
|
175
|
+
? null
|
|
176
|
+
: validatedData.coverPhoto;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -269,7 +269,7 @@ export async function createClinic(
|
|
|
269
269
|
logo: logoUrl || "",
|
|
270
270
|
tags: validatedData.tags || [],
|
|
271
271
|
featuredPhotos: processedFeaturedPhotos || [],
|
|
272
|
-
|
|
272
|
+
coverPhoto: processedCoverPhoto,
|
|
273
273
|
photosWithTags: processedPhotosWithTags,
|
|
274
274
|
doctors: [],
|
|
275
275
|
doctorsInfo: [],
|
|
@@ -443,9 +443,8 @@ export async function updateClinic(
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
// Check if admin is either:
|
|
446
|
-
// 1. The owner of the clinic group, OR
|
|
447
|
-
// 2. Has this clinic in their managed clinics list
|
|
448
|
-
// 3. Is listed in the clinic's admins array
|
|
446
|
+
// 1. The owner of the clinic group that this clinic belongs to, OR
|
|
447
|
+
// 2. Has this clinic in their managed clinics list AND is listed in the clinic's admins array
|
|
449
448
|
const hasPermission =
|
|
450
449
|
(admin.isGroupOwner && admin.clinicGroupId === clinic.clinicGroupId) ||
|
|
451
450
|
(admin.clinicsManaged.includes(clinicId) &&
|
|
@@ -500,42 +499,42 @@ export async function updateClinic(
|
|
|
500
499
|
}
|
|
501
500
|
}
|
|
502
501
|
|
|
503
|
-
// Handle
|
|
504
|
-
if (data.
|
|
505
|
-
console.log("[CLINIC] Processing
|
|
502
|
+
// Handle cover photo update if provided
|
|
503
|
+
if (data.coverPhoto) {
|
|
504
|
+
console.log("[CLINIC] Processing cover photo update");
|
|
506
505
|
try {
|
|
507
|
-
//
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
if (dataUrlPhotos.length > 0) {
|
|
516
|
-
const uploadedPhotos = await uploadMultiplePhotos(
|
|
517
|
-
dataUrlPhotos,
|
|
506
|
+
// Check if it's a data URL that needs to be uploaded
|
|
507
|
+
if (
|
|
508
|
+
typeof data.coverPhoto === "string" &&
|
|
509
|
+
data.coverPhoto.startsWith("data:")
|
|
510
|
+
) {
|
|
511
|
+
const uploadedPhoto = await uploadPhoto(
|
|
512
|
+
data.coverPhoto,
|
|
518
513
|
"clinics",
|
|
519
514
|
clinicId,
|
|
520
|
-
"
|
|
515
|
+
"cover",
|
|
521
516
|
app
|
|
522
517
|
);
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
//
|
|
528
|
-
updatedData.
|
|
518
|
+
if (uploadedPhoto) {
|
|
519
|
+
updatedData.coverPhoto = uploadedPhoto;
|
|
520
|
+
}
|
|
521
|
+
} else {
|
|
522
|
+
// Keep existing photo URL
|
|
523
|
+
updatedData.coverPhoto = data.coverPhoto;
|
|
529
524
|
}
|
|
530
|
-
|
|
525
|
+
console.log("[CLINIC] Cover photo update processed");
|
|
526
|
+
} catch (photoError) {
|
|
531
527
|
console.error(
|
|
532
|
-
"[CLINIC] Error processing
|
|
533
|
-
|
|
534
|
-
);
|
|
535
|
-
// Continue with update even if photos upload fails
|
|
536
|
-
updatedData.photos = data.photos.filter(
|
|
537
|
-
(photo) => typeof photo === "string" && !photo.startsWith("data:")
|
|
528
|
+
"[CLINIC] Error processing cover photo update:",
|
|
529
|
+
photoError
|
|
538
530
|
);
|
|
531
|
+
// Keep existing photo if upload fails
|
|
532
|
+
if (
|
|
533
|
+
typeof data.coverPhoto === "string" &&
|
|
534
|
+
!data.coverPhoto.startsWith("data:")
|
|
535
|
+
) {
|
|
536
|
+
updatedData.coverPhoto = data.coverPhoto;
|
|
537
|
+
}
|
|
539
538
|
}
|
|
540
539
|
}
|
|
541
540
|
|
|
@@ -565,6 +564,9 @@ export async function updateClinic(
|
|
|
565
564
|
|
|
566
565
|
// Combine existing photos with newly uploaded ones
|
|
567
566
|
updatedData.featuredPhotos = [...existingPhotos, ...uploadedPhotos];
|
|
567
|
+
} else {
|
|
568
|
+
// If no new photos to upload, just use the existing ones
|
|
569
|
+
updatedData.featuredPhotos = existingPhotos;
|
|
568
570
|
}
|
|
569
571
|
} catch (featuredError) {
|
|
570
572
|
console.error(
|
|
@@ -308,7 +308,7 @@ export interface Clinic {
|
|
|
308
308
|
workingHours: WorkingHours;
|
|
309
309
|
tags: ClinicTag[];
|
|
310
310
|
featuredPhotos: string[];
|
|
311
|
-
|
|
311
|
+
coverPhoto: string | null;
|
|
312
312
|
photosWithTags?: { url: string; tag: string }[];
|
|
313
313
|
doctors: string[];
|
|
314
314
|
doctorsInfo: DoctorInfo[];
|
|
@@ -339,7 +339,7 @@ export interface CreateClinicData {
|
|
|
339
339
|
contactInfo: ClinicContactInfo;
|
|
340
340
|
workingHours: WorkingHours;
|
|
341
341
|
tags: ClinicTag[];
|
|
342
|
-
|
|
342
|
+
coverPhoto: string | null;
|
|
343
343
|
photosWithTags?: { url: string; tag: string }[];
|
|
344
344
|
doctors: string[];
|
|
345
345
|
services: string[];
|
|
@@ -418,7 +418,7 @@ export interface ClinicBranchSetupData {
|
|
|
418
418
|
workingHours: WorkingHours;
|
|
419
419
|
tags: ClinicTag[];
|
|
420
420
|
logo?: string;
|
|
421
|
-
|
|
421
|
+
coverPhoto: string | null;
|
|
422
422
|
photosWithTags?: { url: string; tag: string }[];
|
|
423
423
|
featuredPhotos?: string[];
|
|
424
424
|
}
|
|
@@ -240,7 +240,7 @@ export const clinicSchema = z.object({
|
|
|
240
240
|
workingHours: workingHoursSchema,
|
|
241
241
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
242
242
|
featuredPhotos: z.array(z.string()),
|
|
243
|
-
|
|
243
|
+
coverPhoto: z.string().nullable(),
|
|
244
244
|
photosWithTags: z
|
|
245
245
|
.array(
|
|
246
246
|
z.object({
|
|
@@ -316,7 +316,7 @@ export const createClinicSchema = z.object({
|
|
|
316
316
|
contactInfo: clinicContactInfoSchema,
|
|
317
317
|
workingHours: workingHoursSchema,
|
|
318
318
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
319
|
-
|
|
319
|
+
coverPhoto: z.string().nullable(),
|
|
320
320
|
photosWithTags: z
|
|
321
321
|
.array(
|
|
322
322
|
z.object({
|
|
@@ -403,7 +403,7 @@ export const clinicBranchSetupSchema = z.object({
|
|
|
403
403
|
workingHours: workingHoursSchema,
|
|
404
404
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
405
405
|
logo: z.string().optional(),
|
|
406
|
-
|
|
406
|
+
coverPhoto: z.string().nullable(),
|
|
407
407
|
photosWithTags: z
|
|
408
408
|
.array(
|
|
409
409
|
z.object({
|