@blackcode_sa/metaestetics-api 1.4.1 → 1.4.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 +2841 -407
- package/dist/index.d.ts +2841 -407
- package/dist/index.js +1279 -970
- package/dist/index.mjs +1200 -893
- package/package.json +1 -1
- package/src/services/auth.service.ts +173 -0
- package/src/services/clinic/clinic-group.service.ts +34 -0
- package/src/services/clinic/clinic.service.ts +53 -0
- package/src/types/clinic/index.ts +165 -100
- package/src/types/clinic/preferences.types.ts +101 -0
- package/src/validations/clinic.schema.ts +162 -34
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Timestamp } from "firebase/firestore";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ClinicTag,
|
|
5
|
+
AdminTokenStatus,
|
|
6
|
+
SubscriptionModel,
|
|
7
|
+
PracticeType,
|
|
8
|
+
Language,
|
|
9
|
+
} from "../types/clinic";
|
|
4
10
|
import { ProcedureFamily } from "../backoffice/types/static/procedure-family.types";
|
|
5
11
|
import { TreatmentBenefit } from "../backoffice/types/static/treatment-benefit.types";
|
|
6
12
|
import {
|
|
@@ -14,8 +20,8 @@ import {
|
|
|
14
20
|
export const clinicContactInfoSchema = z.object({
|
|
15
21
|
email: z.string().email(),
|
|
16
22
|
phoneNumber: z.string(),
|
|
17
|
-
alternativePhoneNumber: z.string().nullable(),
|
|
18
|
-
website: z.string().nullable(),
|
|
23
|
+
alternativePhoneNumber: z.string().nullable().optional(),
|
|
24
|
+
website: z.string().nullable().optional(),
|
|
19
25
|
});
|
|
20
26
|
|
|
21
27
|
/**
|
|
@@ -28,7 +34,7 @@ export const clinicLocationSchema = z.object({
|
|
|
28
34
|
postalCode: z.string(),
|
|
29
35
|
latitude: z.number().min(-90).max(90),
|
|
30
36
|
longitude: z.number().min(-180).max(180),
|
|
31
|
-
geohash: z.string().nullable(),
|
|
37
|
+
geohash: z.string().nullable().optional(),
|
|
32
38
|
});
|
|
33
39
|
|
|
34
40
|
/**
|
|
@@ -37,16 +43,24 @@ export const clinicLocationSchema = z.object({
|
|
|
37
43
|
const workingHoursTimeSchema = z.object({
|
|
38
44
|
open: z.string(),
|
|
39
45
|
close: z.string(),
|
|
46
|
+
breaks: z
|
|
47
|
+
.array(
|
|
48
|
+
z.object({
|
|
49
|
+
start: z.string(),
|
|
50
|
+
end: z.string(),
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
.optional(),
|
|
40
54
|
});
|
|
41
55
|
|
|
42
56
|
export const workingHoursSchema = z.object({
|
|
43
|
-
monday: workingHoursTimeSchema,
|
|
44
|
-
tuesday: workingHoursTimeSchema,
|
|
45
|
-
wednesday: workingHoursTimeSchema,
|
|
46
|
-
thursday: workingHoursTimeSchema,
|
|
47
|
-
friday: workingHoursTimeSchema,
|
|
48
|
-
saturday: workingHoursTimeSchema,
|
|
49
|
-
sunday: workingHoursTimeSchema,
|
|
57
|
+
monday: workingHoursTimeSchema.nullable(),
|
|
58
|
+
tuesday: workingHoursTimeSchema.nullable(),
|
|
59
|
+
wednesday: workingHoursTimeSchema.nullable(),
|
|
60
|
+
thursday: workingHoursTimeSchema.nullable(),
|
|
61
|
+
friday: workingHoursTimeSchema.nullable(),
|
|
62
|
+
saturday: workingHoursTimeSchema.nullable(),
|
|
63
|
+
sunday: workingHoursTimeSchema.nullable(),
|
|
50
64
|
});
|
|
51
65
|
|
|
52
66
|
/**
|
|
@@ -83,7 +97,7 @@ export const clinicInfoSchema = z.object({
|
|
|
83
97
|
id: z.string(),
|
|
84
98
|
featuredPhoto: z.string(),
|
|
85
99
|
name: z.string(),
|
|
86
|
-
description: z.string().nullable(),
|
|
100
|
+
description: z.string().nullable().optional(),
|
|
87
101
|
location: clinicLocationSchema,
|
|
88
102
|
contactInfo: clinicContactInfoSchema,
|
|
89
103
|
});
|
|
@@ -94,7 +108,7 @@ export const clinicInfoSchema = z.object({
|
|
|
94
108
|
export const doctorInfoSchema = z.object({
|
|
95
109
|
id: z.string(),
|
|
96
110
|
name: z.string(),
|
|
97
|
-
description: z.string().nullable(),
|
|
111
|
+
description: z.string().nullable().optional(),
|
|
98
112
|
photo: z.string(),
|
|
99
113
|
rating: z.number().min(0).max(5),
|
|
100
114
|
services: z.array(z.string()),
|
|
@@ -106,7 +120,7 @@ export const doctorInfoSchema = z.object({
|
|
|
106
120
|
export const serviceInfoSchema = z.object({
|
|
107
121
|
id: z.string(),
|
|
108
122
|
name: z.string(),
|
|
109
|
-
description: z.string().nullable(),
|
|
123
|
+
description: z.string().nullable().optional(),
|
|
110
124
|
photo: z.string(),
|
|
111
125
|
procedureFamily: z.nativeEnum(ProcedureFamily),
|
|
112
126
|
category: z.string(),
|
|
@@ -131,8 +145,8 @@ export const reviewInfoSchema = z.object({
|
|
|
131
145
|
patientId: z.string(),
|
|
132
146
|
patientName: z.string(),
|
|
133
147
|
patientPhoto: z.string(),
|
|
134
|
-
createdAt: z.
|
|
135
|
-
updatedAt: z.
|
|
148
|
+
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
149
|
+
updatedAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
136
150
|
});
|
|
137
151
|
|
|
138
152
|
/**
|
|
@@ -147,8 +161,8 @@ export const clinicAdminSchema = z.object({
|
|
|
147
161
|
clinicsManagedInfo: z.array(clinicInfoSchema),
|
|
148
162
|
contactInfo: contactPersonSchema,
|
|
149
163
|
roleTitle: z.string(),
|
|
150
|
-
createdAt: z.
|
|
151
|
-
updatedAt: z.
|
|
164
|
+
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)),
|
|
165
|
+
updatedAt: z.instanceof(Date).or(z.instanceof(Timestamp)),
|
|
152
166
|
isActive: z.boolean(),
|
|
153
167
|
});
|
|
154
168
|
|
|
@@ -160,8 +174,8 @@ export const adminTokenSchema = z.object({
|
|
|
160
174
|
token: z.string(),
|
|
161
175
|
status: z.nativeEnum(AdminTokenStatus),
|
|
162
176
|
usedByUserRef: z.string().optional(),
|
|
163
|
-
createdAt: z.
|
|
164
|
-
expiresAt: z.
|
|
177
|
+
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
178
|
+
expiresAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
165
179
|
});
|
|
166
180
|
|
|
167
181
|
/**
|
|
@@ -177,7 +191,7 @@ export const createAdminTokenSchema = z.object({
|
|
|
177
191
|
export const clinicGroupSchema = z.object({
|
|
178
192
|
id: z.string(),
|
|
179
193
|
name: z.string(),
|
|
180
|
-
description: z.string().nullable(),
|
|
194
|
+
description: z.string().nullable().optional(),
|
|
181
195
|
hqLocation: clinicLocationSchema,
|
|
182
196
|
contactInfo: clinicContactInfoSchema,
|
|
183
197
|
contactPerson: contactPersonSchema,
|
|
@@ -187,9 +201,15 @@ export const clinicGroupSchema = z.object({
|
|
|
187
201
|
adminsInfo: z.array(adminInfoSchema),
|
|
188
202
|
adminTokens: z.array(adminTokenSchema),
|
|
189
203
|
ownerId: z.string(),
|
|
190
|
-
createdAt: z.
|
|
191
|
-
updatedAt: z.
|
|
204
|
+
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
205
|
+
updatedAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
192
206
|
isActive: z.boolean(),
|
|
207
|
+
logo: z.string().optional(),
|
|
208
|
+
practiceType: z.nativeEnum(PracticeType).optional(),
|
|
209
|
+
languages: z.array(z.nativeEnum(Language)).optional(),
|
|
210
|
+
subscriptionModel: z.nativeEnum(SubscriptionModel),
|
|
211
|
+
calendarSyncEnabled: z.boolean().optional(),
|
|
212
|
+
autoConfirmAppointments: z.boolean().optional(),
|
|
193
213
|
});
|
|
194
214
|
|
|
195
215
|
/**
|
|
@@ -201,8 +221,8 @@ export const clinicReviewSchema = z.object({
|
|
|
201
221
|
patientId: z.string(),
|
|
202
222
|
rating: z.number().min(1).max(5),
|
|
203
223
|
comment: z.string(),
|
|
204
|
-
createdAt: z.
|
|
205
|
-
updatedAt: z.
|
|
224
|
+
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
225
|
+
updatedAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
206
226
|
isVerified: z.boolean(),
|
|
207
227
|
});
|
|
208
228
|
|
|
@@ -213,13 +233,21 @@ export const clinicSchema = z.object({
|
|
|
213
233
|
id: z.string(),
|
|
214
234
|
clinicGroupId: z.string(),
|
|
215
235
|
name: z.string(),
|
|
216
|
-
description: z.string().nullable(),
|
|
236
|
+
description: z.string().nullable().optional(),
|
|
217
237
|
location: clinicLocationSchema,
|
|
218
238
|
contactInfo: clinicContactInfoSchema,
|
|
219
239
|
workingHours: workingHoursSchema,
|
|
220
240
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
221
241
|
featuredPhotos: z.array(z.string()),
|
|
222
242
|
photos: z.array(z.string()),
|
|
243
|
+
photosWithTags: z
|
|
244
|
+
.array(
|
|
245
|
+
z.object({
|
|
246
|
+
url: z.string(),
|
|
247
|
+
tag: z.string(),
|
|
248
|
+
})
|
|
249
|
+
)
|
|
250
|
+
.optional(),
|
|
223
251
|
doctors: z.array(z.string()),
|
|
224
252
|
doctorsInfo: z.array(doctorInfoSchema),
|
|
225
253
|
services: z.array(z.string()),
|
|
@@ -233,10 +261,11 @@ export const clinicSchema = z.object({
|
|
|
233
261
|
})
|
|
234
262
|
.nullable(),
|
|
235
263
|
admins: z.array(z.string()),
|
|
236
|
-
createdAt: z.
|
|
237
|
-
updatedAt: z.
|
|
264
|
+
createdAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
265
|
+
updatedAt: z.instanceof(Date).or(z.instanceof(Timestamp)), // Timestamp
|
|
238
266
|
isActive: z.boolean(),
|
|
239
267
|
isVerified: z.boolean(),
|
|
268
|
+
logo: z.string().optional(),
|
|
240
269
|
});
|
|
241
270
|
|
|
242
271
|
/**
|
|
@@ -257,12 +286,21 @@ export const createClinicAdminSchema = z.object({
|
|
|
257
286
|
*/
|
|
258
287
|
export const createClinicGroupSchema = z.object({
|
|
259
288
|
name: z.string(),
|
|
260
|
-
description: z.string().
|
|
289
|
+
description: z.string().optional(),
|
|
261
290
|
hqLocation: clinicLocationSchema,
|
|
262
291
|
contactInfo: clinicContactInfoSchema,
|
|
263
292
|
contactPerson: contactPersonSchema,
|
|
264
293
|
ownerId: z.string(),
|
|
265
294
|
isActive: z.boolean(),
|
|
295
|
+
logo: z.string().optional(),
|
|
296
|
+
practiceType: z.nativeEnum(PracticeType).optional(),
|
|
297
|
+
languages: z.array(z.nativeEnum(Language)).optional(),
|
|
298
|
+
subscriptionModel: z
|
|
299
|
+
.nativeEnum(SubscriptionModel)
|
|
300
|
+
.optional()
|
|
301
|
+
.default(SubscriptionModel.NO_SUBSCRIPTION),
|
|
302
|
+
calendarSyncEnabled: z.boolean().optional(),
|
|
303
|
+
autoConfirmAppointments: z.boolean().optional(),
|
|
266
304
|
});
|
|
267
305
|
|
|
268
306
|
/**
|
|
@@ -271,17 +309,27 @@ export const createClinicGroupSchema = z.object({
|
|
|
271
309
|
export const createClinicSchema = z.object({
|
|
272
310
|
clinicGroupId: z.string(),
|
|
273
311
|
name: z.string(),
|
|
274
|
-
description: z.string().
|
|
312
|
+
description: z.string().optional(),
|
|
275
313
|
location: clinicLocationSchema,
|
|
276
314
|
contactInfo: clinicContactInfoSchema,
|
|
277
315
|
workingHours: workingHoursSchema,
|
|
278
316
|
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
279
317
|
photos: z.array(z.string()),
|
|
318
|
+
photosWithTags: z
|
|
319
|
+
.array(
|
|
320
|
+
z.object({
|
|
321
|
+
url: z.string(),
|
|
322
|
+
tag: z.string(),
|
|
323
|
+
})
|
|
324
|
+
)
|
|
325
|
+
.optional(),
|
|
280
326
|
doctors: z.array(z.string()),
|
|
281
327
|
services: z.array(z.string()),
|
|
282
328
|
admins: z.array(z.string()),
|
|
283
329
|
isActive: z.boolean(),
|
|
284
330
|
isVerified: z.boolean(),
|
|
331
|
+
logo: z.string().optional(),
|
|
332
|
+
featuredPhotos: z.array(z.string()).optional(),
|
|
285
333
|
});
|
|
286
334
|
|
|
287
335
|
/**
|
|
@@ -291,10 +339,90 @@ export const createDefaultClinicGroupSchema = z.object({
|
|
|
291
339
|
name: z.string(),
|
|
292
340
|
ownerId: z.string(),
|
|
293
341
|
contactPerson: contactPersonSchema,
|
|
294
|
-
contactInfo:
|
|
295
|
-
email: z.string().email(),
|
|
296
|
-
phoneNumber: z.string(),
|
|
297
|
-
}),
|
|
342
|
+
contactInfo: clinicContactInfoSchema,
|
|
298
343
|
hqLocation: clinicLocationSchema,
|
|
299
344
|
isActive: z.boolean(),
|
|
345
|
+
logo: z.string().optional(),
|
|
346
|
+
practiceType: z.nativeEnum(PracticeType).optional(),
|
|
347
|
+
languages: z.array(z.nativeEnum(Language)).optional(),
|
|
348
|
+
subscriptionModel: z
|
|
349
|
+
.nativeEnum(SubscriptionModel)
|
|
350
|
+
.optional()
|
|
351
|
+
.default(SubscriptionModel.NO_SUBSCRIPTION),
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Validaciona šema za kreiranje administratora klinike
|
|
356
|
+
*/
|
|
357
|
+
export const clinicAdminSignupSchema = z.object({
|
|
358
|
+
email: z.string().email(),
|
|
359
|
+
password: z.string().min(8),
|
|
360
|
+
firstName: z.string(),
|
|
361
|
+
lastName: z.string(),
|
|
362
|
+
title: z.string(),
|
|
363
|
+
phoneNumber: z.string(),
|
|
364
|
+
isCreatingNewGroup: z.boolean(),
|
|
365
|
+
inviteToken: z.string().optional(),
|
|
366
|
+
clinicGroupData: z
|
|
367
|
+
.object({
|
|
368
|
+
name: z.string(),
|
|
369
|
+
hqLocation: clinicLocationSchema,
|
|
370
|
+
logo: z.string().optional(),
|
|
371
|
+
contactInfo: clinicContactInfoSchema,
|
|
372
|
+
subscriptionModel: z
|
|
373
|
+
.nativeEnum(SubscriptionModel)
|
|
374
|
+
.optional()
|
|
375
|
+
.default(SubscriptionModel.NO_SUBSCRIPTION),
|
|
376
|
+
})
|
|
377
|
+
.optional(),
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Validaciona šema za kreiranje grupacije klinika
|
|
382
|
+
*/
|
|
383
|
+
export const clinicGroupSetupSchema = z.object({
|
|
384
|
+
languages: z.array(z.nativeEnum(Language)),
|
|
385
|
+
practiceType: z.nativeEnum(PracticeType),
|
|
386
|
+
description: z.string(),
|
|
387
|
+
logo: z.string(),
|
|
388
|
+
calendarSyncEnabled: z.boolean(),
|
|
389
|
+
autoConfirmAppointments: z.boolean(),
|
|
300
390
|
});
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Validaciona šema za kreiranje klinike
|
|
394
|
+
*/
|
|
395
|
+
export const clinicBranchSetupSchema = z.object({
|
|
396
|
+
name: z.string(),
|
|
397
|
+
location: clinicLocationSchema,
|
|
398
|
+
description: z.string().optional(),
|
|
399
|
+
contactInfo: clinicContactInfoSchema,
|
|
400
|
+
workingHours: workingHoursSchema,
|
|
401
|
+
tags: z.array(z.nativeEnum(ClinicTag)),
|
|
402
|
+
logo: z.string().optional(),
|
|
403
|
+
photos: z.array(z.string()),
|
|
404
|
+
photosWithTags: z
|
|
405
|
+
.array(
|
|
406
|
+
z.object({
|
|
407
|
+
url: z.string(),
|
|
408
|
+
tag: z.string(),
|
|
409
|
+
})
|
|
410
|
+
)
|
|
411
|
+
.optional(),
|
|
412
|
+
featuredPhotos: z.array(z.string()).optional(),
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Validaciona šema za updating clinic admin
|
|
417
|
+
*/
|
|
418
|
+
export const updateClinicAdminSchema = createClinicAdminSchema.partial();
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Validaciona šema za updating clinic group
|
|
422
|
+
*/
|
|
423
|
+
export const updateClinicGroupSchema = createClinicGroupSchema.partial();
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Validaciona šema za updating clinic
|
|
427
|
+
*/
|
|
428
|
+
export const updateClinicSchema = createClinicSchema.partial();
|