@blackcode_sa/metaestetics-api 1.12.20 → 1.12.21
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 +13 -3
- package/dist/admin/index.d.ts +13 -3
- package/dist/admin/index.js +194 -180
- package/dist/admin/index.mjs +194 -180
- package/dist/index.d.mts +51 -7
- package/dist/index.d.ts +51 -7
- package/dist/index.js +2087 -1888
- package/dist/index.mjs +2158 -1959
- package/package.json +1 -1
- package/src/admin/aggregation/appointment/appointment.aggregation.service.ts +459 -457
- package/src/services/appointment/appointment.service.ts +297 -0
- package/src/services/reviews/reviews.service.ts +30 -71
- package/src/types/appointment/index.ts +11 -0
- package/src/types/reviews/index.ts +0 -3
- package/src/validations/appointment.schema.ts +38 -18
|
@@ -25,7 +25,7 @@ export const appointmentMediaItemSchema = z.object({
|
|
|
25
25
|
uploadedAt: z
|
|
26
26
|
.any()
|
|
27
27
|
.refine(
|
|
28
|
-
|
|
28
|
+
val =>
|
|
29
29
|
val instanceof Date ||
|
|
30
30
|
val?._seconds !== undefined ||
|
|
31
31
|
val?.seconds !== undefined ||
|
|
@@ -69,7 +69,7 @@ export const linkedFormInfoSchema = z.object({
|
|
|
69
69
|
submittedAt: z
|
|
70
70
|
.any()
|
|
71
71
|
.refine(
|
|
72
|
-
|
|
72
|
+
val =>
|
|
73
73
|
val === undefined ||
|
|
74
74
|
val instanceof Date ||
|
|
75
75
|
val?._seconds !== undefined ||
|
|
@@ -83,7 +83,7 @@ export const linkedFormInfoSchema = z.object({
|
|
|
83
83
|
completedAt: z
|
|
84
84
|
.any()
|
|
85
85
|
.refine(
|
|
86
|
-
|
|
86
|
+
val =>
|
|
87
87
|
val === undefined ||
|
|
88
88
|
val instanceof Date ||
|
|
89
89
|
val?._seconds !== undefined ||
|
|
@@ -103,7 +103,7 @@ export const patientReviewInfoSchema = z.object({
|
|
|
103
103
|
reviewedAt: z
|
|
104
104
|
.any()
|
|
105
105
|
.refine(
|
|
106
|
-
|
|
106
|
+
val =>
|
|
107
107
|
val instanceof Date ||
|
|
108
108
|
val?._seconds !== undefined ||
|
|
109
109
|
val?.seconds !== undefined ||
|
|
@@ -119,7 +119,7 @@ export const finalizedDetailsSchema = z.object({
|
|
|
119
119
|
at: z
|
|
120
120
|
.any()
|
|
121
121
|
.refine(
|
|
122
|
-
|
|
122
|
+
val =>
|
|
123
123
|
val instanceof Date ||
|
|
124
124
|
val?._seconds !== undefined ||
|
|
125
125
|
val?.seconds !== undefined ||
|
|
@@ -194,7 +194,7 @@ export const createAppointmentSchema = z
|
|
|
194
194
|
appointmentStartTime: z
|
|
195
195
|
.any()
|
|
196
196
|
.refine(
|
|
197
|
-
|
|
197
|
+
val =>
|
|
198
198
|
val instanceof Date ||
|
|
199
199
|
val?._seconds !== undefined ||
|
|
200
200
|
val?.seconds !== undefined ||
|
|
@@ -206,7 +206,7 @@ export const createAppointmentSchema = z
|
|
|
206
206
|
appointmentEndTime: z
|
|
207
207
|
.any()
|
|
208
208
|
.refine(
|
|
209
|
-
|
|
209
|
+
val =>
|
|
210
210
|
val instanceof Date ||
|
|
211
211
|
val?._seconds !== undefined ||
|
|
212
212
|
val?.seconds !== undefined ||
|
|
@@ -222,7 +222,7 @@ export const createAppointmentSchema = z
|
|
|
222
222
|
initialPaymentStatus: paymentStatusSchema.optional().default(PaymentStatus.UNPAID),
|
|
223
223
|
clinic_tz: z.string().min(1, 'Timezone is required'),
|
|
224
224
|
})
|
|
225
|
-
.refine(
|
|
225
|
+
.refine(data => data.appointmentEndTime > data.appointmentStartTime, {
|
|
226
226
|
message: 'Appointment end time must be after start time',
|
|
227
227
|
path: ['appointmentEndTime'],
|
|
228
228
|
});
|
|
@@ -263,7 +263,7 @@ export const updateAppointmentSchema = z
|
|
|
263
263
|
appointmentStartTime: z
|
|
264
264
|
.any()
|
|
265
265
|
.refine(
|
|
266
|
-
|
|
266
|
+
val =>
|
|
267
267
|
val === undefined ||
|
|
268
268
|
val instanceof Date ||
|
|
269
269
|
val?._seconds !== undefined ||
|
|
@@ -277,7 +277,7 @@ export const updateAppointmentSchema = z
|
|
|
277
277
|
appointmentEndTime: z
|
|
278
278
|
.any()
|
|
279
279
|
.refine(
|
|
280
|
-
|
|
280
|
+
val =>
|
|
281
281
|
val === undefined ||
|
|
282
282
|
val instanceof Date ||
|
|
283
283
|
val?._seconds !== undefined ||
|
|
@@ -302,7 +302,7 @@ export const updateAppointmentSchema = z
|
|
|
302
302
|
metadata: appointmentMetadataSchema.optional(),
|
|
303
303
|
})
|
|
304
304
|
.refine(
|
|
305
|
-
|
|
305
|
+
data => {
|
|
306
306
|
if (
|
|
307
307
|
data.status === AppointmentStatus.CANCELED_CLINIC ||
|
|
308
308
|
data.status === AppointmentStatus.CANCELED_PATIENT ||
|
|
@@ -319,7 +319,7 @@ export const updateAppointmentSchema = z
|
|
|
319
319
|
},
|
|
320
320
|
)
|
|
321
321
|
.refine(
|
|
322
|
-
|
|
322
|
+
data => {
|
|
323
323
|
if (data.appointmentStartTime && data.appointmentEndTime) {
|
|
324
324
|
return data.appointmentEndTime > data.appointmentStartTime;
|
|
325
325
|
}
|
|
@@ -342,7 +342,7 @@ export const searchAppointmentsSchema = z
|
|
|
342
342
|
startDate: z
|
|
343
343
|
.any()
|
|
344
344
|
.refine(
|
|
345
|
-
|
|
345
|
+
val =>
|
|
346
346
|
val === undefined ||
|
|
347
347
|
val instanceof Date ||
|
|
348
348
|
val?._seconds !== undefined ||
|
|
@@ -356,7 +356,7 @@ export const searchAppointmentsSchema = z
|
|
|
356
356
|
endDate: z
|
|
357
357
|
.any()
|
|
358
358
|
.refine(
|
|
359
|
-
|
|
359
|
+
val =>
|
|
360
360
|
val === undefined ||
|
|
361
361
|
val instanceof Date ||
|
|
362
362
|
val?._seconds !== undefined ||
|
|
@@ -374,7 +374,7 @@ export const searchAppointmentsSchema = z
|
|
|
374
374
|
startAfter: z.any().optional(),
|
|
375
375
|
})
|
|
376
376
|
.refine(
|
|
377
|
-
|
|
377
|
+
data => {
|
|
378
378
|
if (!data.startDate && !data.endDate && !data.status) {
|
|
379
379
|
return !!(data.patientId || data.practitionerId || data.clinicBranchId);
|
|
380
380
|
}
|
|
@@ -387,7 +387,7 @@ export const searchAppointmentsSchema = z
|
|
|
387
387
|
},
|
|
388
388
|
)
|
|
389
389
|
.refine(
|
|
390
|
-
|
|
390
|
+
data => {
|
|
391
391
|
if (data.startDate && data.endDate) {
|
|
392
392
|
return data.endDate >= data.startDate;
|
|
393
393
|
}
|
|
@@ -407,7 +407,7 @@ export const rescheduleAppointmentSchema = z.object({
|
|
|
407
407
|
newStartTime: z
|
|
408
408
|
.any()
|
|
409
409
|
.refine(
|
|
410
|
-
|
|
410
|
+
val =>
|
|
411
411
|
val instanceof Date ||
|
|
412
412
|
val?._seconds !== undefined ||
|
|
413
413
|
val?.seconds !== undefined ||
|
|
@@ -419,7 +419,7 @@ export const rescheduleAppointmentSchema = z.object({
|
|
|
419
419
|
newEndTime: z
|
|
420
420
|
.any()
|
|
421
421
|
.refine(
|
|
422
|
-
|
|
422
|
+
val =>
|
|
423
423
|
val instanceof Date ||
|
|
424
424
|
val?._seconds !== undefined ||
|
|
425
425
|
val?.seconds !== undefined ||
|
|
@@ -429,3 +429,23 @@ export const rescheduleAppointmentSchema = z.object({
|
|
|
429
429
|
'New end time must be a valid timestamp, Date object, number, or string',
|
|
430
430
|
),
|
|
431
431
|
});
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Schema for validating zone photo upload data
|
|
435
|
+
*/
|
|
436
|
+
export const zonePhotoUploadSchema = z.object({
|
|
437
|
+
appointmentId: z.string().min(MIN_STRING_LENGTH, 'Appointment ID is required'),
|
|
438
|
+
zoneId: z.string().min(MIN_STRING_LENGTH, 'Zone ID is required'),
|
|
439
|
+
photoType: z.enum(['before', 'after'], {
|
|
440
|
+
required_error: 'Photo type must be either "before" or "after"',
|
|
441
|
+
}),
|
|
442
|
+
file: z.any().refine(file => {
|
|
443
|
+
// Check if it's a File or Blob object
|
|
444
|
+
return (
|
|
445
|
+
file instanceof File ||
|
|
446
|
+
file instanceof Blob ||
|
|
447
|
+
(file && typeof file.size === 'number' && typeof file.type === 'string')
|
|
448
|
+
);
|
|
449
|
+
}, 'File must be a valid File or Blob object'),
|
|
450
|
+
notes: z.string().max(MAX_STRING_LENGTH_LONG, 'Notes too long').optional(),
|
|
451
|
+
});
|