@bizmap/sdk 0.0.32 → 0.0.34
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/main.d.ts +74 -36
- package/dist/main.js +34 -56
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -112,6 +112,7 @@ declare const CompanyUser: z.ZodObject<{
|
|
|
112
112
|
cshr: "cshr";
|
|
113
113
|
admin: "admin";
|
|
114
114
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
115
|
+
totalAppts: z.ZodDefault<z.ZodInt>;
|
|
115
116
|
lastActive: z.ZodInt;
|
|
116
117
|
name: z.ZodRecord<z.ZodEnum<{
|
|
117
118
|
first: "first";
|
|
@@ -148,13 +149,13 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
148
149
|
availableBalance: z.ZodNumber;
|
|
149
150
|
totalUploads: z.ZodNumber;
|
|
150
151
|
lastInvoiceNo: z.ZodNullable<z.ZodString>;
|
|
151
|
-
lastTktNo: z.
|
|
152
|
+
lastTktNo: z.ZodNumber;
|
|
152
153
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
153
154
|
}, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
154
155
|
availableBalance: z.ZodNumber;
|
|
155
156
|
totalUploads: z.ZodNumber;
|
|
156
157
|
lastInvoiceNo: z.ZodNullable<z.ZodString>;
|
|
157
|
-
lastTktNo: z.
|
|
158
|
+
lastTktNo: z.ZodNumber;
|
|
158
159
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
159
160
|
}, z.core.$strip>>>;
|
|
160
161
|
preferences: z.ZodObject<{
|
|
@@ -250,7 +251,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
250
251
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
251
252
|
}, z.core.$strip>>>;
|
|
252
253
|
staffDetails: z.ZodPipe<z.ZodObject<{
|
|
253
|
-
members: z.
|
|
254
|
+
members: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
254
255
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
255
256
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
256
257
|
uid: z.ZodReadonly<z.ZodString>;
|
|
@@ -270,6 +271,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
270
271
|
cshr: "cshr";
|
|
271
272
|
admin: "admin";
|
|
272
273
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
274
|
+
totalAppts: z.ZodDefault<z.ZodInt>;
|
|
273
275
|
lastActive: z.ZodInt;
|
|
274
276
|
name: z.ZodRecord<z.ZodEnum<{
|
|
275
277
|
first: "first";
|
|
@@ -280,10 +282,12 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
280
282
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
281
283
|
}, z.core.$strip>>;
|
|
282
284
|
partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
|
|
283
|
-
blackList: z.
|
|
285
|
+
blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
286
|
+
addedAt: z.ZodInt;
|
|
287
|
+
}, z.core.$strip>>;
|
|
284
288
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
285
289
|
}, z.core.$strip>, z.ZodTransform<{
|
|
286
|
-
members: {
|
|
290
|
+
members: Record<string, {
|
|
287
291
|
createdAt: number;
|
|
288
292
|
uid: string;
|
|
289
293
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -292,18 +296,21 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
292
296
|
lastModified: number | null;
|
|
293
297
|
};
|
|
294
298
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
299
|
+
totalAppts: number;
|
|
295
300
|
lastActive: number;
|
|
296
301
|
name: Record<"first" | "last", string>;
|
|
297
302
|
email: string;
|
|
298
303
|
lastModified?: number | null | undefined;
|
|
299
304
|
photoUrl?: string | null | undefined;
|
|
300
305
|
phoneNumber?: string | undefined;
|
|
301
|
-
}
|
|
306
|
+
}>;
|
|
302
307
|
partnerMap: Record<string, string[]>;
|
|
303
|
-
blackList: string
|
|
308
|
+
blackList: Record<string, {
|
|
309
|
+
addedAt: number;
|
|
310
|
+
}>;
|
|
304
311
|
lastModified: number | null;
|
|
305
312
|
}, {
|
|
306
|
-
members: {
|
|
313
|
+
members: Record<string, {
|
|
307
314
|
createdAt: number;
|
|
308
315
|
uid: string;
|
|
309
316
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -312,18 +319,21 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
312
319
|
lastModified: number | null;
|
|
313
320
|
};
|
|
314
321
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
322
|
+
totalAppts: number;
|
|
315
323
|
lastActive: number;
|
|
316
324
|
name: Record<"first" | "last", string>;
|
|
317
325
|
email: string;
|
|
318
326
|
lastModified?: number | null | undefined;
|
|
319
327
|
photoUrl?: string | null | undefined;
|
|
320
328
|
phoneNumber?: string | undefined;
|
|
321
|
-
}
|
|
329
|
+
}>;
|
|
322
330
|
partnerMap: Record<string, string[]>;
|
|
323
|
-
blackList: string
|
|
331
|
+
blackList: Record<string, {
|
|
332
|
+
addedAt: number;
|
|
333
|
+
}>;
|
|
324
334
|
lastModified: number | null;
|
|
325
335
|
}>> | z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
|
|
326
|
-
members: z.
|
|
336
|
+
members: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
327
337
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
328
338
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
329
339
|
uid: z.ZodReadonly<z.ZodString>;
|
|
@@ -343,6 +353,7 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
343
353
|
cshr: "cshr";
|
|
344
354
|
admin: "admin";
|
|
345
355
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
356
|
+
totalAppts: z.ZodDefault<z.ZodInt>;
|
|
346
357
|
lastActive: z.ZodInt;
|
|
347
358
|
name: z.ZodRecord<z.ZodEnum<{
|
|
348
359
|
first: "first";
|
|
@@ -353,10 +364,12 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
353
364
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
354
365
|
}, z.core.$strip>>;
|
|
355
366
|
partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
|
|
356
|
-
blackList: z.
|
|
367
|
+
blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
368
|
+
addedAt: z.ZodInt;
|
|
369
|
+
}, z.core.$strip>>;
|
|
357
370
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
358
371
|
}, z.core.$strip>, z.ZodTransform<{
|
|
359
|
-
members: {
|
|
372
|
+
members: Record<string, {
|
|
360
373
|
createdAt: number;
|
|
361
374
|
uid: string;
|
|
362
375
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -365,18 +378,21 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
365
378
|
lastModified: number | null;
|
|
366
379
|
};
|
|
367
380
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
381
|
+
totalAppts: number;
|
|
368
382
|
lastActive: number;
|
|
369
383
|
name: Record<"first" | "last", string>;
|
|
370
384
|
email: string;
|
|
371
385
|
lastModified?: number | null | undefined;
|
|
372
386
|
photoUrl?: string | null | undefined;
|
|
373
387
|
phoneNumber?: string | undefined;
|
|
374
|
-
}
|
|
388
|
+
}>;
|
|
375
389
|
partnerMap: Record<string, string[]>;
|
|
376
|
-
blackList: string
|
|
390
|
+
blackList: Record<string, {
|
|
391
|
+
addedAt: number;
|
|
392
|
+
}>;
|
|
377
393
|
lastModified: number | null;
|
|
378
394
|
}, {
|
|
379
|
-
members: {
|
|
395
|
+
members: Record<string, {
|
|
380
396
|
createdAt: number;
|
|
381
397
|
uid: string;
|
|
382
398
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -385,15 +401,18 @@ declare const CompanyDetails: z.ZodObject<{
|
|
|
385
401
|
lastModified: number | null;
|
|
386
402
|
};
|
|
387
403
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
404
|
+
totalAppts: number;
|
|
388
405
|
lastActive: number;
|
|
389
406
|
name: Record<"first" | "last", string>;
|
|
390
407
|
email: string;
|
|
391
408
|
lastModified?: number | null | undefined;
|
|
392
409
|
photoUrl?: string | null | undefined;
|
|
393
410
|
phoneNumber?: string | undefined;
|
|
394
|
-
}
|
|
411
|
+
}>;
|
|
395
412
|
partnerMap: Record<string, string[]>;
|
|
396
|
-
blackList: string
|
|
413
|
+
blackList: Record<string, {
|
|
414
|
+
addedAt: number;
|
|
415
|
+
}>;
|
|
397
416
|
lastModified: number | null;
|
|
398
417
|
}>>>>;
|
|
399
418
|
createdAt: z.ZodInt | z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
@@ -425,13 +444,13 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
425
444
|
availableBalance: z.ZodNumber;
|
|
426
445
|
totalUploads: z.ZodNumber;
|
|
427
446
|
lastInvoiceNo: z.ZodNullable<z.ZodString>;
|
|
428
|
-
lastTktNo: z.
|
|
447
|
+
lastTktNo: z.ZodNumber;
|
|
429
448
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
430
449
|
}, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
431
450
|
availableBalance: z.ZodNumber;
|
|
432
451
|
totalUploads: z.ZodNumber;
|
|
433
452
|
lastInvoiceNo: z.ZodNullable<z.ZodString>;
|
|
434
|
-
lastTktNo: z.
|
|
453
|
+
lastTktNo: z.ZodNumber;
|
|
435
454
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
436
455
|
}, z.core.$strip>>>;
|
|
437
456
|
preferences: z.ZodObject<{
|
|
@@ -527,7 +546,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
527
546
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
528
547
|
}, z.core.$strip>>>;
|
|
529
548
|
staffDetails: z.ZodPipe<z.ZodObject<{
|
|
530
|
-
members: z.
|
|
549
|
+
members: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
531
550
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
532
551
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
533
552
|
uid: z.ZodReadonly<z.ZodString>;
|
|
@@ -547,6 +566,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
547
566
|
cshr: "cshr";
|
|
548
567
|
admin: "admin";
|
|
549
568
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
569
|
+
totalAppts: z.ZodDefault<z.ZodInt>;
|
|
550
570
|
lastActive: z.ZodInt;
|
|
551
571
|
name: z.ZodRecord<z.ZodEnum<{
|
|
552
572
|
first: "first";
|
|
@@ -557,10 +577,12 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
557
577
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
558
578
|
}, z.core.$strip>>;
|
|
559
579
|
partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
|
|
560
|
-
blackList: z.
|
|
580
|
+
blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
581
|
+
addedAt: z.ZodInt;
|
|
582
|
+
}, z.core.$strip>>;
|
|
561
583
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
562
584
|
}, z.core.$strip>, z.ZodTransform<{
|
|
563
|
-
members: {
|
|
585
|
+
members: Record<string, {
|
|
564
586
|
createdAt: number;
|
|
565
587
|
uid: string;
|
|
566
588
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -569,18 +591,21 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
569
591
|
lastModified: number | null;
|
|
570
592
|
};
|
|
571
593
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
594
|
+
totalAppts: number;
|
|
572
595
|
lastActive: number;
|
|
573
596
|
name: Record<"first" | "last", string>;
|
|
574
597
|
email: string;
|
|
575
598
|
lastModified?: number | null | undefined;
|
|
576
599
|
photoUrl?: string | null | undefined;
|
|
577
600
|
phoneNumber?: string | undefined;
|
|
578
|
-
}
|
|
601
|
+
}>;
|
|
579
602
|
partnerMap: Record<string, string[]>;
|
|
580
|
-
blackList: string
|
|
603
|
+
blackList: Record<string, {
|
|
604
|
+
addedAt: number;
|
|
605
|
+
}>;
|
|
581
606
|
lastModified: number | null;
|
|
582
607
|
}, {
|
|
583
|
-
members: {
|
|
608
|
+
members: Record<string, {
|
|
584
609
|
createdAt: number;
|
|
585
610
|
uid: string;
|
|
586
611
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -589,18 +614,21 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
589
614
|
lastModified: number | null;
|
|
590
615
|
};
|
|
591
616
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
617
|
+
totalAppts: number;
|
|
592
618
|
lastActive: number;
|
|
593
619
|
name: Record<"first" | "last", string>;
|
|
594
620
|
email: string;
|
|
595
621
|
lastModified?: number | null | undefined;
|
|
596
622
|
photoUrl?: string | null | undefined;
|
|
597
623
|
phoneNumber?: string | undefined;
|
|
598
|
-
}
|
|
624
|
+
}>;
|
|
599
625
|
partnerMap: Record<string, string[]>;
|
|
600
|
-
blackList: string
|
|
626
|
+
blackList: Record<string, {
|
|
627
|
+
addedAt: number;
|
|
628
|
+
}>;
|
|
601
629
|
lastModified: number | null;
|
|
602
630
|
}>> | z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
|
|
603
|
-
members: z.
|
|
631
|
+
members: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
604
632
|
createdAt: z.ZodReadonly<z.ZodInt>;
|
|
605
633
|
lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
606
634
|
uid: z.ZodReadonly<z.ZodString>;
|
|
@@ -620,6 +648,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
620
648
|
cshr: "cshr";
|
|
621
649
|
admin: "admin";
|
|
622
650
|
}>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
|
|
651
|
+
totalAppts: z.ZodDefault<z.ZodInt>;
|
|
623
652
|
lastActive: z.ZodInt;
|
|
624
653
|
name: z.ZodRecord<z.ZodEnum<{
|
|
625
654
|
first: "first";
|
|
@@ -630,10 +659,12 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
630
659
|
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
631
660
|
}, z.core.$strip>>;
|
|
632
661
|
partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
|
|
633
|
-
blackList: z.
|
|
662
|
+
blackList: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodObject<{
|
|
663
|
+
addedAt: z.ZodInt;
|
|
664
|
+
}, z.core.$strip>>;
|
|
634
665
|
lastModified: z.ZodNullable<z.ZodInt>;
|
|
635
666
|
}, z.core.$strip>, z.ZodTransform<{
|
|
636
|
-
members: {
|
|
667
|
+
members: Record<string, {
|
|
637
668
|
createdAt: number;
|
|
638
669
|
uid: string;
|
|
639
670
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -642,18 +673,21 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
642
673
|
lastModified: number | null;
|
|
643
674
|
};
|
|
644
675
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
676
|
+
totalAppts: number;
|
|
645
677
|
lastActive: number;
|
|
646
678
|
name: Record<"first" | "last", string>;
|
|
647
679
|
email: string;
|
|
648
680
|
lastModified?: number | null | undefined;
|
|
649
681
|
photoUrl?: string | null | undefined;
|
|
650
682
|
phoneNumber?: string | undefined;
|
|
651
|
-
}
|
|
683
|
+
}>;
|
|
652
684
|
partnerMap: Record<string, string[]>;
|
|
653
|
-
blackList: string
|
|
685
|
+
blackList: Record<string, {
|
|
686
|
+
addedAt: number;
|
|
687
|
+
}>;
|
|
654
688
|
lastModified: number | null;
|
|
655
689
|
}, {
|
|
656
|
-
members: {
|
|
690
|
+
members: Record<string, {
|
|
657
691
|
createdAt: number;
|
|
658
692
|
uid: string;
|
|
659
693
|
status: "inviteSent" | "active" | "inactive";
|
|
@@ -662,15 +696,18 @@ declare const PartialCompanyDetails: z.ZodObject<{
|
|
|
662
696
|
lastModified: number | null;
|
|
663
697
|
};
|
|
664
698
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
699
|
+
totalAppts: number;
|
|
665
700
|
lastActive: number;
|
|
666
701
|
name: Record<"first" | "last", string>;
|
|
667
702
|
email: string;
|
|
668
703
|
lastModified?: number | null | undefined;
|
|
669
704
|
photoUrl?: string | null | undefined;
|
|
670
705
|
phoneNumber?: string | undefined;
|
|
671
|
-
}
|
|
706
|
+
}>;
|
|
672
707
|
partnerMap: Record<string, string[]>;
|
|
673
|
-
blackList: string
|
|
708
|
+
blackList: Record<string, {
|
|
709
|
+
addedAt: number;
|
|
710
|
+
}>;
|
|
674
711
|
lastModified: number | null;
|
|
675
712
|
}>>>>;
|
|
676
713
|
createdAt: z.ZodInt | z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
@@ -724,6 +761,7 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
|
|
|
724
761
|
lastModified: number | null;
|
|
725
762
|
};
|
|
726
763
|
roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
|
|
764
|
+
totalAppts: number;
|
|
727
765
|
lastActive: number;
|
|
728
766
|
name: Record<"first" | "last", string>;
|
|
729
767
|
email: string;
|
package/dist/main.js
CHANGED
|
@@ -112,12 +112,19 @@ var CompanyUser = z4.object({
|
|
|
112
112
|
(role, i) => i === 0 || compatibleRoles.includes(role)
|
|
113
113
|
);
|
|
114
114
|
}, "A user is not allowed to have conflicting roles."),
|
|
115
|
+
/** This should reset at the end of every cycle. */
|
|
116
|
+
totalAppts: z4.int().positive().default(0),
|
|
115
117
|
lastActive: Timestamp,
|
|
116
118
|
...TimeLog.shape
|
|
117
119
|
}).superRefine((data, ctx) => {
|
|
118
120
|
if (!data.availability.isAvailable && data.status !== "active") {
|
|
119
121
|
ctx.addIssue('Unavailable users MUST also have the "active" status.');
|
|
120
122
|
}
|
|
123
|
+
if (!data.availability.isAvailable && !data.roles.some((role) => role === "doc" || role === "physAsst")) {
|
|
124
|
+
ctx.addIssue(
|
|
125
|
+
'Only users with the "doc" or "physAsst" role can be marked as unavailable.'
|
|
126
|
+
);
|
|
127
|
+
}
|
|
121
128
|
});
|
|
122
129
|
var CompanyIdentity = z4.object({
|
|
123
130
|
displayName: z4.string().min(3).max(20),
|
|
@@ -147,10 +154,9 @@ var CompanyState = z4.object({
|
|
|
147
154
|
* @note This should only be null when the cycle resets
|
|
148
155
|
*/
|
|
149
156
|
lastInvoiceNo: InvoiceNo.nullable(),
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
lastTktNo: z4.number().positive().nullable(),
|
|
157
|
+
/** A counter for the company's ticket no. */
|
|
158
|
+
lastTktNo: z4.number().positive(),
|
|
159
|
+
// distAppts: z.record(CompanyUser.shape.uid, z.number().positive().nullable()),
|
|
154
160
|
lastModified: Timestamp.nullable()
|
|
155
161
|
});
|
|
156
162
|
var CompanyPreferences = z4.object({
|
|
@@ -208,43 +214,29 @@ var CompanyBillingModel = z4.object({
|
|
|
208
214
|
}
|
|
209
215
|
});
|
|
210
216
|
var StaffDetails = z4.object({
|
|
211
|
-
members: z4.
|
|
212
|
-
const duplicateUids = [];
|
|
213
|
-
const duplicateEmails = [];
|
|
214
|
-
const uids = [];
|
|
217
|
+
members: z4.record(CompanyUser.shape.uid, CompanyUser).superRefine((data, ctx) => {
|
|
215
218
|
const emails = [];
|
|
216
|
-
for (const user of
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
for (const [uid, user] of Object.entries(data)) {
|
|
220
|
+
if (uid !== user.uid) {
|
|
221
|
+
ctx.addIssue(
|
|
222
|
+
`User found with a uid that doesn't match their respective key. (${uid} !== ${user.uid}).`
|
|
223
|
+
);
|
|
221
224
|
}
|
|
222
|
-
if (emails.includes(user.email)) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
if (!!user.email && emails.includes(user.email.toLowerCase())) {
|
|
226
|
+
ctx.addIssue(
|
|
227
|
+
`Having multiple members with the same email is prohibited. (${user.email})`
|
|
228
|
+
);
|
|
229
|
+
} else if (!!user.email) {
|
|
230
|
+
emails.push(user.email.toLowerCase());
|
|
226
231
|
}
|
|
227
232
|
}
|
|
228
|
-
if (duplicateUids.length > 0) {
|
|
229
|
-
ctx.addIssue(
|
|
230
|
-
`Having multiple members with the same uid is prohibited (${duplicateUids.join()}).`
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
if (duplicateEmails.length > 0) {
|
|
234
|
-
ctx.addIssue(
|
|
235
|
-
`Having multiple members with the same email is prohibited (${duplicateEmails.join()}).`
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
233
|
}),
|
|
239
234
|
/**
|
|
240
235
|
* @relationship one -> many
|
|
241
236
|
*@description A map of doctor `uids` to their assistants `uids` */
|
|
242
237
|
partnerMap: z4.record(
|
|
243
238
|
CompanyUser.shape.uid,
|
|
244
|
-
z4.array(CompanyUser.shape.uid).
|
|
245
|
-
1,
|
|
246
|
-
"At least (1) partner, excluding the leader, is required to create a partner group."
|
|
247
|
-
).transform((pUids) => {
|
|
239
|
+
z4.array(CompanyUser.shape.uid).transform((pUids) => {
|
|
248
240
|
const partners = [];
|
|
249
241
|
for (const uid of pUids) {
|
|
250
242
|
if (!uid || typeof uid !== "string") continue;
|
|
@@ -255,35 +247,21 @@ var StaffDetails = z4.object({
|
|
|
255
247
|
return partners.sort();
|
|
256
248
|
})
|
|
257
249
|
),
|
|
258
|
-
blackList: z4.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (!newList.some(
|
|
263
|
-
(newUid) => newUid.toLowerCase() === uid.toLowerCase()
|
|
264
|
-
)) {
|
|
265
|
-
newList.push(uid);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
return newList.sort();
|
|
269
|
-
}),
|
|
250
|
+
blackList: z4.record(
|
|
251
|
+
CompanyUser.shape.uid,
|
|
252
|
+
z4.object({ addedAt: Timestamp })
|
|
253
|
+
),
|
|
270
254
|
lastModified: Timestamp.nullable()
|
|
271
255
|
}).transform((d) => {
|
|
272
|
-
|
|
273
|
-
for (const uid of
|
|
274
|
-
if (
|
|
275
|
-
|
|
276
|
-
blackListWithExisitingUsers.push(uid);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (blackListWithExisitingUsers.length !== d.blackList.length) {
|
|
280
|
-
d.blackList = blackListWithExisitingUsers;
|
|
256
|
+
const copy = structuredClone(d);
|
|
257
|
+
for (const uid of Object.keys(copy.blackList)) {
|
|
258
|
+
if (uid in copy.members) continue;
|
|
259
|
+
delete copy.blackList[uid];
|
|
281
260
|
}
|
|
282
|
-
return
|
|
261
|
+
return copy;
|
|
283
262
|
}).superRefine((details, ctx) => {
|
|
284
|
-
const findMember = (uid) => details.members.find((m) => m.uid === uid);
|
|
285
263
|
for (const [docUid, physAssts] of Object.entries(details.partnerMap)) {
|
|
286
|
-
const queriedDoc =
|
|
264
|
+
const queriedDoc = details.members[docUid];
|
|
287
265
|
if (!queriedDoc) {
|
|
288
266
|
ctx.addIssue(
|
|
289
267
|
`Only existing members of a company are allowed to be leaders of a partner group (${docUid}).`
|
|
@@ -294,7 +272,7 @@ var StaffDetails = z4.object({
|
|
|
294
272
|
);
|
|
295
273
|
}
|
|
296
274
|
for (const asstUid of physAssts) {
|
|
297
|
-
const queriedAsst =
|
|
275
|
+
const queriedAsst = details.members[asstUid];
|
|
298
276
|
if (!queriedAsst) {
|
|
299
277
|
ctx.addIssue(
|
|
300
278
|
`Only existing members of a company are allowed to be apart of a partner group (${asstUid}).`
|