@blackcode_sa/metaestetics-api 1.7.6 → 1.7.8
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/admin/index.d.mts +7 -6
- package/dist/admin/index.d.ts +7 -6
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/index.d.mts +421 -130
- package/dist/index.d.ts +421 -130
- package/dist/index.js +1756 -1277
- package/dist/index.mjs +1548 -1053
- package/package.json +1 -1
- package/src/admin/booking/booking.admin.ts +6 -1
- package/src/services/auth.service.ts +15 -16
- package/src/services/clinic/clinic.service.ts +259 -76
- package/src/services/media/media.service.ts +135 -52
- package/src/services/practitioner/practitioner.service.ts +68 -5
- package/src/services/procedure/procedure.service.ts +12 -4
- package/src/types/clinic/index.ts +54 -62
- package/src/types/index.ts +7 -7
- package/src/validations/clinic.schema.ts +56 -26
- package/src/validations/schemas.ts +8 -28
|
@@ -20,6 +20,15 @@ import {
|
|
|
20
20
|
doctorInfoSchema,
|
|
21
21
|
} from "./shared.schema";
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Schema for validating both URL strings and File objects
|
|
25
|
+
*/
|
|
26
|
+
const mediaResourceSchema = z.union([
|
|
27
|
+
z.string(),
|
|
28
|
+
z.instanceof(File),
|
|
29
|
+
z.instanceof(Blob),
|
|
30
|
+
]);
|
|
31
|
+
|
|
23
32
|
/**
|
|
24
33
|
* Validaciona šema za kontakt informacije
|
|
25
34
|
*/
|
|
@@ -175,7 +184,7 @@ export const clinicGroupSchema = z.object({
|
|
|
175
184
|
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
176
185
|
updatedAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
177
186
|
isActive: z.boolean(),
|
|
178
|
-
logo:
|
|
187
|
+
logo: mediaResourceSchema.optional().nullable(),
|
|
179
188
|
practiceType: z.nativeEnum(PracticeType).optional(),
|
|
180
189
|
languages: z.array(z.nativeEnum(Language)).optional(),
|
|
181
190
|
subscriptionModel: z.nativeEnum(SubscriptionModel),
|
|
@@ -196,12 +205,12 @@ export const clinicSchema = z.object({
|
|
|
196
205
|
contactInfo: clinicContactInfoSchema,
|
|
197
206
|
workingHours: workingHoursSchema,
|
|
198
207
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
199
|
-
featuredPhotos: z.array(
|
|
200
|
-
coverPhoto:
|
|
208
|
+
featuredPhotos: z.array(mediaResourceSchema),
|
|
209
|
+
coverPhoto: mediaResourceSchema.nullable(),
|
|
201
210
|
photosWithTags: z
|
|
202
211
|
.array(
|
|
203
212
|
z.object({
|
|
204
|
-
url:
|
|
213
|
+
url: mediaResourceSchema,
|
|
205
214
|
tag: z.string(),
|
|
206
215
|
})
|
|
207
216
|
)
|
|
@@ -210,15 +219,13 @@ export const clinicSchema = z.object({
|
|
|
210
219
|
doctorsInfo: z.array(doctorInfoSchema), // Aggregated doctor info
|
|
211
220
|
procedures: z.array(z.string()), // List of procedure IDs offered by clinic
|
|
212
221
|
proceduresInfo: z.array(procedureSummaryInfoSchema), // Use the correct schema for aggregated procedure info
|
|
213
|
-
// services: z.array(z.string()), // Likely deprecated, procedures covers this
|
|
214
|
-
// servicesInfo: z.array(serviceInfoSchema), // Deprecated, use proceduresInfo
|
|
215
222
|
reviewInfo: clinicReviewInfoSchema,
|
|
216
223
|
admins: z.array(z.string()),
|
|
217
224
|
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
218
225
|
updatedAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
219
226
|
isActive: z.boolean(),
|
|
220
227
|
isVerified: z.boolean(),
|
|
221
|
-
logo:
|
|
228
|
+
logo: mediaResourceSchema.optional().nullable(),
|
|
222
229
|
});
|
|
223
230
|
|
|
224
231
|
/**
|
|
@@ -246,7 +253,7 @@ export const createClinicGroupSchema = z.object({
|
|
|
246
253
|
contactPerson: contactPersonSchema,
|
|
247
254
|
ownerId: z.string().nullable(),
|
|
248
255
|
isActive: z.boolean(),
|
|
249
|
-
logo:
|
|
256
|
+
logo: mediaResourceSchema.optional().nullable(),
|
|
250
257
|
practiceType: z.nativeEnum(PracticeType).optional(),
|
|
251
258
|
languages: z.array(z.nativeEnum(Language)).optional(),
|
|
252
259
|
subscriptionModel: z
|
|
@@ -270,23 +277,23 @@ export const createClinicSchema = z.object({
|
|
|
270
277
|
contactInfo: clinicContactInfoSchema,
|
|
271
278
|
workingHours: workingHoursSchema,
|
|
272
279
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
273
|
-
coverPhoto:
|
|
280
|
+
coverPhoto: mediaResourceSchema.nullable().optional(),
|
|
274
281
|
photosWithTags: z
|
|
275
282
|
.array(
|
|
276
283
|
z.object({
|
|
277
|
-
url:
|
|
284
|
+
url: mediaResourceSchema,
|
|
278
285
|
tag: z.string(),
|
|
279
286
|
})
|
|
280
287
|
)
|
|
281
288
|
.optional(),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
admins: z.array(z.string()),
|
|
286
|
-
isActive: z.boolean(),
|
|
287
|
-
isVerified: z.boolean(),
|
|
288
|
-
logo:
|
|
289
|
-
featuredPhotos: z.array(
|
|
289
|
+
doctors: z.array(z.string()).optional().default([]),
|
|
290
|
+
procedures: z.array(z.string()).optional().default([]),
|
|
291
|
+
proceduresInfo: z.array(procedureSummaryInfoSchema).optional(),
|
|
292
|
+
admins: z.array(z.string()),
|
|
293
|
+
isActive: z.boolean().optional().default(true),
|
|
294
|
+
isVerified: z.boolean().optional().default(false),
|
|
295
|
+
logo: mediaResourceSchema.optional().nullable(),
|
|
296
|
+
featuredPhotos: z.array(mediaResourceSchema).optional().default([]),
|
|
290
297
|
});
|
|
291
298
|
|
|
292
299
|
/**
|
|
@@ -299,7 +306,7 @@ export const createDefaultClinicGroupSchema = z.object({
|
|
|
299
306
|
contactInfo: clinicContactInfoSchema,
|
|
300
307
|
hqLocation: clinicLocationSchema,
|
|
301
308
|
isActive: z.boolean(),
|
|
302
|
-
logo:
|
|
309
|
+
logo: mediaResourceSchema.optional().nullable(),
|
|
303
310
|
practiceType: z.nativeEnum(PracticeType).optional(),
|
|
304
311
|
languages: z.array(z.nativeEnum(Language)).optional(),
|
|
305
312
|
subscriptionModel: z
|
|
@@ -324,7 +331,7 @@ export const clinicAdminSignupSchema = z.object({
|
|
|
324
331
|
.object({
|
|
325
332
|
name: z.string(),
|
|
326
333
|
hqLocation: clinicLocationSchema,
|
|
327
|
-
logo:
|
|
334
|
+
logo: mediaResourceSchema.optional(),
|
|
328
335
|
contactInfo: clinicContactInfoSchema,
|
|
329
336
|
subscriptionModel: z
|
|
330
337
|
.nativeEnum(SubscriptionModel)
|
|
@@ -341,7 +348,7 @@ export const clinicGroupSetupSchema = z.object({
|
|
|
341
348
|
languages: z.array(z.nativeEnum(Language)),
|
|
342
349
|
practiceType: z.nativeEnum(PracticeType),
|
|
343
350
|
description: z.string(),
|
|
344
|
-
logo:
|
|
351
|
+
logo: mediaResourceSchema,
|
|
345
352
|
calendarSyncEnabled: z.boolean(),
|
|
346
353
|
autoConfirmAppointments: z.boolean(),
|
|
347
354
|
businessIdentificationNumber: z.string().optional().nullable(),
|
|
@@ -357,17 +364,17 @@ export const clinicBranchSetupSchema = z.object({
|
|
|
357
364
|
contactInfo: clinicContactInfoSchema,
|
|
358
365
|
workingHours: workingHoursSchema,
|
|
359
366
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
360
|
-
logo:
|
|
361
|
-
coverPhoto:
|
|
367
|
+
logo: mediaResourceSchema.optional(),
|
|
368
|
+
coverPhoto: mediaResourceSchema.nullable().optional(),
|
|
362
369
|
photosWithTags: z
|
|
363
370
|
.array(
|
|
364
371
|
z.object({
|
|
365
|
-
url:
|
|
372
|
+
url: mediaResourceSchema,
|
|
366
373
|
tag: z.string(),
|
|
367
374
|
})
|
|
368
375
|
)
|
|
369
376
|
.optional(),
|
|
370
|
-
featuredPhotos: z.array(
|
|
377
|
+
featuredPhotos: z.array(mediaResourceSchema).optional(),
|
|
371
378
|
});
|
|
372
379
|
|
|
373
380
|
/**
|
|
@@ -383,4 +390,27 @@ export const updateClinicGroupSchema = createClinicGroupSchema.partial();
|
|
|
383
390
|
/**
|
|
384
391
|
* Validaciona šema za updating clinic
|
|
385
392
|
*/
|
|
386
|
-
export const updateClinicSchema =
|
|
393
|
+
export const updateClinicSchema = z.object({
|
|
394
|
+
name: z.string().optional(),
|
|
395
|
+
description: z.string().optional(),
|
|
396
|
+
location: clinicLocationSchema.optional(),
|
|
397
|
+
contactInfo: clinicContactInfoSchema.optional(),
|
|
398
|
+
workingHours: workingHoursSchema.optional(),
|
|
399
|
+
tags: z.array(z.nativeEnum(ClinicTag)).optional(),
|
|
400
|
+
coverPhoto: mediaResourceSchema.nullable().optional(),
|
|
401
|
+
photosWithTags: z
|
|
402
|
+
.array(
|
|
403
|
+
z.object({
|
|
404
|
+
url: mediaResourceSchema,
|
|
405
|
+
tag: z.string(),
|
|
406
|
+
})
|
|
407
|
+
)
|
|
408
|
+
.optional(),
|
|
409
|
+
doctors: z.array(z.string()).optional(),
|
|
410
|
+
procedures: z.array(z.string()).optional(),
|
|
411
|
+
proceduresInfo: z.array(procedureSummaryInfoSchema).optional(),
|
|
412
|
+
isActive: z.boolean().optional(),
|
|
413
|
+
isVerified: z.boolean().optional(),
|
|
414
|
+
logo: mediaResourceSchema.optional().nullable(),
|
|
415
|
+
featuredPhotos: z.array(mediaResourceSchema).optional(),
|
|
416
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { UserRole } from "../types";
|
|
3
|
-
import { Timestamp, FieldValue
|
|
3
|
+
import { Timestamp, FieldValue } from "firebase/firestore";
|
|
4
4
|
|
|
5
5
|
export const emailSchema = z
|
|
6
6
|
.string()
|
|
@@ -24,41 +24,21 @@ export const userRolesSchema = z
|
|
|
24
24
|
.min(1, "User must have at least one role")
|
|
25
25
|
.max(3, "User cannot have more than 3 roles");
|
|
26
26
|
|
|
27
|
-
export const timestampSchema = z.custom<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// If data is null or undefined, it's not valid
|
|
31
|
-
if (data == null) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// If it's serverTimestamp (FieldValue), it's valid
|
|
36
|
-
if (typeof data === "object" && "isEqual" in data) {
|
|
27
|
+
export const timestampSchema = z.custom<Timestamp | FieldValue>((data) => {
|
|
28
|
+
// If it's a serverTimestamp (FieldValue), it's valid
|
|
29
|
+
if (data && typeof data === "object" && "isEqual" in data) {
|
|
37
30
|
return true;
|
|
38
31
|
}
|
|
39
32
|
|
|
40
33
|
// If it's a Timestamp object, validate its structure
|
|
41
|
-
|
|
34
|
+
return (
|
|
35
|
+
data &&
|
|
42
36
|
typeof data === "object" &&
|
|
43
37
|
"toDate" in data &&
|
|
44
38
|
"seconds" in data &&
|
|
45
39
|
"nanoseconds" in data
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// If it's the serverTimestamp function reference
|
|
51
|
-
if (data === serverTimestamp) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// If it's a function that returns FieldValue (serverTimestamp call)
|
|
56
|
-
if (typeof data === "function") {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return false;
|
|
61
|
-
}, "Must be a Timestamp object, FieldValue or serverTimestamp function");
|
|
40
|
+
);
|
|
41
|
+
}, "Must be a Timestamp object or serverTimestamp");
|
|
62
42
|
|
|
63
43
|
/**
|
|
64
44
|
* Validaciona šema za clinic admin opcije pri kreiranju
|