@tmlmobilidade/types 20250910.1526.7 → 20250910.1541.13
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.
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/* * */
|
|
2
|
-
import { CommentSchema } from '../_common/comment.js';
|
|
3
2
|
import { DocumentSchema } from '../_common/document.js';
|
|
3
|
+
import { RideAnalysisSchema } from './ride-analysis.js';
|
|
4
|
+
import { RideJustificationSchema } from './ride-justification.js';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
/* * */
|
|
6
7
|
export const RideAuditSchema = DocumentSchema.extend({
|
|
7
|
-
|
|
8
|
+
analysis: RideAnalysisSchema,
|
|
8
9
|
is_locked: z.boolean().default(false),
|
|
10
|
+
justification: RideJustificationSchema,
|
|
9
11
|
ride_id: z.string(),
|
|
10
12
|
}).strict();
|
|
11
13
|
export const CreateRideAuditSchema = RideAuditSchema.partial({ _id: true }).omit({ created_at: true, updated_at: true });
|
|
@@ -1,65 +1,23 @@
|
|
|
1
|
-
import { type UnixTimestamp } from '../_common/unix-timestamp.js';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
export declare const RIDE_ACCEPTANCE_STATUS_OPTIONS: readonly ["justification_required", "under_review", "accepted", "rejected"];
|
|
4
3
|
export declare const RideAcceptanceStatusSchema: z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>;
|
|
5
4
|
export type RideAcceptanceStatus = z.infer<typeof RideAcceptanceStatusSchema>;
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
error_message: z.ZodOptional<z.ZodString>;
|
|
10
|
-
grade: z.ZodEnum<["pass", "fail", "skip", "error"]>;
|
|
11
|
-
reason: z.ZodString;
|
|
12
|
-
}, "strict", z.ZodTypeAny, {
|
|
13
|
-
grade: "error" | "pass" | "fail" | "skip";
|
|
14
|
-
reason: string;
|
|
15
|
-
error_message?: string | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
grade: "error" | "pass" | "fail" | "skip";
|
|
18
|
-
reason: string;
|
|
19
|
-
error_message?: string | undefined;
|
|
20
|
-
}>;
|
|
21
|
-
created_at: z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">;
|
|
22
|
-
created_by: z.ZodString;
|
|
23
|
-
}, "strict", z.ZodTypeAny, {
|
|
24
|
-
created_at: number & {
|
|
25
|
-
__brand: "UnixTimestamp";
|
|
26
|
-
} & z.BRAND<"UnixTimestamp">;
|
|
27
|
-
created_by: string;
|
|
28
|
-
acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
|
|
29
|
-
analysis_result: {
|
|
30
|
-
grade: "error" | "pass" | "fail" | "skip";
|
|
31
|
-
reason: string;
|
|
32
|
-
error_message?: string | undefined;
|
|
33
|
-
};
|
|
34
|
-
}, {
|
|
35
|
-
created_at: number;
|
|
36
|
-
created_by: string;
|
|
37
|
-
acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
|
|
38
|
-
analysis_result: {
|
|
39
|
-
grade: "error" | "pass" | "fail" | "skip";
|
|
40
|
-
reason: string;
|
|
41
|
-
error_message?: string | undefined;
|
|
42
|
-
};
|
|
43
|
-
}>;
|
|
44
|
-
export interface RideJustificationChangelog extends Omit<z.infer<typeof RideJustificationChangelogSchema>, 'created_at'> {
|
|
45
|
-
created_at: UnixTimestamp;
|
|
46
|
-
}
|
|
47
|
-
export declare const RIDE_JUSTIFICATION_TYPE_OPTIONS: readonly ["traffic_accident", "traffic_delay", "accepted", "rejected"];
|
|
48
|
-
export declare const RideJustificationTypeSchema: z.ZodEnum<["traffic_accident", "traffic_delay", "accepted", "rejected"]>;
|
|
49
|
-
export type RideJustificationType = z.infer<typeof RideJustificationTypeSchema>;
|
|
5
|
+
export declare const RIDE_JUSTIFICATION_CAUSE_OPTIONS: readonly ["TECHNICAL_PROBLEM", "DEMONSTRATION", "ACCIDENT", "WEATHER", "CONSTRUCTION", "POLICE_ACTIVITY", "MEDICAL_EMERGENCY", "OTHER_CAUSE"];
|
|
6
|
+
export declare const RideJustificationCauseSchema: z.ZodEnum<["TECHNICAL_PROBLEM", "DEMONSTRATION", "ACCIDENT", "WEATHER", "CONSTRUCTION", "POLICE_ACTIVITY", "MEDICAL_EMERGENCY", "OTHER_CAUSE"]>;
|
|
7
|
+
export type RideJustificationCause = z.infer<typeof RideJustificationCauseSchema>;
|
|
50
8
|
export declare const RideJustificationSchema: z.ZodObject<{
|
|
51
9
|
_id: z.ZodString;
|
|
52
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
10
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
53
11
|
created_by: z.ZodDefault<z.ZodString>;
|
|
54
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
12
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
55
13
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
56
14
|
} & {
|
|
57
15
|
acceptance_status: z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>;
|
|
58
16
|
comments: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
59
17
|
_id: z.ZodString;
|
|
60
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
18
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
61
19
|
created_by: z.ZodDefault<z.ZodString>;
|
|
62
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
20
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
63
21
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
64
22
|
} & {
|
|
65
23
|
message: z.ZodString;
|
|
@@ -86,8 +44,8 @@ export declare const RideJustificationSchema: z.ZodObject<{
|
|
|
86
44
|
updated_by?: string | undefined;
|
|
87
45
|
}>, z.ZodObject<{
|
|
88
46
|
_id: z.ZodString;
|
|
89
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
90
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
47
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
48
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
91
49
|
} & {
|
|
92
50
|
created_by: z.ZodLiteral<"system">;
|
|
93
51
|
message: z.ZodString;
|
|
@@ -115,9 +73,9 @@ export declare const RideJustificationSchema: z.ZodObject<{
|
|
|
115
73
|
type: "system_info";
|
|
116
74
|
}>, z.ZodObject<{
|
|
117
75
|
_id: z.ZodString;
|
|
118
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
76
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
119
77
|
created_by: z.ZodDefault<z.ZodString>;
|
|
120
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
78
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
121
79
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
122
80
|
} & {
|
|
123
81
|
curr_status: z.ZodString;
|
|
@@ -270,6 +228,7 @@ export declare const RideJustificationSchema: z.ZodObject<{
|
|
|
270
228
|
created_by?: string | undefined;
|
|
271
229
|
updated_by?: string | undefined;
|
|
272
230
|
}>, "many">>;
|
|
231
|
+
justification_cause: z.ZodEnum<["TECHNICAL_PROBLEM", "DEMONSTRATION", "ACCIDENT", "WEATHER", "CONSTRUCTION", "POLICE_ACTIVITY", "MEDICAL_EMERGENCY", "OTHER_CAUSE"]>;
|
|
273
232
|
pto_message: z.ZodDefault<z.ZodString>;
|
|
274
233
|
}, "strict", z.ZodTypeAny, {
|
|
275
234
|
_id: string;
|
|
@@ -281,6 +240,7 @@ export declare const RideJustificationSchema: z.ZodObject<{
|
|
|
281
240
|
__brand: "UnixTimestamp";
|
|
282
241
|
};
|
|
283
242
|
updated_by: string;
|
|
243
|
+
acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
|
|
284
244
|
comments: ({
|
|
285
245
|
_id: string;
|
|
286
246
|
created_at: number & {
|
|
@@ -319,13 +279,14 @@ export declare const RideJustificationSchema: z.ZodObject<{
|
|
|
319
279
|
curr_status: string;
|
|
320
280
|
prev_status: string;
|
|
321
281
|
})[];
|
|
322
|
-
|
|
282
|
+
justification_cause: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "OTHER_CAUSE" | "POLICE_ACTIVITY" | "TECHNICAL_PROBLEM" | "WEATHER";
|
|
323
283
|
pto_message: string;
|
|
324
284
|
}, {
|
|
325
285
|
_id: string;
|
|
326
286
|
created_at: number;
|
|
327
287
|
updated_at: number;
|
|
328
288
|
acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
|
|
289
|
+
justification_cause: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "OTHER_CAUSE" | "POLICE_ACTIVITY" | "TECHNICAL_PROBLEM" | "WEATHER";
|
|
329
290
|
created_by?: string | undefined;
|
|
330
291
|
updated_by?: string | undefined;
|
|
331
292
|
comments?: ({
|
|
@@ -358,15 +319,16 @@ export declare const RideJustificationSchema: z.ZodObject<{
|
|
|
358
319
|
}>;
|
|
359
320
|
export declare const CreateRideJustificationSchema: z.ZodObject<Omit<{
|
|
360
321
|
_id: z.ZodOptional<z.ZodString>;
|
|
361
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
322
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
362
323
|
created_by: z.ZodDefault<z.ZodString>;
|
|
363
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
324
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
364
325
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
326
|
+
acceptance_status: z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>;
|
|
365
327
|
comments: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
366
328
|
_id: z.ZodString;
|
|
367
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
329
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
368
330
|
created_by: z.ZodDefault<z.ZodString>;
|
|
369
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
331
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
370
332
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
371
333
|
} & {
|
|
372
334
|
message: z.ZodString;
|
|
@@ -393,8 +355,8 @@ export declare const CreateRideJustificationSchema: z.ZodObject<Omit<{
|
|
|
393
355
|
updated_by?: string | undefined;
|
|
394
356
|
}>, z.ZodObject<{
|
|
395
357
|
_id: z.ZodString;
|
|
396
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
397
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
358
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
359
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
398
360
|
} & {
|
|
399
361
|
created_by: z.ZodLiteral<"system">;
|
|
400
362
|
message: z.ZodString;
|
|
@@ -422,9 +384,9 @@ export declare const CreateRideJustificationSchema: z.ZodObject<Omit<{
|
|
|
422
384
|
type: "system_info";
|
|
423
385
|
}>, z.ZodObject<{
|
|
424
386
|
_id: z.ZodString;
|
|
425
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
387
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
426
388
|
created_by: z.ZodDefault<z.ZodString>;
|
|
427
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
389
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
428
390
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
429
391
|
} & {
|
|
430
392
|
curr_status: z.ZodString;
|
|
@@ -577,11 +539,12 @@ export declare const CreateRideJustificationSchema: z.ZodObject<Omit<{
|
|
|
577
539
|
created_by?: string | undefined;
|
|
578
540
|
updated_by?: string | undefined;
|
|
579
541
|
}>, "many">>;
|
|
580
|
-
|
|
542
|
+
justification_cause: z.ZodEnum<["TECHNICAL_PROBLEM", "DEMONSTRATION", "ACCIDENT", "WEATHER", "CONSTRUCTION", "POLICE_ACTIVITY", "MEDICAL_EMERGENCY", "OTHER_CAUSE"]>;
|
|
581
543
|
pto_message: z.ZodDefault<z.ZodString>;
|
|
582
544
|
}, "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
|
|
583
545
|
created_by: string;
|
|
584
546
|
updated_by: string;
|
|
547
|
+
acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
|
|
585
548
|
comments: ({
|
|
586
549
|
_id: string;
|
|
587
550
|
created_at: number & {
|
|
@@ -620,11 +583,12 @@ export declare const CreateRideJustificationSchema: z.ZodObject<Omit<{
|
|
|
620
583
|
curr_status: string;
|
|
621
584
|
prev_status: string;
|
|
622
585
|
})[];
|
|
623
|
-
|
|
586
|
+
justification_cause: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "OTHER_CAUSE" | "POLICE_ACTIVITY" | "TECHNICAL_PROBLEM" | "WEATHER";
|
|
624
587
|
pto_message: string;
|
|
625
588
|
_id?: string | undefined;
|
|
626
589
|
}, {
|
|
627
590
|
acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
|
|
591
|
+
justification_cause: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "OTHER_CAUSE" | "POLICE_ACTIVITY" | "TECHNICAL_PROBLEM" | "WEATHER";
|
|
628
592
|
_id?: string | undefined;
|
|
629
593
|
created_by?: string | undefined;
|
|
630
594
|
updated_by?: string | undefined;
|
|
@@ -660,11 +624,12 @@ export declare const UpdateRideJustificationSchema: z.ZodObject<{
|
|
|
660
624
|
_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
661
625
|
created_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
662
626
|
updated_by: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
627
|
+
acceptance_status: z.ZodOptional<z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>>;
|
|
663
628
|
comments: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
664
629
|
_id: z.ZodString;
|
|
665
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
630
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
666
631
|
created_by: z.ZodDefault<z.ZodString>;
|
|
667
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
632
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
668
633
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
669
634
|
} & {
|
|
670
635
|
message: z.ZodString;
|
|
@@ -691,8 +656,8 @@ export declare const UpdateRideJustificationSchema: z.ZodObject<{
|
|
|
691
656
|
updated_by?: string | undefined;
|
|
692
657
|
}>, z.ZodObject<{
|
|
693
658
|
_id: z.ZodString;
|
|
694
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
695
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
659
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
660
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
696
661
|
} & {
|
|
697
662
|
created_by: z.ZodLiteral<"system">;
|
|
698
663
|
message: z.ZodString;
|
|
@@ -720,9 +685,9 @@ export declare const UpdateRideJustificationSchema: z.ZodObject<{
|
|
|
720
685
|
type: "system_info";
|
|
721
686
|
}>, z.ZodObject<{
|
|
722
687
|
_id: z.ZodString;
|
|
723
|
-
created_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
688
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
724
689
|
created_by: z.ZodDefault<z.ZodString>;
|
|
725
|
-
updated_at: z.ZodEffects<z.ZodNumber, UnixTimestamp, number>;
|
|
690
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
726
691
|
updated_by: z.ZodDefault<z.ZodString>;
|
|
727
692
|
} & {
|
|
728
693
|
curr_status: z.ZodString;
|
|
@@ -875,12 +840,13 @@ export declare const UpdateRideJustificationSchema: z.ZodObject<{
|
|
|
875
840
|
created_by?: string | undefined;
|
|
876
841
|
updated_by?: string | undefined;
|
|
877
842
|
}>, "many">>>;
|
|
878
|
-
|
|
843
|
+
justification_cause: z.ZodOptional<z.ZodEnum<["TECHNICAL_PROBLEM", "DEMONSTRATION", "ACCIDENT", "WEATHER", "CONSTRUCTION", "POLICE_ACTIVITY", "MEDICAL_EMERGENCY", "OTHER_CAUSE"]>>;
|
|
879
844
|
pto_message: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
880
845
|
}, "strict", z.ZodTypeAny, {
|
|
881
846
|
_id?: string | undefined;
|
|
882
847
|
created_by?: string | undefined;
|
|
883
848
|
updated_by?: string | undefined;
|
|
849
|
+
acceptance_status?: "accepted" | "justification_required" | "under_review" | "rejected" | undefined;
|
|
884
850
|
comments?: ({
|
|
885
851
|
_id: string;
|
|
886
852
|
created_at: number & {
|
|
@@ -919,12 +885,13 @@ export declare const UpdateRideJustificationSchema: z.ZodObject<{
|
|
|
919
885
|
curr_status: string;
|
|
920
886
|
prev_status: string;
|
|
921
887
|
})[] | undefined;
|
|
922
|
-
|
|
888
|
+
justification_cause?: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "OTHER_CAUSE" | "POLICE_ACTIVITY" | "TECHNICAL_PROBLEM" | "WEATHER" | undefined;
|
|
923
889
|
pto_message?: string | undefined;
|
|
924
890
|
}, {
|
|
925
891
|
_id?: string | undefined;
|
|
926
892
|
created_by?: string | undefined;
|
|
927
893
|
updated_by?: string | undefined;
|
|
894
|
+
acceptance_status?: "accepted" | "justification_required" | "under_review" | "rejected" | undefined;
|
|
928
895
|
comments?: ({
|
|
929
896
|
_id: string;
|
|
930
897
|
created_at: number;
|
|
@@ -951,9 +918,9 @@ export declare const UpdateRideJustificationSchema: z.ZodObject<{
|
|
|
951
918
|
created_by?: string | undefined;
|
|
952
919
|
updated_by?: string | undefined;
|
|
953
920
|
})[] | undefined;
|
|
954
|
-
|
|
921
|
+
justification_cause?: "ACCIDENT" | "CONSTRUCTION" | "DEMONSTRATION" | "MEDICAL_EMERGENCY" | "OTHER_CAUSE" | "POLICE_ACTIVITY" | "TECHNICAL_PROBLEM" | "WEATHER" | undefined;
|
|
955
922
|
pto_message?: string | undefined;
|
|
956
923
|
}>;
|
|
957
924
|
export type RideJustification = z.infer<typeof RideJustificationSchema>;
|
|
958
925
|
export type CreateRideJustificationDto = z.infer<typeof CreateRideJustificationSchema>;
|
|
959
|
-
export type UpdateRideJustificationDto =
|
|
926
|
+
export type UpdateRideJustificationDto = z.infer<typeof UpdateRideJustificationSchema>;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { CommentSchema, CommentTypeSchema } from '../_common/comment.js';
|
|
3
3
|
import { DocumentSchema } from '../_common/document.js';
|
|
4
|
-
import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
|
|
5
|
-
import { RideAnalysisSchema } from './ride-analysis.js';
|
|
6
4
|
import { z } from 'zod';
|
|
7
5
|
/* * */
|
|
8
6
|
export const RIDE_ACCEPTANCE_STATUS_OPTIONS = ['justification_required', 'under_review', 'accepted', 'rejected'];
|
|
9
7
|
export const RideAcceptanceStatusSchema = z.enum(RIDE_ACCEPTANCE_STATUS_OPTIONS);
|
|
8
|
+
export const RIDE_JUSTIFICATION_CAUSE_OPTIONS = ['TECHNICAL_PROBLEM', 'DEMONSTRATION', 'ACCIDENT', 'WEATHER', 'CONSTRUCTION', 'POLICE_ACTIVITY', 'MEDICAL_EMERGENCY', 'OTHER_CAUSE'];
|
|
9
|
+
export const RideJustificationCauseSchema = z.enum(RIDE_JUSTIFICATION_CAUSE_OPTIONS);
|
|
10
10
|
/* * */
|
|
11
|
-
export const RideJustificationChangelogSchema = z.object({
|
|
12
|
-
acceptance_status: RideAcceptanceStatusSchema,
|
|
13
|
-
analysis_result: RideAnalysisSchema,
|
|
14
|
-
created_at: z.number().transform(validateUnixTimestamp).brand('UnixTimestamp'),
|
|
15
|
-
created_by: z.string().min(2).max(100),
|
|
16
|
-
}).strict();
|
|
17
|
-
/* * */
|
|
18
|
-
export const RIDE_JUSTIFICATION_TYPE_OPTIONS = ['traffic_accident', 'traffic_delay', 'accepted', 'rejected'];
|
|
19
|
-
export const RideJustificationTypeSchema = z.enum(RIDE_JUSTIFICATION_TYPE_OPTIONS);
|
|
20
11
|
const CommentSchemaWithRideJustificationStatus = CommentSchema.superRefine((data, ctx) => {
|
|
21
12
|
if (data.type === CommentTypeSchema.enum.statusChanged) {
|
|
22
13
|
const d = data;
|
|
@@ -40,25 +31,8 @@ const CommentSchemaWithRideJustificationStatus = CommentSchema.superRefine((data
|
|
|
40
31
|
export const RideJustificationSchema = DocumentSchema.extend({
|
|
41
32
|
acceptance_status: RideAcceptanceStatusSchema,
|
|
42
33
|
comments: z.array(CommentSchemaWithRideJustificationStatus).default([]),
|
|
34
|
+
justification_cause: RideJustificationCauseSchema,
|
|
43
35
|
pto_message: z.string().min(2).max(5000).default(''),
|
|
44
36
|
}).strict();
|
|
45
37
|
export const CreateRideJustificationSchema = RideJustificationSchema.partial({ _id: true }).omit({ created_at: true, updated_at: true });
|
|
46
38
|
export const UpdateRideJustificationSchema = CreateRideJustificationSchema.partial();
|
|
47
|
-
const example = {
|
|
48
|
-
_id: '64b64f4f8f1d2c001f6e4b8a',
|
|
49
|
-
acceptance_status: 'rejected',
|
|
50
|
-
comments: [
|
|
51
|
-
{
|
|
52
|
-
_id: '64b64f4f8f1d2c001f6e4b8a',
|
|
53
|
-
created_at: 1690400000,
|
|
54
|
-
created_by: 'system',
|
|
55
|
-
message: 'Ride justification created',
|
|
56
|
-
type: 'system_info',
|
|
57
|
-
updated_at: 1690400000,
|
|
58
|
-
updated_by: 'system',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
created_by: 'joao',
|
|
62
|
-
pto_message: '',
|
|
63
|
-
updated_by: '',
|
|
64
|
-
};
|
package/package.json
CHANGED