@blackcode_sa/metaestetics-api 1.6.1 → 1.6.3
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 +34 -184
- package/dist/index.d.ts +34 -184
- package/dist/index.js +493 -412
- package/dist/index.mjs +476 -392
- package/package.json +1 -1
- package/src/services/patient/patient.service.ts +31 -1
- package/src/services/patient/utils/practitioner.utils.ts +79 -1
- package/src/services/practitioner/practitioner.service.ts +6 -1
- package/src/types/patient/index.ts +6 -0
- package/src/validations/clinic.schema.ts +5 -25
- package/src/validations/practitioner.schema.ts +3 -3
- package/src/validations/procedure.schema.ts +1 -1
- package/src/validations/shared.schema.ts +78 -0
package/dist/index.mjs
CHANGED
|
@@ -255,7 +255,7 @@ var UserRole = /* @__PURE__ */ ((UserRole2) => {
|
|
|
255
255
|
var USERS_COLLECTION = "users";
|
|
256
256
|
|
|
257
257
|
// src/services/auth.service.ts
|
|
258
|
-
import { z as
|
|
258
|
+
import { z as z19 } from "zod";
|
|
259
259
|
|
|
260
260
|
// src/validations/schemas.ts
|
|
261
261
|
import { z as z3 } from "zod";
|
|
@@ -792,7 +792,7 @@ var USER_ERRORS = {
|
|
|
792
792
|
};
|
|
793
793
|
|
|
794
794
|
// src/services/user.service.ts
|
|
795
|
-
import { z as
|
|
795
|
+
import { z as z15 } from "zod";
|
|
796
796
|
|
|
797
797
|
// src/services/patient/patient.service.ts
|
|
798
798
|
import {
|
|
@@ -2160,6 +2160,51 @@ var getPatientsByPractitionerUtil = async (db, practitionerId, options) => {
|
|
|
2160
2160
|
);
|
|
2161
2161
|
}
|
|
2162
2162
|
};
|
|
2163
|
+
var getPatientsByPractitionerWithDetailsUtil = async (db, practitionerId, options) => {
|
|
2164
|
+
try {
|
|
2165
|
+
console.log(
|
|
2166
|
+
`[getPatientsByPractitionerWithDetailsUtil] Fetching detailed patient profiles for practitioner ID: ${practitionerId} with options:`,
|
|
2167
|
+
options
|
|
2168
|
+
);
|
|
2169
|
+
const patientProfiles = await getPatientsByPractitionerUtil(
|
|
2170
|
+
db,
|
|
2171
|
+
practitionerId,
|
|
2172
|
+
options
|
|
2173
|
+
);
|
|
2174
|
+
const patientProfilesWithDetails = await Promise.all(
|
|
2175
|
+
patientProfiles.map(async (profile) => {
|
|
2176
|
+
try {
|
|
2177
|
+
const sensitiveInfoDoc = await getDoc7(
|
|
2178
|
+
getSensitiveInfoDocRef(db, profile.id)
|
|
2179
|
+
);
|
|
2180
|
+
const sensitiveInfo = sensitiveInfoDoc.exists() ? sensitiveInfoDoc.data() : void 0;
|
|
2181
|
+
return {
|
|
2182
|
+
patientProfile: profile,
|
|
2183
|
+
patientSensitiveInfo: sensitiveInfo
|
|
2184
|
+
};
|
|
2185
|
+
} catch (error) {
|
|
2186
|
+
console.error(
|
|
2187
|
+
`[getPatientsByPractitionerWithDetailsUtil] Error fetching sensitive info for patient ${profile.id}:`,
|
|
2188
|
+
error
|
|
2189
|
+
);
|
|
2190
|
+
return { patientProfile: profile };
|
|
2191
|
+
}
|
|
2192
|
+
})
|
|
2193
|
+
);
|
|
2194
|
+
console.log(
|
|
2195
|
+
`[getPatientsByPractitionerWithDetailsUtil] Found ${patientProfilesWithDetails.length} detailed patient profiles for practitioner ID: ${practitionerId}`
|
|
2196
|
+
);
|
|
2197
|
+
return patientProfilesWithDetails;
|
|
2198
|
+
} catch (error) {
|
|
2199
|
+
console.error(
|
|
2200
|
+
`[getPatientsByPractitionerWithDetailsUtil] Error fetching detailed patient profiles:`,
|
|
2201
|
+
error
|
|
2202
|
+
);
|
|
2203
|
+
throw new Error(
|
|
2204
|
+
`Failed to retrieve detailed patient profiles: ${error instanceof Error ? error.message : String(error)}`
|
|
2205
|
+
);
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2163
2208
|
|
|
2164
2209
|
// src/services/patient/utils/clinic.utils.ts
|
|
2165
2210
|
import {
|
|
@@ -2497,6 +2542,25 @@ var PatientService = class extends BaseService {
|
|
|
2497
2542
|
);
|
|
2498
2543
|
return getPatientsByPractitionerUtil(this.db, practitionerId, options);
|
|
2499
2544
|
}
|
|
2545
|
+
/**
|
|
2546
|
+
* Gets all patients associated with a specific practitioner with their sensitive information.
|
|
2547
|
+
*
|
|
2548
|
+
* @param {string} practitionerId - ID of the practitioner whose patients to retrieve
|
|
2549
|
+
* @param {Object} options - Optional parameters for pagination
|
|
2550
|
+
* @param {number} options.limit - Maximum number of profiles to return
|
|
2551
|
+
* @param {string} options.startAfter - The ID of the document to start after (for pagination)
|
|
2552
|
+
* @returns {Promise<PatientProfileForDoctor[]>} A promise resolving to an array of patient profiles with sensitive info
|
|
2553
|
+
*/
|
|
2554
|
+
async getPatientsByPractitionerWithDetails(practitionerId, options) {
|
|
2555
|
+
console.log(
|
|
2556
|
+
`[PatientService.getPatientsByPractitionerWithDetails] Fetching detailed patient profiles for practitioner: ${practitionerId}`
|
|
2557
|
+
);
|
|
2558
|
+
return getPatientsByPractitionerWithDetailsUtil(
|
|
2559
|
+
this.db,
|
|
2560
|
+
practitionerId,
|
|
2561
|
+
options
|
|
2562
|
+
);
|
|
2563
|
+
}
|
|
2500
2564
|
/**
|
|
2501
2565
|
* Gets all patients associated with a specific clinic.
|
|
2502
2566
|
*
|
|
@@ -2525,7 +2589,7 @@ import {
|
|
|
2525
2589
|
updateDoc as updateDoc7,
|
|
2526
2590
|
setDoc as setDoc6,
|
|
2527
2591
|
deleteDoc,
|
|
2528
|
-
Timestamp as
|
|
2592
|
+
Timestamp as Timestamp6,
|
|
2529
2593
|
serverTimestamp as serverTimestamp8
|
|
2530
2594
|
} from "firebase/firestore";
|
|
2531
2595
|
|
|
@@ -2654,52 +2718,8 @@ var SubscriptionModel = /* @__PURE__ */ ((SubscriptionModel2) => {
|
|
|
2654
2718
|
|
|
2655
2719
|
// src/validations/clinic.schema.ts
|
|
2656
2720
|
import { z as z12 } from "zod";
|
|
2657
|
-
import { Timestamp as Timestamp6 } from "firebase/firestore";
|
|
2658
|
-
|
|
2659
|
-
// src/validations/practitioner.schema.ts
|
|
2660
|
-
import { z as z11 } from "zod";
|
|
2661
2721
|
import { Timestamp as Timestamp5 } from "firebase/firestore";
|
|
2662
2722
|
|
|
2663
|
-
// src/backoffice/types/static/certification.types.ts
|
|
2664
|
-
var CertificationLevel = /* @__PURE__ */ ((CertificationLevel2) => {
|
|
2665
|
-
CertificationLevel2["AESTHETICIAN"] = "aesthetician";
|
|
2666
|
-
CertificationLevel2["NURSE_ASSISTANT"] = "nurse_assistant";
|
|
2667
|
-
CertificationLevel2["NURSE"] = "nurse";
|
|
2668
|
-
CertificationLevel2["NURSE_PRACTITIONER"] = "nurse_practitioner";
|
|
2669
|
-
CertificationLevel2["PHYSICIAN_ASSISTANT"] = "physician_assistant";
|
|
2670
|
-
CertificationLevel2["DOCTOR"] = "doctor";
|
|
2671
|
-
CertificationLevel2["SPECIALIST"] = "specialist";
|
|
2672
|
-
CertificationLevel2["PLASTIC_SURGEON"] = "plastic_surgeon";
|
|
2673
|
-
return CertificationLevel2;
|
|
2674
|
-
})(CertificationLevel || {});
|
|
2675
|
-
var CertificationSpecialty = /* @__PURE__ */ ((CertificationSpecialty3) => {
|
|
2676
|
-
CertificationSpecialty3["LASER"] = "laser";
|
|
2677
|
-
CertificationSpecialty3["INJECTABLES"] = "injectables";
|
|
2678
|
-
CertificationSpecialty3["CHEMICAL_PEELS"] = "chemical_peels";
|
|
2679
|
-
CertificationSpecialty3["MICRODERMABRASION"] = "microdermabrasion";
|
|
2680
|
-
CertificationSpecialty3["BODY_CONTOURING"] = "body_contouring";
|
|
2681
|
-
CertificationSpecialty3["SKIN_CARE"] = "skin_care";
|
|
2682
|
-
CertificationSpecialty3["WOUND_CARE"] = "wound_care";
|
|
2683
|
-
CertificationSpecialty3["ANESTHESIA"] = "anesthesia";
|
|
2684
|
-
return CertificationSpecialty3;
|
|
2685
|
-
})(CertificationSpecialty || {});
|
|
2686
|
-
|
|
2687
|
-
// src/types/practitioner/index.ts
|
|
2688
|
-
var PRACTITIONERS_COLLECTION = "practitioners";
|
|
2689
|
-
var REGISTER_TOKENS_COLLECTION = "register_tokens";
|
|
2690
|
-
var PractitionerStatus = /* @__PURE__ */ ((PractitionerStatus2) => {
|
|
2691
|
-
PractitionerStatus2["DRAFT"] = "draft";
|
|
2692
|
-
PractitionerStatus2["ACTIVE"] = "active";
|
|
2693
|
-
return PractitionerStatus2;
|
|
2694
|
-
})(PractitionerStatus || {});
|
|
2695
|
-
var PractitionerTokenStatus = /* @__PURE__ */ ((PractitionerTokenStatus2) => {
|
|
2696
|
-
PractitionerTokenStatus2["ACTIVE"] = "active";
|
|
2697
|
-
PractitionerTokenStatus2["USED"] = "used";
|
|
2698
|
-
PractitionerTokenStatus2["EXPIRED"] = "expired";
|
|
2699
|
-
PractitionerTokenStatus2["REVOKED"] = "revoked";
|
|
2700
|
-
return PractitionerTokenStatus2;
|
|
2701
|
-
})(PractitionerTokenStatus || {});
|
|
2702
|
-
|
|
2703
2723
|
// src/validations/reviews.schema.ts
|
|
2704
2724
|
import { z as z10 } from "zod";
|
|
2705
2725
|
var baseReviewSchema = z10.object({
|
|
@@ -2833,6 +2853,9 @@ var createReviewSchema = z10.object({
|
|
|
2833
2853
|
}
|
|
2834
2854
|
);
|
|
2835
2855
|
|
|
2856
|
+
// src/validations/shared.schema.ts
|
|
2857
|
+
import { z as z11 } from "zod";
|
|
2858
|
+
|
|
2836
2859
|
// src/backoffice/types/static/procedure-family.types.ts
|
|
2837
2860
|
var ProcedureFamily = /* @__PURE__ */ ((ProcedureFamily2) => {
|
|
2838
2861
|
ProcedureFamily2["AESTHETICS"] = "aesthetics";
|
|
@@ -2859,59 +2882,21 @@ var Currency = /* @__PURE__ */ ((Currency2) => {
|
|
|
2859
2882
|
return Currency2;
|
|
2860
2883
|
})(Currency || {});
|
|
2861
2884
|
|
|
2862
|
-
// src/validations/
|
|
2863
|
-
var
|
|
2864
|
-
firstName: z11.string().min(2).max(50),
|
|
2865
|
-
lastName: z11.string().min(2).max(50),
|
|
2866
|
-
title: z11.string().min(2).max(100),
|
|
2885
|
+
// src/validations/shared.schema.ts
|
|
2886
|
+
var sharedClinicContactInfoSchema = z11.object({
|
|
2867
2887
|
email: z11.string().email(),
|
|
2868
|
-
phoneNumber: z11.string()
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
profileImageUrl: z11.string().url().optional(),
|
|
2872
|
-
bio: z11.string().max(1e3).optional(),
|
|
2873
|
-
languages: z11.array(z11.string()).min(1)
|
|
2874
|
-
});
|
|
2875
|
-
var practitionerCertificationSchema = z11.object({
|
|
2876
|
-
level: z11.nativeEnum(CertificationLevel),
|
|
2877
|
-
specialties: z11.array(z11.nativeEnum(CertificationSpecialty)),
|
|
2878
|
-
licenseNumber: z11.string().min(3).max(50),
|
|
2879
|
-
issuingAuthority: z11.string().min(2).max(100),
|
|
2880
|
-
issueDate: z11.instanceof(Timestamp5).or(z11.date()),
|
|
2881
|
-
expiryDate: z11.instanceof(Timestamp5).or(z11.date()).optional(),
|
|
2882
|
-
verificationStatus: z11.enum(["pending", "verified", "rejected"])
|
|
2883
|
-
});
|
|
2884
|
-
var timeSlotSchema = z11.object({
|
|
2885
|
-
start: z11.string().regex(/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format"),
|
|
2886
|
-
end: z11.string().regex(/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format")
|
|
2887
|
-
}).nullable();
|
|
2888
|
-
var practitionerWorkingHoursSchema = z11.object({
|
|
2889
|
-
practitionerId: z11.string().min(1),
|
|
2890
|
-
clinicId: z11.string().min(1),
|
|
2891
|
-
monday: timeSlotSchema,
|
|
2892
|
-
tuesday: timeSlotSchema,
|
|
2893
|
-
wednesday: timeSlotSchema,
|
|
2894
|
-
thursday: timeSlotSchema,
|
|
2895
|
-
friday: timeSlotSchema,
|
|
2896
|
-
saturday: timeSlotSchema,
|
|
2897
|
-
sunday: timeSlotSchema,
|
|
2898
|
-
createdAt: z11.instanceof(Timestamp5).or(z11.date()),
|
|
2899
|
-
updatedAt: z11.instanceof(Timestamp5).or(z11.date())
|
|
2888
|
+
phoneNumber: z11.string(),
|
|
2889
|
+
alternativePhoneNumber: z11.string().nullable().optional(),
|
|
2890
|
+
website: z11.string().nullable().optional()
|
|
2900
2891
|
});
|
|
2901
|
-
var
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
saturday: timeSlotSchema,
|
|
2910
|
-
sunday: timeSlotSchema
|
|
2911
|
-
}),
|
|
2912
|
-
isActive: z11.boolean(),
|
|
2913
|
-
createdAt: z11.instanceof(Timestamp5).or(z11.date()),
|
|
2914
|
-
updatedAt: z11.instanceof(Timestamp5).or(z11.date())
|
|
2892
|
+
var sharedClinicLocationSchema = z11.object({
|
|
2893
|
+
address: z11.string(),
|
|
2894
|
+
city: z11.string(),
|
|
2895
|
+
country: z11.string(),
|
|
2896
|
+
postalCode: z11.string(),
|
|
2897
|
+
latitude: z11.number().min(-90).max(90),
|
|
2898
|
+
longitude: z11.number().min(-180).max(180),
|
|
2899
|
+
geohash: z11.string().nullable().optional()
|
|
2915
2900
|
});
|
|
2916
2901
|
var procedureSummaryInfoSchema = z11.object({
|
|
2917
2902
|
id: z11.string().min(1),
|
|
@@ -2931,79 +2916,22 @@ var procedureSummaryInfoSchema = z11.object({
|
|
|
2931
2916
|
practitionerId: z11.string().min(1),
|
|
2932
2917
|
practitionerName: z11.string().min(1)
|
|
2933
2918
|
});
|
|
2934
|
-
var
|
|
2935
|
-
id: z11.string()
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
clinicsInfo: z11.array(clinicInfoSchema),
|
|
2942
|
-
procedures: z11.array(z11.string()),
|
|
2943
|
-
proceduresInfo: z11.array(procedureSummaryInfoSchema),
|
|
2944
|
-
reviewInfo: practitionerReviewInfoSchema,
|
|
2945
|
-
isActive: z11.boolean(),
|
|
2946
|
-
isVerified: z11.boolean(),
|
|
2947
|
-
status: z11.nativeEnum(PractitionerStatus),
|
|
2948
|
-
createdAt: z11.instanceof(Timestamp5).or(z11.date()),
|
|
2949
|
-
updatedAt: z11.instanceof(Timestamp5).or(z11.date())
|
|
2919
|
+
var clinicInfoSchema = z11.object({
|
|
2920
|
+
id: z11.string(),
|
|
2921
|
+
featuredPhoto: z11.string(),
|
|
2922
|
+
name: z11.string(),
|
|
2923
|
+
description: z11.string().nullable().optional(),
|
|
2924
|
+
location: sharedClinicLocationSchema,
|
|
2925
|
+
contactInfo: sharedClinicContactInfoSchema
|
|
2950
2926
|
});
|
|
2951
|
-
var
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
isActive: z11.boolean(),
|
|
2960
|
-
isVerified: z11.boolean(),
|
|
2961
|
-
status: z11.nativeEnum(PractitionerStatus).optional()
|
|
2962
|
-
});
|
|
2963
|
-
var createDraftPractitionerSchema = z11.object({
|
|
2964
|
-
basicInfo: practitionerBasicInfoSchema,
|
|
2965
|
-
certification: practitionerCertificationSchema,
|
|
2966
|
-
clinics: z11.array(z11.string()).optional(),
|
|
2967
|
-
clinicWorkingHours: z11.array(practitionerClinicWorkingHoursSchema).optional(),
|
|
2968
|
-
clinicsInfo: z11.array(clinicInfoSchema).optional(),
|
|
2969
|
-
proceduresInfo: z11.array(procedureSummaryInfoSchema).optional(),
|
|
2970
|
-
isActive: z11.boolean().optional().default(false),
|
|
2971
|
-
isVerified: z11.boolean().optional().default(false)
|
|
2972
|
-
});
|
|
2973
|
-
var practitionerTokenSchema = z11.object({
|
|
2974
|
-
id: z11.string().min(1),
|
|
2975
|
-
token: z11.string().min(6),
|
|
2976
|
-
practitionerId: z11.string().min(1),
|
|
2977
|
-
email: z11.string().email(),
|
|
2978
|
-
clinicId: z11.string().min(1),
|
|
2979
|
-
status: z11.nativeEnum(PractitionerTokenStatus),
|
|
2980
|
-
createdBy: z11.string().min(1),
|
|
2981
|
-
createdAt: z11.instanceof(Timestamp5).or(z11.date()),
|
|
2982
|
-
expiresAt: z11.instanceof(Timestamp5).or(z11.date()),
|
|
2983
|
-
usedBy: z11.string().optional(),
|
|
2984
|
-
usedAt: z11.instanceof(Timestamp5).or(z11.date()).optional()
|
|
2985
|
-
});
|
|
2986
|
-
var createPractitionerTokenSchema = z11.object({
|
|
2987
|
-
practitionerId: z11.string().min(1),
|
|
2988
|
-
email: z11.string().email(),
|
|
2989
|
-
clinicId: z11.string().min(1),
|
|
2990
|
-
expiresAt: z11.date().optional()
|
|
2991
|
-
});
|
|
2992
|
-
var practitionerSignupSchema = z11.object({
|
|
2993
|
-
email: z11.string().email(),
|
|
2994
|
-
password: z11.string().min(8),
|
|
2995
|
-
firstName: z11.string().min(2).max(50),
|
|
2996
|
-
lastName: z11.string().min(2).max(50),
|
|
2997
|
-
token: z11.string().optional(),
|
|
2998
|
-
profileData: z11.object({
|
|
2999
|
-
basicInfo: z11.object({
|
|
3000
|
-
phoneNumber: z11.string().optional(),
|
|
3001
|
-
profileImageUrl: z11.string().optional(),
|
|
3002
|
-
gender: z11.enum(["male", "female", "other"]).optional(),
|
|
3003
|
-
bio: z11.string().optional()
|
|
3004
|
-
}).optional(),
|
|
3005
|
-
certification: z11.any().optional()
|
|
3006
|
-
}).optional()
|
|
2927
|
+
var doctorInfoSchema = z11.object({
|
|
2928
|
+
id: z11.string(),
|
|
2929
|
+
name: z11.string(),
|
|
2930
|
+
description: z11.string().nullable().optional(),
|
|
2931
|
+
photo: z11.string(),
|
|
2932
|
+
rating: z11.number().min(0).max(5),
|
|
2933
|
+
services: z11.array(z11.string())
|
|
2934
|
+
// List of procedure IDs practitioner offers
|
|
3007
2935
|
});
|
|
3008
2936
|
|
|
3009
2937
|
// src/validations/clinic.schema.ts
|
|
@@ -3056,23 +2984,6 @@ var adminInfoSchema = z12.object({
|
|
|
3056
2984
|
name: z12.string(),
|
|
3057
2985
|
email: z12.string().email()
|
|
3058
2986
|
});
|
|
3059
|
-
var clinicInfoSchema = z12.object({
|
|
3060
|
-
id: z12.string(),
|
|
3061
|
-
featuredPhoto: z12.string(),
|
|
3062
|
-
name: z12.string(),
|
|
3063
|
-
description: z12.string().nullable().optional(),
|
|
3064
|
-
location: clinicLocationSchema,
|
|
3065
|
-
contactInfo: clinicContactInfoSchema
|
|
3066
|
-
});
|
|
3067
|
-
var doctorInfoSchema = z12.object({
|
|
3068
|
-
id: z12.string(),
|
|
3069
|
-
name: z12.string(),
|
|
3070
|
-
description: z12.string().nullable().optional(),
|
|
3071
|
-
photo: z12.string(),
|
|
3072
|
-
rating: z12.number().min(0).max(5),
|
|
3073
|
-
services: z12.array(z12.string())
|
|
3074
|
-
// List of procedure IDs practitioner offers
|
|
3075
|
-
});
|
|
3076
2987
|
var clinicAdminSchema = z12.object({
|
|
3077
2988
|
id: z12.string(),
|
|
3078
2989
|
userRef: z12.string(),
|
|
@@ -3082,8 +2993,8 @@ var clinicAdminSchema = z12.object({
|
|
|
3082
2993
|
clinicsManagedInfo: z12.array(clinicInfoSchema),
|
|
3083
2994
|
contactInfo: contactPersonSchema,
|
|
3084
2995
|
roleTitle: z12.string(),
|
|
3085
|
-
createdAt: z12.instanceof(Date).or(z12.instanceof(
|
|
3086
|
-
updatedAt: z12.instanceof(Date).or(z12.instanceof(
|
|
2996
|
+
createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5)),
|
|
2997
|
+
updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5)),
|
|
3087
2998
|
isActive: z12.boolean()
|
|
3088
2999
|
});
|
|
3089
3000
|
var adminTokenSchema = z12.object({
|
|
@@ -3092,9 +3003,9 @@ var adminTokenSchema = z12.object({
|
|
|
3092
3003
|
email: z12.string().email().optional().nullable(),
|
|
3093
3004
|
status: z12.nativeEnum(AdminTokenStatus),
|
|
3094
3005
|
usedByUserRef: z12.string().optional(),
|
|
3095
|
-
createdAt: z12.instanceof(Date).or(z12.instanceof(
|
|
3006
|
+
createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5)),
|
|
3096
3007
|
// Timestamp
|
|
3097
|
-
expiresAt: z12.instanceof(Date).or(z12.instanceof(
|
|
3008
|
+
expiresAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5))
|
|
3098
3009
|
// Timestamp
|
|
3099
3010
|
});
|
|
3100
3011
|
var createAdminTokenSchema = z12.object({
|
|
@@ -3114,9 +3025,9 @@ var clinicGroupSchema = z12.object({
|
|
|
3114
3025
|
adminsInfo: z12.array(adminInfoSchema),
|
|
3115
3026
|
adminTokens: z12.array(adminTokenSchema),
|
|
3116
3027
|
ownerId: z12.string().nullable(),
|
|
3117
|
-
createdAt: z12.instanceof(Date).or(z12.instanceof(
|
|
3028
|
+
createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5)),
|
|
3118
3029
|
// Timestamp
|
|
3119
|
-
updatedAt: z12.instanceof(Date).or(z12.instanceof(
|
|
3030
|
+
updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5)),
|
|
3120
3031
|
// Timestamp
|
|
3121
3032
|
isActive: z12.boolean(),
|
|
3122
3033
|
logo: z12.string().optional().nullable(),
|
|
@@ -3156,9 +3067,9 @@ var clinicSchema = z12.object({
|
|
|
3156
3067
|
// servicesInfo: z.array(serviceInfoSchema), // Deprecated, use proceduresInfo
|
|
3157
3068
|
reviewInfo: clinicReviewInfoSchema,
|
|
3158
3069
|
admins: z12.array(z12.string()),
|
|
3159
|
-
createdAt: z12.instanceof(Date).or(z12.instanceof(
|
|
3070
|
+
createdAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5)),
|
|
3160
3071
|
// Timestamp
|
|
3161
|
-
updatedAt: z12.instanceof(Date).or(z12.instanceof(
|
|
3072
|
+
updatedAt: z12.instanceof(Date).or(z12.instanceof(Timestamp5)),
|
|
3162
3073
|
// Timestamp
|
|
3163
3074
|
isActive: z12.boolean(),
|
|
3164
3075
|
isVerified: z12.boolean(),
|
|
@@ -3368,8 +3279,8 @@ async function createClinicAdmin(db, data, clinicGroupService) {
|
|
|
3368
3279
|
try {
|
|
3369
3280
|
clinicAdminSchema.parse({
|
|
3370
3281
|
...adminData,
|
|
3371
|
-
createdAt:
|
|
3372
|
-
updatedAt:
|
|
3282
|
+
createdAt: Timestamp6.now(),
|
|
3283
|
+
updatedAt: Timestamp6.now()
|
|
3373
3284
|
});
|
|
3374
3285
|
console.log("[CLINIC_ADMIN] Admin object validation passed");
|
|
3375
3286
|
} catch (schemaError) {
|
|
@@ -3738,7 +3649,182 @@ import {
|
|
|
3738
3649
|
arrayUnion as arrayUnion5,
|
|
3739
3650
|
arrayRemove as arrayRemove4
|
|
3740
3651
|
} from "firebase/firestore";
|
|
3652
|
+
|
|
3653
|
+
// src/types/practitioner/index.ts
|
|
3654
|
+
var PRACTITIONERS_COLLECTION = "practitioners";
|
|
3655
|
+
var REGISTER_TOKENS_COLLECTION = "register_tokens";
|
|
3656
|
+
var PractitionerStatus = /* @__PURE__ */ ((PractitionerStatus2) => {
|
|
3657
|
+
PractitionerStatus2["DRAFT"] = "draft";
|
|
3658
|
+
PractitionerStatus2["ACTIVE"] = "active";
|
|
3659
|
+
return PractitionerStatus2;
|
|
3660
|
+
})(PractitionerStatus || {});
|
|
3661
|
+
var PractitionerTokenStatus = /* @__PURE__ */ ((PractitionerTokenStatus2) => {
|
|
3662
|
+
PractitionerTokenStatus2["ACTIVE"] = "active";
|
|
3663
|
+
PractitionerTokenStatus2["USED"] = "used";
|
|
3664
|
+
PractitionerTokenStatus2["EXPIRED"] = "expired";
|
|
3665
|
+
PractitionerTokenStatus2["REVOKED"] = "revoked";
|
|
3666
|
+
return PractitionerTokenStatus2;
|
|
3667
|
+
})(PractitionerTokenStatus || {});
|
|
3668
|
+
|
|
3669
|
+
// src/validations/practitioner.schema.ts
|
|
3741
3670
|
import { z as z13 } from "zod";
|
|
3671
|
+
import { Timestamp as Timestamp7 } from "firebase/firestore";
|
|
3672
|
+
|
|
3673
|
+
// src/backoffice/types/static/certification.types.ts
|
|
3674
|
+
var CertificationLevel = /* @__PURE__ */ ((CertificationLevel2) => {
|
|
3675
|
+
CertificationLevel2["AESTHETICIAN"] = "aesthetician";
|
|
3676
|
+
CertificationLevel2["NURSE_ASSISTANT"] = "nurse_assistant";
|
|
3677
|
+
CertificationLevel2["NURSE"] = "nurse";
|
|
3678
|
+
CertificationLevel2["NURSE_PRACTITIONER"] = "nurse_practitioner";
|
|
3679
|
+
CertificationLevel2["PHYSICIAN_ASSISTANT"] = "physician_assistant";
|
|
3680
|
+
CertificationLevel2["DOCTOR"] = "doctor";
|
|
3681
|
+
CertificationLevel2["SPECIALIST"] = "specialist";
|
|
3682
|
+
CertificationLevel2["PLASTIC_SURGEON"] = "plastic_surgeon";
|
|
3683
|
+
return CertificationLevel2;
|
|
3684
|
+
})(CertificationLevel || {});
|
|
3685
|
+
var CertificationSpecialty = /* @__PURE__ */ ((CertificationSpecialty3) => {
|
|
3686
|
+
CertificationSpecialty3["LASER"] = "laser";
|
|
3687
|
+
CertificationSpecialty3["INJECTABLES"] = "injectables";
|
|
3688
|
+
CertificationSpecialty3["CHEMICAL_PEELS"] = "chemical_peels";
|
|
3689
|
+
CertificationSpecialty3["MICRODERMABRASION"] = "microdermabrasion";
|
|
3690
|
+
CertificationSpecialty3["BODY_CONTOURING"] = "body_contouring";
|
|
3691
|
+
CertificationSpecialty3["SKIN_CARE"] = "skin_care";
|
|
3692
|
+
CertificationSpecialty3["WOUND_CARE"] = "wound_care";
|
|
3693
|
+
CertificationSpecialty3["ANESTHESIA"] = "anesthesia";
|
|
3694
|
+
return CertificationSpecialty3;
|
|
3695
|
+
})(CertificationSpecialty || {});
|
|
3696
|
+
|
|
3697
|
+
// src/validations/practitioner.schema.ts
|
|
3698
|
+
var practitionerBasicInfoSchema = z13.object({
|
|
3699
|
+
firstName: z13.string().min(2).max(50),
|
|
3700
|
+
lastName: z13.string().min(2).max(50),
|
|
3701
|
+
title: z13.string().min(2).max(100),
|
|
3702
|
+
email: z13.string().email(),
|
|
3703
|
+
phoneNumber: z13.string().regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number"),
|
|
3704
|
+
dateOfBirth: z13.instanceof(Timestamp7).or(z13.date()),
|
|
3705
|
+
gender: z13.enum(["male", "female", "other"]),
|
|
3706
|
+
profileImageUrl: z13.string().url().optional(),
|
|
3707
|
+
bio: z13.string().max(1e3).optional(),
|
|
3708
|
+
languages: z13.array(z13.string()).min(1)
|
|
3709
|
+
});
|
|
3710
|
+
var practitionerCertificationSchema = z13.object({
|
|
3711
|
+
level: z13.nativeEnum(CertificationLevel),
|
|
3712
|
+
specialties: z13.array(z13.nativeEnum(CertificationSpecialty)),
|
|
3713
|
+
licenseNumber: z13.string().min(3).max(50),
|
|
3714
|
+
issuingAuthority: z13.string().min(2).max(100),
|
|
3715
|
+
issueDate: z13.instanceof(Timestamp7).or(z13.date()),
|
|
3716
|
+
expiryDate: z13.instanceof(Timestamp7).or(z13.date()).optional(),
|
|
3717
|
+
verificationStatus: z13.enum(["pending", "verified", "rejected"])
|
|
3718
|
+
});
|
|
3719
|
+
var timeSlotSchema = z13.object({
|
|
3720
|
+
start: z13.string().regex(/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format"),
|
|
3721
|
+
end: z13.string().regex(/^([01]\d|2[0-3]):([0-5]\d)$/, "Invalid time format")
|
|
3722
|
+
}).nullable();
|
|
3723
|
+
var practitionerWorkingHoursSchema = z13.object({
|
|
3724
|
+
practitionerId: z13.string().min(1),
|
|
3725
|
+
clinicId: z13.string().min(1),
|
|
3726
|
+
monday: timeSlotSchema,
|
|
3727
|
+
tuesday: timeSlotSchema,
|
|
3728
|
+
wednesday: timeSlotSchema,
|
|
3729
|
+
thursday: timeSlotSchema,
|
|
3730
|
+
friday: timeSlotSchema,
|
|
3731
|
+
saturday: timeSlotSchema,
|
|
3732
|
+
sunday: timeSlotSchema,
|
|
3733
|
+
createdAt: z13.instanceof(Timestamp7).or(z13.date()),
|
|
3734
|
+
updatedAt: z13.instanceof(Timestamp7).or(z13.date())
|
|
3735
|
+
});
|
|
3736
|
+
var practitionerClinicWorkingHoursSchema = z13.object({
|
|
3737
|
+
clinicId: z13.string().min(1),
|
|
3738
|
+
workingHours: z13.object({
|
|
3739
|
+
monday: timeSlotSchema,
|
|
3740
|
+
tuesday: timeSlotSchema,
|
|
3741
|
+
wednesday: timeSlotSchema,
|
|
3742
|
+
thursday: timeSlotSchema,
|
|
3743
|
+
friday: timeSlotSchema,
|
|
3744
|
+
saturday: timeSlotSchema,
|
|
3745
|
+
sunday: timeSlotSchema
|
|
3746
|
+
}),
|
|
3747
|
+
isActive: z13.boolean(),
|
|
3748
|
+
createdAt: z13.instanceof(Timestamp7).or(z13.date()),
|
|
3749
|
+
updatedAt: z13.instanceof(Timestamp7).or(z13.date())
|
|
3750
|
+
});
|
|
3751
|
+
var practitionerSchema = z13.object({
|
|
3752
|
+
id: z13.string().min(1),
|
|
3753
|
+
userRef: z13.string().min(1),
|
|
3754
|
+
basicInfo: practitionerBasicInfoSchema,
|
|
3755
|
+
certification: practitionerCertificationSchema,
|
|
3756
|
+
clinics: z13.array(z13.string()),
|
|
3757
|
+
clinicWorkingHours: z13.array(practitionerClinicWorkingHoursSchema),
|
|
3758
|
+
clinicsInfo: z13.array(clinicInfoSchema),
|
|
3759
|
+
procedures: z13.array(z13.string()),
|
|
3760
|
+
proceduresInfo: z13.array(procedureSummaryInfoSchema),
|
|
3761
|
+
reviewInfo: practitionerReviewInfoSchema,
|
|
3762
|
+
isActive: z13.boolean(),
|
|
3763
|
+
isVerified: z13.boolean(),
|
|
3764
|
+
status: z13.nativeEnum(PractitionerStatus),
|
|
3765
|
+
createdAt: z13.instanceof(Timestamp7).or(z13.date()),
|
|
3766
|
+
updatedAt: z13.instanceof(Timestamp7).or(z13.date())
|
|
3767
|
+
});
|
|
3768
|
+
var createPractitionerSchema = z13.object({
|
|
3769
|
+
userRef: z13.string().min(1),
|
|
3770
|
+
basicInfo: practitionerBasicInfoSchema,
|
|
3771
|
+
certification: practitionerCertificationSchema,
|
|
3772
|
+
clinics: z13.array(z13.string()).optional(),
|
|
3773
|
+
clinicWorkingHours: z13.array(practitionerClinicWorkingHoursSchema).optional(),
|
|
3774
|
+
clinicsInfo: z13.array(clinicInfoSchema).optional(),
|
|
3775
|
+
proceduresInfo: z13.array(procedureSummaryInfoSchema).optional(),
|
|
3776
|
+
isActive: z13.boolean(),
|
|
3777
|
+
isVerified: z13.boolean(),
|
|
3778
|
+
status: z13.nativeEnum(PractitionerStatus).optional()
|
|
3779
|
+
});
|
|
3780
|
+
var createDraftPractitionerSchema = z13.object({
|
|
3781
|
+
basicInfo: practitionerBasicInfoSchema,
|
|
3782
|
+
certification: practitionerCertificationSchema,
|
|
3783
|
+
clinics: z13.array(z13.string()).optional(),
|
|
3784
|
+
clinicWorkingHours: z13.array(practitionerClinicWorkingHoursSchema).optional(),
|
|
3785
|
+
clinicsInfo: z13.array(clinicInfoSchema).optional(),
|
|
3786
|
+
proceduresInfo: z13.array(procedureSummaryInfoSchema).optional(),
|
|
3787
|
+
isActive: z13.boolean().optional().default(false),
|
|
3788
|
+
isVerified: z13.boolean().optional().default(false)
|
|
3789
|
+
});
|
|
3790
|
+
var practitionerTokenSchema = z13.object({
|
|
3791
|
+
id: z13.string().min(1),
|
|
3792
|
+
token: z13.string().min(6),
|
|
3793
|
+
practitionerId: z13.string().min(1),
|
|
3794
|
+
email: z13.string().email(),
|
|
3795
|
+
clinicId: z13.string().min(1),
|
|
3796
|
+
status: z13.nativeEnum(PractitionerTokenStatus),
|
|
3797
|
+
createdBy: z13.string().min(1),
|
|
3798
|
+
createdAt: z13.instanceof(Timestamp7).or(z13.date()),
|
|
3799
|
+
expiresAt: z13.instanceof(Timestamp7).or(z13.date()),
|
|
3800
|
+
usedBy: z13.string().optional(),
|
|
3801
|
+
usedAt: z13.instanceof(Timestamp7).or(z13.date()).optional()
|
|
3802
|
+
});
|
|
3803
|
+
var createPractitionerTokenSchema = z13.object({
|
|
3804
|
+
practitionerId: z13.string().min(1),
|
|
3805
|
+
email: z13.string().email(),
|
|
3806
|
+
clinicId: z13.string().min(1),
|
|
3807
|
+
expiresAt: z13.date().optional()
|
|
3808
|
+
});
|
|
3809
|
+
var practitionerSignupSchema = z13.object({
|
|
3810
|
+
email: z13.string().email(),
|
|
3811
|
+
password: z13.string().min(8),
|
|
3812
|
+
firstName: z13.string().min(2).max(50),
|
|
3813
|
+
lastName: z13.string().min(2).max(50),
|
|
3814
|
+
token: z13.string().optional(),
|
|
3815
|
+
profileData: z13.object({
|
|
3816
|
+
basicInfo: z13.object({
|
|
3817
|
+
phoneNumber: z13.string().optional(),
|
|
3818
|
+
profileImageUrl: z13.string().optional(),
|
|
3819
|
+
gender: z13.enum(["male", "female", "other"]).optional(),
|
|
3820
|
+
bio: z13.string().optional()
|
|
3821
|
+
}).optional(),
|
|
3822
|
+
certification: z13.any().optional()
|
|
3823
|
+
}).optional()
|
|
3824
|
+
});
|
|
3825
|
+
|
|
3826
|
+
// src/services/practitioner/practitioner.service.ts
|
|
3827
|
+
import { z as z14 } from "zod";
|
|
3742
3828
|
import { distanceBetween } from "geofire-common";
|
|
3743
3829
|
var PractitionerService = class extends BaseService {
|
|
3744
3830
|
constructor(db, auth, app, clinicService) {
|
|
@@ -3807,7 +3893,7 @@ var PractitionerService = class extends BaseService {
|
|
|
3807
3893
|
}
|
|
3808
3894
|
return createdPractitioner;
|
|
3809
3895
|
} catch (error) {
|
|
3810
|
-
if (error instanceof
|
|
3896
|
+
if (error instanceof z14.ZodError) {
|
|
3811
3897
|
throw new Error(`Invalid practitioner data: ${error.message}`);
|
|
3812
3898
|
}
|
|
3813
3899
|
console.error("Error creating practitioner:", error);
|
|
@@ -3862,7 +3948,8 @@ var PractitionerService = class extends BaseService {
|
|
|
3862
3948
|
name: clinicData.name,
|
|
3863
3949
|
location: clinicData.location,
|
|
3864
3950
|
contactInfo: clinicData.contactInfo,
|
|
3865
|
-
|
|
3951
|
+
// Make sure we're using the right property for featuredPhoto
|
|
3952
|
+
featuredPhoto: clinicData.featuredPhotos && clinicData.featuredPhotos.length > 0 ? clinicData.featuredPhotos[0] : clinicData.coverPhoto || "",
|
|
3866
3953
|
description: clinicData.description || null
|
|
3867
3954
|
});
|
|
3868
3955
|
}
|
|
@@ -3919,7 +4006,7 @@ var PractitionerService = class extends BaseService {
|
|
|
3919
4006
|
await setDoc7(doc8(this.db, tokenPath), token);
|
|
3920
4007
|
return { practitioner: savedPractitioner, token };
|
|
3921
4008
|
} catch (error) {
|
|
3922
|
-
if (error instanceof
|
|
4009
|
+
if (error instanceof z14.ZodError) {
|
|
3923
4010
|
throw new Error("Invalid practitioner data: " + error.message);
|
|
3924
4011
|
}
|
|
3925
4012
|
throw error;
|
|
@@ -3972,7 +4059,7 @@ var PractitionerService = class extends BaseService {
|
|
|
3972
4059
|
await setDoc7(doc8(this.db, tokenPath), token);
|
|
3973
4060
|
return token;
|
|
3974
4061
|
} catch (error) {
|
|
3975
|
-
if (error instanceof
|
|
4062
|
+
if (error instanceof z14.ZodError) {
|
|
3976
4063
|
throw new Error("Invalid token data: " + error.message);
|
|
3977
4064
|
}
|
|
3978
4065
|
throw error;
|
|
@@ -4132,7 +4219,7 @@ var PractitionerService = class extends BaseService {
|
|
|
4132
4219
|
}
|
|
4133
4220
|
return updatedPractitioner;
|
|
4134
4221
|
} catch (error) {
|
|
4135
|
-
if (error instanceof
|
|
4222
|
+
if (error instanceof z14.ZodError) {
|
|
4136
4223
|
throw new Error(`Invalid practitioner update data: ${error.message}`);
|
|
4137
4224
|
}
|
|
4138
4225
|
console.error(`Error updating practitioner ${practitionerId}:`, error);
|
|
@@ -4660,7 +4747,7 @@ var UserService = class extends BaseService {
|
|
|
4660
4747
|
});
|
|
4661
4748
|
return this.getUserById(uid);
|
|
4662
4749
|
} catch (error) {
|
|
4663
|
-
if (error instanceof
|
|
4750
|
+
if (error instanceof z15.ZodError) {
|
|
4664
4751
|
throw USER_ERRORS.VALIDATION_ERROR;
|
|
4665
4752
|
}
|
|
4666
4753
|
throw error;
|
|
@@ -4757,7 +4844,7 @@ import {
|
|
|
4757
4844
|
Timestamp as Timestamp10
|
|
4758
4845
|
} from "firebase/firestore";
|
|
4759
4846
|
import { geohashForLocation as geohashForLocation2 } from "geofire-common";
|
|
4760
|
-
import { z as
|
|
4847
|
+
import { z as z16 } from "zod";
|
|
4761
4848
|
|
|
4762
4849
|
// src/services/clinic/utils/photos.utils.ts
|
|
4763
4850
|
import {
|
|
@@ -4961,7 +5048,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
|
|
|
4961
5048
|
});
|
|
4962
5049
|
return groupData;
|
|
4963
5050
|
} catch (error) {
|
|
4964
|
-
if (error instanceof
|
|
5051
|
+
if (error instanceof z16.ZodError) {
|
|
4965
5052
|
console.error(
|
|
4966
5053
|
"[CLINIC_GROUP] Zod validation error:",
|
|
4967
5054
|
JSON.stringify(error.errors, null, 2)
|
|
@@ -5376,7 +5463,7 @@ import {
|
|
|
5376
5463
|
import {
|
|
5377
5464
|
geohashForLocation as geohashForLocation4
|
|
5378
5465
|
} from "geofire-common";
|
|
5379
|
-
import { z as
|
|
5466
|
+
import { z as z18 } from "zod";
|
|
5380
5467
|
|
|
5381
5468
|
// src/services/clinic/utils/clinic.utils.ts
|
|
5382
5469
|
import {
|
|
@@ -5397,7 +5484,7 @@ import {
|
|
|
5397
5484
|
distanceBetween as distanceBetween2,
|
|
5398
5485
|
geohashQueryBounds
|
|
5399
5486
|
} from "geofire-common";
|
|
5400
|
-
import { z as
|
|
5487
|
+
import { z as z17 } from "zod";
|
|
5401
5488
|
async function getClinic(db, clinicId) {
|
|
5402
5489
|
const docRef = doc11(db, CLINICS_COLLECTION, clinicId);
|
|
5403
5490
|
const docSnap = await getDoc14(docRef);
|
|
@@ -6082,7 +6169,7 @@ var ClinicService = class extends BaseService {
|
|
|
6082
6169
|
if (!savedClinic) throw new Error("Failed to retrieve created clinic");
|
|
6083
6170
|
return savedClinic;
|
|
6084
6171
|
} catch (error) {
|
|
6085
|
-
if (error instanceof
|
|
6172
|
+
if (error instanceof z18.ZodError) {
|
|
6086
6173
|
throw new Error("Invalid clinic data: " + error.message);
|
|
6087
6174
|
}
|
|
6088
6175
|
console.error("Error creating clinic:", error);
|
|
@@ -6130,7 +6217,7 @@ var ClinicService = class extends BaseService {
|
|
|
6130
6217
|
if (!updatedClinic) throw new Error("Failed to retrieve updated clinic");
|
|
6131
6218
|
return updatedClinic;
|
|
6132
6219
|
} catch (error) {
|
|
6133
|
-
if (error instanceof
|
|
6220
|
+
if (error instanceof z18.ZodError) {
|
|
6134
6221
|
throw new Error(
|
|
6135
6222
|
"Invalid clinic update data: " + error.errors.map((e) => `${e.path.join(".")} - ${e.message}`).join(", ")
|
|
6136
6223
|
);
|
|
@@ -6589,7 +6676,7 @@ var AuthService = class extends BaseService {
|
|
|
6589
6676
|
clinicAdmin: adminProfile
|
|
6590
6677
|
};
|
|
6591
6678
|
} catch (error) {
|
|
6592
|
-
if (error instanceof
|
|
6679
|
+
if (error instanceof z19.ZodError) {
|
|
6593
6680
|
console.error(
|
|
6594
6681
|
"[AUTH] Zod validation error in signUpClinicAdmin:",
|
|
6595
6682
|
JSON.stringify(error.errors, null, 2)
|
|
@@ -6762,7 +6849,7 @@ var AuthService = class extends BaseService {
|
|
|
6762
6849
|
email
|
|
6763
6850
|
);
|
|
6764
6851
|
} catch (error) {
|
|
6765
|
-
if (error instanceof
|
|
6852
|
+
if (error instanceof z19.ZodError) {
|
|
6766
6853
|
throw AUTH_ERRORS.VALIDATION_ERROR;
|
|
6767
6854
|
}
|
|
6768
6855
|
const firebaseError = error;
|
|
@@ -6885,7 +6972,7 @@ var AuthService = class extends BaseService {
|
|
|
6885
6972
|
await emailSchema.parseAsync(email);
|
|
6886
6973
|
await sendPasswordResetEmail(this.auth, email);
|
|
6887
6974
|
} catch (error) {
|
|
6888
|
-
if (error instanceof
|
|
6975
|
+
if (error instanceof z19.ZodError) {
|
|
6889
6976
|
throw AUTH_ERRORS.VALIDATION_ERROR;
|
|
6890
6977
|
}
|
|
6891
6978
|
const firebaseError = error;
|
|
@@ -6924,7 +7011,7 @@ var AuthService = class extends BaseService {
|
|
|
6924
7011
|
await passwordSchema.parseAsync(newPassword);
|
|
6925
7012
|
await confirmPasswordReset(this.auth, oobCode, newPassword);
|
|
6926
7013
|
} catch (error) {
|
|
6927
|
-
if (error instanceof
|
|
7014
|
+
if (error instanceof z19.ZodError) {
|
|
6928
7015
|
throw AUTH_ERRORS.VALIDATION_ERROR;
|
|
6929
7016
|
}
|
|
6930
7017
|
const firebaseError = error;
|
|
@@ -7093,7 +7180,7 @@ var AuthService = class extends BaseService {
|
|
|
7093
7180
|
practitioner
|
|
7094
7181
|
};
|
|
7095
7182
|
} catch (error) {
|
|
7096
|
-
if (error instanceof
|
|
7183
|
+
if (error instanceof z19.ZodError) {
|
|
7097
7184
|
console.error(
|
|
7098
7185
|
"[AUTH] Zod validation error in signUpPractitioner:",
|
|
7099
7186
|
JSON.stringify(error.errors, null, 2)
|
|
@@ -7385,59 +7472,59 @@ import {
|
|
|
7385
7472
|
var PROCEDURES_COLLECTION = "procedures";
|
|
7386
7473
|
|
|
7387
7474
|
// src/validations/procedure.schema.ts
|
|
7388
|
-
import { z as
|
|
7389
|
-
var createProcedureSchema =
|
|
7390
|
-
name:
|
|
7391
|
-
description:
|
|
7392
|
-
family:
|
|
7393
|
-
categoryId:
|
|
7394
|
-
subcategoryId:
|
|
7395
|
-
technologyId:
|
|
7396
|
-
productId:
|
|
7397
|
-
price:
|
|
7398
|
-
currency:
|
|
7399
|
-
pricingMeasure:
|
|
7400
|
-
duration:
|
|
7475
|
+
import { z as z20 } from "zod";
|
|
7476
|
+
var createProcedureSchema = z20.object({
|
|
7477
|
+
name: z20.string().min(1).max(200),
|
|
7478
|
+
description: z20.string().min(1).max(2e3),
|
|
7479
|
+
family: z20.nativeEnum(ProcedureFamily),
|
|
7480
|
+
categoryId: z20.string().min(1),
|
|
7481
|
+
subcategoryId: z20.string().min(1),
|
|
7482
|
+
technologyId: z20.string().min(1),
|
|
7483
|
+
productId: z20.string().min(1),
|
|
7484
|
+
price: z20.number().min(0),
|
|
7485
|
+
currency: z20.nativeEnum(Currency),
|
|
7486
|
+
pricingMeasure: z20.nativeEnum(PricingMeasure),
|
|
7487
|
+
duration: z20.number().min(1).max(480),
|
|
7401
7488
|
// Max 8 hours
|
|
7402
|
-
practitionerId:
|
|
7403
|
-
clinicBranchId:
|
|
7489
|
+
practitionerId: z20.string().min(1),
|
|
7490
|
+
clinicBranchId: z20.string().min(1)
|
|
7404
7491
|
});
|
|
7405
|
-
var updateProcedureSchema =
|
|
7406
|
-
name:
|
|
7407
|
-
description:
|
|
7408
|
-
price:
|
|
7409
|
-
currency:
|
|
7410
|
-
pricingMeasure:
|
|
7411
|
-
duration:
|
|
7412
|
-
isActive:
|
|
7413
|
-
practitionerId:
|
|
7414
|
-
categoryId:
|
|
7415
|
-
subcategoryId:
|
|
7416
|
-
technologyId:
|
|
7417
|
-
productId:
|
|
7418
|
-
clinicBranchId:
|
|
7492
|
+
var updateProcedureSchema = z20.object({
|
|
7493
|
+
name: z20.string().min(3).max(100).optional(),
|
|
7494
|
+
description: z20.string().min(3).max(1e3).optional(),
|
|
7495
|
+
price: z20.number().min(0).optional(),
|
|
7496
|
+
currency: z20.nativeEnum(Currency).optional(),
|
|
7497
|
+
pricingMeasure: z20.nativeEnum(PricingMeasure).optional(),
|
|
7498
|
+
duration: z20.number().min(0).optional(),
|
|
7499
|
+
isActive: z20.boolean().optional(),
|
|
7500
|
+
practitionerId: z20.string().optional(),
|
|
7501
|
+
categoryId: z20.string().optional(),
|
|
7502
|
+
subcategoryId: z20.string().optional(),
|
|
7503
|
+
technologyId: z20.string().optional(),
|
|
7504
|
+
productId: z20.string().optional(),
|
|
7505
|
+
clinicBranchId: z20.string().optional()
|
|
7419
7506
|
});
|
|
7420
7507
|
var procedureSchema = createProcedureSchema.extend({
|
|
7421
|
-
id:
|
|
7422
|
-
category:
|
|
7508
|
+
id: z20.string().min(1),
|
|
7509
|
+
category: z20.any(),
|
|
7423
7510
|
// We'll validate the full category object separately
|
|
7424
|
-
subcategory:
|
|
7511
|
+
subcategory: z20.any(),
|
|
7425
7512
|
// We'll validate the full subcategory object separately
|
|
7426
|
-
technology:
|
|
7513
|
+
technology: z20.any(),
|
|
7427
7514
|
// We'll validate the full technology object separately
|
|
7428
|
-
product:
|
|
7515
|
+
product: z20.any(),
|
|
7429
7516
|
// We'll validate the full product object separately
|
|
7430
|
-
blockingConditions:
|
|
7517
|
+
blockingConditions: z20.array(z20.any()),
|
|
7431
7518
|
// We'll validate blocking conditions separately
|
|
7432
|
-
treatmentBenefits:
|
|
7519
|
+
treatmentBenefits: z20.array(z20.any()),
|
|
7433
7520
|
// We'll validate treatment benefits separately
|
|
7434
|
-
preRequirements:
|
|
7521
|
+
preRequirements: z20.array(z20.any()),
|
|
7435
7522
|
// We'll validate requirements separately
|
|
7436
|
-
postRequirements:
|
|
7523
|
+
postRequirements: z20.array(z20.any()),
|
|
7437
7524
|
// We'll validate requirements separately
|
|
7438
|
-
certificationRequirement:
|
|
7525
|
+
certificationRequirement: z20.any(),
|
|
7439
7526
|
// We'll validate certification requirement separately
|
|
7440
|
-
documentationTemplates:
|
|
7527
|
+
documentationTemplates: z20.array(z20.any()),
|
|
7441
7528
|
// We'll validate documentation templates separately
|
|
7442
7529
|
clinicInfo: clinicInfoSchema,
|
|
7443
7530
|
// Clinic info validation
|
|
@@ -7445,9 +7532,9 @@ var procedureSchema = createProcedureSchema.extend({
|
|
|
7445
7532
|
// Doctor info validation
|
|
7446
7533
|
reviewInfo: procedureReviewInfoSchema,
|
|
7447
7534
|
// Procedure review info validation
|
|
7448
|
-
isActive:
|
|
7449
|
-
createdAt:
|
|
7450
|
-
updatedAt:
|
|
7535
|
+
isActive: z20.boolean(),
|
|
7536
|
+
createdAt: z20.date(),
|
|
7537
|
+
updatedAt: z20.date()
|
|
7451
7538
|
});
|
|
7452
7539
|
|
|
7453
7540
|
// src/services/procedure/procedure.service.ts
|
|
@@ -8516,42 +8603,42 @@ import {
|
|
|
8516
8603
|
} from "firebase/firestore";
|
|
8517
8604
|
|
|
8518
8605
|
// src/validations/calendar.schema.ts
|
|
8519
|
-
import { z as
|
|
8606
|
+
import { z as z22 } from "zod";
|
|
8520
8607
|
import { Timestamp as Timestamp18 } from "firebase/firestore";
|
|
8521
8608
|
|
|
8522
8609
|
// src/validations/profile-info.schema.ts
|
|
8523
|
-
import { z as
|
|
8610
|
+
import { z as z21 } from "zod";
|
|
8524
8611
|
import { Timestamp as Timestamp17 } from "firebase/firestore";
|
|
8525
|
-
var clinicInfoSchema2 =
|
|
8526
|
-
id:
|
|
8527
|
-
featuredPhoto:
|
|
8528
|
-
name:
|
|
8529
|
-
description:
|
|
8612
|
+
var clinicInfoSchema2 = z21.object({
|
|
8613
|
+
id: z21.string(),
|
|
8614
|
+
featuredPhoto: z21.string(),
|
|
8615
|
+
name: z21.string(),
|
|
8616
|
+
description: z21.string(),
|
|
8530
8617
|
location: clinicLocationSchema,
|
|
8531
8618
|
contactInfo: clinicContactInfoSchema
|
|
8532
8619
|
});
|
|
8533
|
-
var practitionerProfileInfoSchema =
|
|
8534
|
-
id:
|
|
8535
|
-
practitionerPhoto:
|
|
8536
|
-
name:
|
|
8537
|
-
email:
|
|
8538
|
-
phone:
|
|
8620
|
+
var practitionerProfileInfoSchema = z21.object({
|
|
8621
|
+
id: z21.string(),
|
|
8622
|
+
practitionerPhoto: z21.string().nullable(),
|
|
8623
|
+
name: z21.string(),
|
|
8624
|
+
email: z21.string().email(),
|
|
8625
|
+
phone: z21.string().nullable(),
|
|
8539
8626
|
certification: practitionerCertificationSchema
|
|
8540
8627
|
});
|
|
8541
|
-
var patientProfileInfoSchema =
|
|
8542
|
-
id:
|
|
8543
|
-
fullName:
|
|
8544
|
-
email:
|
|
8545
|
-
phone:
|
|
8546
|
-
dateOfBirth:
|
|
8547
|
-
gender:
|
|
8628
|
+
var patientProfileInfoSchema = z21.object({
|
|
8629
|
+
id: z21.string(),
|
|
8630
|
+
fullName: z21.string(),
|
|
8631
|
+
email: z21.string().email(),
|
|
8632
|
+
phone: z21.string().nullable(),
|
|
8633
|
+
dateOfBirth: z21.instanceof(Timestamp17),
|
|
8634
|
+
gender: z21.nativeEnum(Gender)
|
|
8548
8635
|
});
|
|
8549
8636
|
|
|
8550
8637
|
// src/validations/calendar.schema.ts
|
|
8551
8638
|
var MIN_APPOINTMENT_DURATION = 15;
|
|
8552
|
-
var calendarEventTimeSchema =
|
|
8553
|
-
start:
|
|
8554
|
-
end:
|
|
8639
|
+
var calendarEventTimeSchema = z22.object({
|
|
8640
|
+
start: z22.instanceof(Date).or(z22.instanceof(Timestamp18)),
|
|
8641
|
+
end: z22.instanceof(Date).or(z22.instanceof(Timestamp18))
|
|
8555
8642
|
}).refine(
|
|
8556
8643
|
(data) => {
|
|
8557
8644
|
const startDate = data.start instanceof Timestamp18 ? data.start.toDate() : data.start;
|
|
@@ -8572,46 +8659,46 @@ var calendarEventTimeSchema = z21.object({
|
|
|
8572
8659
|
path: ["start"]
|
|
8573
8660
|
}
|
|
8574
8661
|
);
|
|
8575
|
-
var timeSlotSchema2 =
|
|
8576
|
-
start:
|
|
8577
|
-
end:
|
|
8578
|
-
isAvailable:
|
|
8662
|
+
var timeSlotSchema2 = z22.object({
|
|
8663
|
+
start: z22.date(),
|
|
8664
|
+
end: z22.date(),
|
|
8665
|
+
isAvailable: z22.boolean()
|
|
8579
8666
|
}).refine((data) => data.start < data.end, {
|
|
8580
8667
|
message: "End time must be after start time",
|
|
8581
8668
|
path: ["end"]
|
|
8582
8669
|
});
|
|
8583
|
-
var syncedCalendarEventSchema =
|
|
8584
|
-
eventId:
|
|
8585
|
-
syncedCalendarProvider:
|
|
8586
|
-
syncedAt:
|
|
8670
|
+
var syncedCalendarEventSchema = z22.object({
|
|
8671
|
+
eventId: z22.string(),
|
|
8672
|
+
syncedCalendarProvider: z22.nativeEnum(SyncedCalendarProvider),
|
|
8673
|
+
syncedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp18))
|
|
8587
8674
|
});
|
|
8588
|
-
var procedureInfoSchema =
|
|
8589
|
-
name:
|
|
8590
|
-
description:
|
|
8591
|
-
duration:
|
|
8592
|
-
price:
|
|
8593
|
-
currency:
|
|
8675
|
+
var procedureInfoSchema = z22.object({
|
|
8676
|
+
name: z22.string(),
|
|
8677
|
+
description: z22.string(),
|
|
8678
|
+
duration: z22.number().min(MIN_APPOINTMENT_DURATION),
|
|
8679
|
+
price: z22.number().min(0),
|
|
8680
|
+
currency: z22.nativeEnum(Currency)
|
|
8594
8681
|
});
|
|
8595
|
-
var procedureCategorizationSchema =
|
|
8596
|
-
procedureFamily:
|
|
8682
|
+
var procedureCategorizationSchema = z22.object({
|
|
8683
|
+
procedureFamily: z22.string(),
|
|
8597
8684
|
// Replace with proper enum when available
|
|
8598
|
-
procedureCategory:
|
|
8685
|
+
procedureCategory: z22.string(),
|
|
8599
8686
|
// Replace with proper enum when available
|
|
8600
|
-
procedureSubcategory:
|
|
8687
|
+
procedureSubcategory: z22.string(),
|
|
8601
8688
|
// Replace with proper enum when available
|
|
8602
|
-
procedureTechnology:
|
|
8689
|
+
procedureTechnology: z22.string(),
|
|
8603
8690
|
// Replace with proper enum when available
|
|
8604
|
-
procedureProduct:
|
|
8691
|
+
procedureProduct: z22.string()
|
|
8605
8692
|
// Replace with proper enum when available
|
|
8606
8693
|
});
|
|
8607
|
-
var createAppointmentSchema2 =
|
|
8608
|
-
clinicId:
|
|
8609
|
-
doctorId:
|
|
8610
|
-
patientId:
|
|
8611
|
-
procedureId:
|
|
8694
|
+
var createAppointmentSchema2 = z22.object({
|
|
8695
|
+
clinicId: z22.string().min(1, "Clinic ID is required"),
|
|
8696
|
+
doctorId: z22.string().min(1, "Doctor ID is required"),
|
|
8697
|
+
patientId: z22.string().min(1, "Patient ID is required"),
|
|
8698
|
+
procedureId: z22.string().min(1, "Procedure ID is required"),
|
|
8612
8699
|
eventLocation: clinicLocationSchema,
|
|
8613
8700
|
eventTime: calendarEventTimeSchema,
|
|
8614
|
-
description:
|
|
8701
|
+
description: z22.string().optional()
|
|
8615
8702
|
}).refine(
|
|
8616
8703
|
(data) => {
|
|
8617
8704
|
return true;
|
|
@@ -8620,73 +8707,73 @@ var createAppointmentSchema2 = z21.object({
|
|
|
8620
8707
|
message: "Invalid appointment parameters"
|
|
8621
8708
|
}
|
|
8622
8709
|
);
|
|
8623
|
-
var updateAppointmentSchema2 =
|
|
8624
|
-
appointmentId:
|
|
8625
|
-
clinicId:
|
|
8626
|
-
doctorId:
|
|
8627
|
-
patientId:
|
|
8710
|
+
var updateAppointmentSchema2 = z22.object({
|
|
8711
|
+
appointmentId: z22.string().min(1, "Appointment ID is required"),
|
|
8712
|
+
clinicId: z22.string().min(1, "Clinic ID is required"),
|
|
8713
|
+
doctorId: z22.string().min(1, "Doctor ID is required"),
|
|
8714
|
+
patientId: z22.string().min(1, "Patient ID is required"),
|
|
8628
8715
|
eventTime: calendarEventTimeSchema.optional(),
|
|
8629
|
-
description:
|
|
8630
|
-
status:
|
|
8716
|
+
description: z22.string().optional(),
|
|
8717
|
+
status: z22.nativeEnum(CalendarEventStatus).optional()
|
|
8631
8718
|
});
|
|
8632
|
-
var createCalendarEventSchema =
|
|
8633
|
-
id:
|
|
8634
|
-
clinicBranchId:
|
|
8635
|
-
clinicBranchInfo:
|
|
8636
|
-
practitionerProfileId:
|
|
8719
|
+
var createCalendarEventSchema = z22.object({
|
|
8720
|
+
id: z22.string(),
|
|
8721
|
+
clinicBranchId: z22.string().nullable().optional(),
|
|
8722
|
+
clinicBranchInfo: z22.any().nullable().optional(),
|
|
8723
|
+
practitionerProfileId: z22.string().nullable().optional(),
|
|
8637
8724
|
practitionerProfileInfo: practitionerProfileInfoSchema.nullable().optional(),
|
|
8638
|
-
patientProfileId:
|
|
8725
|
+
patientProfileId: z22.string().nullable().optional(),
|
|
8639
8726
|
patientProfileInfo: patientProfileInfoSchema.nullable().optional(),
|
|
8640
|
-
procedureId:
|
|
8641
|
-
appointmentId:
|
|
8642
|
-
syncedCalendarEventId:
|
|
8643
|
-
eventName:
|
|
8727
|
+
procedureId: z22.string().nullable().optional(),
|
|
8728
|
+
appointmentId: z22.string().nullable().optional(),
|
|
8729
|
+
syncedCalendarEventId: z22.array(syncedCalendarEventSchema).nullable().optional(),
|
|
8730
|
+
eventName: z22.string().min(1, "Event name is required"),
|
|
8644
8731
|
eventLocation: clinicLocationSchema.optional(),
|
|
8645
8732
|
eventTime: calendarEventTimeSchema,
|
|
8646
|
-
description:
|
|
8647
|
-
status:
|
|
8648
|
-
syncStatus:
|
|
8649
|
-
eventType:
|
|
8650
|
-
createdAt:
|
|
8733
|
+
description: z22.string().optional(),
|
|
8734
|
+
status: z22.nativeEnum(CalendarEventStatus),
|
|
8735
|
+
syncStatus: z22.nativeEnum(CalendarSyncStatus),
|
|
8736
|
+
eventType: z22.nativeEnum(CalendarEventType),
|
|
8737
|
+
createdAt: z22.any(),
|
|
8651
8738
|
// FieldValue for server timestamp
|
|
8652
|
-
updatedAt:
|
|
8739
|
+
updatedAt: z22.any()
|
|
8653
8740
|
// FieldValue for server timestamp
|
|
8654
8741
|
});
|
|
8655
|
-
var updateCalendarEventSchema =
|
|
8656
|
-
syncedCalendarEventId:
|
|
8657
|
-
appointmentId:
|
|
8658
|
-
eventName:
|
|
8742
|
+
var updateCalendarEventSchema = z22.object({
|
|
8743
|
+
syncedCalendarEventId: z22.array(syncedCalendarEventSchema).nullable().optional(),
|
|
8744
|
+
appointmentId: z22.string().nullable().optional(),
|
|
8745
|
+
eventName: z22.string().optional(),
|
|
8659
8746
|
eventTime: calendarEventTimeSchema.optional(),
|
|
8660
|
-
description:
|
|
8661
|
-
status:
|
|
8662
|
-
syncStatus:
|
|
8663
|
-
eventType:
|
|
8664
|
-
updatedAt:
|
|
8747
|
+
description: z22.string().optional(),
|
|
8748
|
+
status: z22.nativeEnum(CalendarEventStatus).optional(),
|
|
8749
|
+
syncStatus: z22.nativeEnum(CalendarSyncStatus).optional(),
|
|
8750
|
+
eventType: z22.nativeEnum(CalendarEventType).optional(),
|
|
8751
|
+
updatedAt: z22.any()
|
|
8665
8752
|
// FieldValue for server timestamp
|
|
8666
8753
|
});
|
|
8667
|
-
var calendarEventSchema =
|
|
8668
|
-
id:
|
|
8669
|
-
clinicBranchId:
|
|
8670
|
-
clinicBranchInfo:
|
|
8754
|
+
var calendarEventSchema = z22.object({
|
|
8755
|
+
id: z22.string(),
|
|
8756
|
+
clinicBranchId: z22.string().nullable().optional(),
|
|
8757
|
+
clinicBranchInfo: z22.any().nullable().optional(),
|
|
8671
8758
|
// Will be replaced with proper clinic info schema
|
|
8672
|
-
practitionerProfileId:
|
|
8759
|
+
practitionerProfileId: z22.string().nullable().optional(),
|
|
8673
8760
|
practitionerProfileInfo: practitionerProfileInfoSchema.nullable().optional(),
|
|
8674
|
-
patientProfileId:
|
|
8761
|
+
patientProfileId: z22.string().nullable().optional(),
|
|
8675
8762
|
patientProfileInfo: patientProfileInfoSchema.nullable().optional(),
|
|
8676
|
-
procedureId:
|
|
8763
|
+
procedureId: z22.string().nullable().optional(),
|
|
8677
8764
|
procedureInfo: procedureInfoSchema.nullable().optional(),
|
|
8678
8765
|
procedureCategorization: procedureCategorizationSchema.nullable().optional(),
|
|
8679
|
-
appointmentId:
|
|
8680
|
-
syncedCalendarEventId:
|
|
8681
|
-
eventName:
|
|
8766
|
+
appointmentId: z22.string().nullable().optional(),
|
|
8767
|
+
syncedCalendarEventId: z22.array(syncedCalendarEventSchema).nullable().optional(),
|
|
8768
|
+
eventName: z22.string(),
|
|
8682
8769
|
eventLocation: clinicLocationSchema.optional(),
|
|
8683
8770
|
eventTime: calendarEventTimeSchema,
|
|
8684
|
-
description:
|
|
8685
|
-
status:
|
|
8686
|
-
syncStatus:
|
|
8687
|
-
eventType:
|
|
8688
|
-
createdAt:
|
|
8689
|
-
updatedAt:
|
|
8771
|
+
description: z22.string().optional(),
|
|
8772
|
+
status: z22.nativeEnum(CalendarEventStatus),
|
|
8773
|
+
syncStatus: z22.nativeEnum(CalendarSyncStatus),
|
|
8774
|
+
eventType: z22.nativeEnum(CalendarEventType),
|
|
8775
|
+
createdAt: z22.instanceof(Date).or(z22.instanceof(Timestamp18)),
|
|
8776
|
+
updatedAt: z22.instanceof(Date).or(z22.instanceof(Timestamp18))
|
|
8690
8777
|
});
|
|
8691
8778
|
|
|
8692
8779
|
// src/services/calendar/utils/clinic.utils.ts
|
|
@@ -11297,7 +11384,7 @@ import {
|
|
|
11297
11384
|
var REVIEWS_COLLECTION = "reviews";
|
|
11298
11385
|
|
|
11299
11386
|
// src/services/reviews/reviews.service.ts
|
|
11300
|
-
import { z as
|
|
11387
|
+
import { z as z23 } from "zod";
|
|
11301
11388
|
var ReviewService = class extends BaseService {
|
|
11302
11389
|
constructor(db, auth, app) {
|
|
11303
11390
|
super(db, auth, app);
|
|
@@ -11403,7 +11490,7 @@ var ReviewService = class extends BaseService {
|
|
|
11403
11490
|
await Promise.all(updatePromises);
|
|
11404
11491
|
return review;
|
|
11405
11492
|
} catch (error) {
|
|
11406
|
-
if (error instanceof
|
|
11493
|
+
if (error instanceof z23.ZodError) {
|
|
11407
11494
|
throw new Error(`Invalid review data: ${error.message}`);
|
|
11408
11495
|
}
|
|
11409
11496
|
throw error;
|
|
@@ -13729,54 +13816,54 @@ var ProductService = class extends BaseService {
|
|
|
13729
13816
|
};
|
|
13730
13817
|
|
|
13731
13818
|
// src/validations/notification.schema.ts
|
|
13732
|
-
import { z as
|
|
13733
|
-
var baseNotificationSchema =
|
|
13734
|
-
id:
|
|
13735
|
-
userId:
|
|
13736
|
-
notificationTime:
|
|
13819
|
+
import { z as z24 } from "zod";
|
|
13820
|
+
var baseNotificationSchema = z24.object({
|
|
13821
|
+
id: z24.string().optional(),
|
|
13822
|
+
userId: z24.string(),
|
|
13823
|
+
notificationTime: z24.any(),
|
|
13737
13824
|
// Timestamp
|
|
13738
|
-
notificationType:
|
|
13739
|
-
notificationTokens:
|
|
13740
|
-
status:
|
|
13741
|
-
createdAt:
|
|
13825
|
+
notificationType: z24.nativeEnum(NotificationType),
|
|
13826
|
+
notificationTokens: z24.array(z24.string()),
|
|
13827
|
+
status: z24.nativeEnum(NotificationStatus),
|
|
13828
|
+
createdAt: z24.any().optional(),
|
|
13742
13829
|
// Timestamp
|
|
13743
|
-
updatedAt:
|
|
13830
|
+
updatedAt: z24.any().optional(),
|
|
13744
13831
|
// Timestamp
|
|
13745
|
-
title:
|
|
13746
|
-
body:
|
|
13747
|
-
isRead:
|
|
13748
|
-
userRole:
|
|
13832
|
+
title: z24.string(),
|
|
13833
|
+
body: z24.string(),
|
|
13834
|
+
isRead: z24.boolean(),
|
|
13835
|
+
userRole: z24.nativeEnum(UserRole)
|
|
13749
13836
|
});
|
|
13750
13837
|
var preRequirementNotificationSchema = baseNotificationSchema.extend({
|
|
13751
|
-
notificationType:
|
|
13752
|
-
treatmentId:
|
|
13753
|
-
requirements:
|
|
13754
|
-
deadline:
|
|
13838
|
+
notificationType: z24.literal("preRequirement" /* PRE_REQUIREMENT */),
|
|
13839
|
+
treatmentId: z24.string(),
|
|
13840
|
+
requirements: z24.array(z24.string()),
|
|
13841
|
+
deadline: z24.any()
|
|
13755
13842
|
// Timestamp
|
|
13756
13843
|
});
|
|
13757
13844
|
var postRequirementNotificationSchema = baseNotificationSchema.extend({
|
|
13758
|
-
notificationType:
|
|
13759
|
-
treatmentId:
|
|
13760
|
-
requirements:
|
|
13761
|
-
deadline:
|
|
13845
|
+
notificationType: z24.literal("postRequirement" /* POST_REQUIREMENT */),
|
|
13846
|
+
treatmentId: z24.string(),
|
|
13847
|
+
requirements: z24.array(z24.string()),
|
|
13848
|
+
deadline: z24.any()
|
|
13762
13849
|
// Timestamp
|
|
13763
13850
|
});
|
|
13764
13851
|
var appointmentReminderNotificationSchema = baseNotificationSchema.extend({
|
|
13765
|
-
notificationType:
|
|
13766
|
-
appointmentId:
|
|
13767
|
-
appointmentTime:
|
|
13852
|
+
notificationType: z24.literal("appointmentReminder" /* APPOINTMENT_REMINDER */),
|
|
13853
|
+
appointmentId: z24.string(),
|
|
13854
|
+
appointmentTime: z24.any(),
|
|
13768
13855
|
// Timestamp
|
|
13769
|
-
treatmentType:
|
|
13770
|
-
doctorName:
|
|
13856
|
+
treatmentType: z24.string(),
|
|
13857
|
+
doctorName: z24.string()
|
|
13771
13858
|
});
|
|
13772
13859
|
var appointmentNotificationSchema = baseNotificationSchema.extend({
|
|
13773
|
-
notificationType:
|
|
13774
|
-
appointmentId:
|
|
13775
|
-
appointmentStatus:
|
|
13776
|
-
previousStatus:
|
|
13777
|
-
reason:
|
|
13860
|
+
notificationType: z24.literal("appointmentNotification" /* APPOINTMENT_NOTIFICATION */),
|
|
13861
|
+
appointmentId: z24.string(),
|
|
13862
|
+
appointmentStatus: z24.string(),
|
|
13863
|
+
previousStatus: z24.string(),
|
|
13864
|
+
reason: z24.string().optional()
|
|
13778
13865
|
});
|
|
13779
|
-
var notificationSchema =
|
|
13866
|
+
var notificationSchema = z24.discriminatedUnion("notificationType", [
|
|
13780
13867
|
preRequirementNotificationSchema,
|
|
13781
13868
|
postRequirementNotificationSchema,
|
|
13782
13869
|
appointmentReminderNotificationSchema,
|
|
@@ -13916,7 +14003,6 @@ export {
|
|
|
13916
14003
|
clinicContactInfoSchema,
|
|
13917
14004
|
clinicGroupSchema,
|
|
13918
14005
|
clinicGroupSetupSchema,
|
|
13919
|
-
clinicInfoSchema,
|
|
13920
14006
|
clinicLocationSchema,
|
|
13921
14007
|
clinicReviewInfoSchema,
|
|
13922
14008
|
clinicReviewSchema,
|
|
@@ -13944,7 +14030,6 @@ export {
|
|
|
13944
14030
|
createProcedureReviewSchema,
|
|
13945
14031
|
createReviewSchema,
|
|
13946
14032
|
createUserOptionsSchema,
|
|
13947
|
-
doctorInfoSchema,
|
|
13948
14033
|
documentElementSchema,
|
|
13949
14034
|
documentElementWithoutIdSchema,
|
|
13950
14035
|
documentTemplateSchema,
|
|
@@ -13983,7 +14068,6 @@ export {
|
|
|
13983
14068
|
procedureInfoSchema,
|
|
13984
14069
|
procedureReviewInfoSchema,
|
|
13985
14070
|
procedureReviewSchema,
|
|
13986
|
-
procedureSummaryInfoSchema,
|
|
13987
14071
|
requesterInfoSchema,
|
|
13988
14072
|
reviewSchema,
|
|
13989
14073
|
searchAppointmentsSchema,
|