@tmlmobilidade/types 20250915.1643.34 → 20250916.1040.35
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/src/_common/comment.d.ts +34 -253
- package/dist/src/_common/comment.js +20 -43
- package/dist/src/rides/ride-audit.d.ts +0 -15
- package/dist/src/rides/ride-justification.d.ts +84 -333
- package/dist/src/stop.d.ts +84 -333
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const CommentTypeSchema: z.ZodEnum<["
|
|
2
|
+
export declare const CommentTypeSchema: z.ZodEnum<["field_changed", "note"]>;
|
|
3
3
|
export type CommentType = z.infer<typeof CommentTypeSchema>;
|
|
4
4
|
export declare const NoteCommentSchema: z.ZodObject<{
|
|
5
5
|
_id: z.ZodString;
|
|
@@ -9,7 +9,6 @@ export declare const NoteCommentSchema: z.ZodObject<{
|
|
|
9
9
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
10
10
|
} & {
|
|
11
11
|
message: z.ZodString;
|
|
12
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
13
12
|
type: z.ZodLiteral<"note">;
|
|
14
13
|
}, "strip", z.ZodTypeAny, {
|
|
15
14
|
_id: string;
|
|
@@ -23,7 +22,6 @@ export declare const NoteCommentSchema: z.ZodObject<{
|
|
|
23
22
|
type: "note";
|
|
24
23
|
created_by?: string | undefined;
|
|
25
24
|
updated_by?: string | undefined;
|
|
26
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
27
25
|
}, {
|
|
28
26
|
_id: string;
|
|
29
27
|
created_at: number;
|
|
@@ -32,53 +30,19 @@ export declare const NoteCommentSchema: z.ZodObject<{
|
|
|
32
30
|
type: "note";
|
|
33
31
|
created_by?: string | undefined;
|
|
34
32
|
updated_by?: string | undefined;
|
|
35
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
36
33
|
}>;
|
|
37
|
-
export declare const
|
|
38
|
-
_id: z.ZodString;
|
|
39
|
-
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
40
|
-
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
41
|
-
} & {
|
|
42
|
-
created_by: z.ZodLiteral<"system">;
|
|
43
|
-
message: z.ZodString;
|
|
44
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
45
|
-
type: z.ZodLiteral<"system_info">;
|
|
46
|
-
updated_by: z.ZodLiteral<"system">;
|
|
47
|
-
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
_id: string;
|
|
49
|
-
created_at: number & {
|
|
50
|
-
__brand: "UnixTimestamp";
|
|
51
|
-
};
|
|
52
|
-
created_by: "system";
|
|
53
|
-
updated_at: number & {
|
|
54
|
-
__brand: "UnixTimestamp";
|
|
55
|
-
};
|
|
56
|
-
updated_by: "system";
|
|
57
|
-
message: string;
|
|
58
|
-
type: "system_info";
|
|
59
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
60
|
-
}, {
|
|
61
|
-
_id: string;
|
|
62
|
-
created_at: number;
|
|
63
|
-
created_by: "system";
|
|
64
|
-
updated_at: number;
|
|
65
|
-
updated_by: "system";
|
|
66
|
-
message: string;
|
|
67
|
-
type: "system_info";
|
|
68
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
69
|
-
}>;
|
|
70
|
-
export declare const StatusChangedCommentSchema: z.ZodObject<{
|
|
34
|
+
export declare const FieldChangedCommentSchema: z.ZodObject<{
|
|
71
35
|
_id: z.ZodString;
|
|
72
36
|
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
73
37
|
created_by: z.ZodOptional<z.ZodString>;
|
|
74
38
|
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
75
39
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
76
40
|
} & {
|
|
77
|
-
|
|
78
|
-
|
|
41
|
+
curr_value: z.ZodAny;
|
|
42
|
+
field: z.ZodString;
|
|
79
43
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
80
|
-
|
|
81
|
-
type: z.ZodLiteral<"
|
|
44
|
+
prev_value: z.ZodAny;
|
|
45
|
+
type: z.ZodLiteral<"field_changed">;
|
|
82
46
|
}, "strip", z.ZodTypeAny, {
|
|
83
47
|
_id: string;
|
|
84
48
|
created_at: number & {
|
|
@@ -87,24 +51,24 @@ export declare const StatusChangedCommentSchema: z.ZodObject<{
|
|
|
87
51
|
updated_at: number & {
|
|
88
52
|
__brand: "UnixTimestamp";
|
|
89
53
|
};
|
|
90
|
-
type: "
|
|
91
|
-
|
|
92
|
-
curr_status: string | boolean;
|
|
93
|
-
prev_status: string | boolean;
|
|
54
|
+
type: "field_changed";
|
|
55
|
+
field: string;
|
|
94
56
|
created_by?: string | undefined;
|
|
95
57
|
updated_by?: string | undefined;
|
|
58
|
+
curr_value?: any;
|
|
96
59
|
metadata?: Record<string, unknown> | null | undefined;
|
|
60
|
+
prev_value?: any;
|
|
97
61
|
}, {
|
|
98
62
|
_id: string;
|
|
99
63
|
created_at: number;
|
|
100
64
|
updated_at: number;
|
|
101
|
-
type: "
|
|
102
|
-
|
|
103
|
-
curr_status: string | boolean;
|
|
104
|
-
prev_status: string | boolean;
|
|
65
|
+
type: "field_changed";
|
|
66
|
+
field: string;
|
|
105
67
|
created_by?: string | undefined;
|
|
106
68
|
updated_by?: string | undefined;
|
|
69
|
+
curr_value?: any;
|
|
107
70
|
metadata?: Record<string, unknown> | null | undefined;
|
|
71
|
+
prev_value?: any;
|
|
108
72
|
}>;
|
|
109
73
|
export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
110
74
|
_id: z.ZodString;
|
|
@@ -114,7 +78,6 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
114
78
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
115
79
|
} & {
|
|
116
80
|
message: z.ZodString;
|
|
117
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
118
81
|
type: z.ZodLiteral<"note">;
|
|
119
82
|
}, "strip", z.ZodTypeAny, {
|
|
120
83
|
_id: string;
|
|
@@ -128,7 +91,6 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
128
91
|
type: "note";
|
|
129
92
|
created_by?: string | undefined;
|
|
130
93
|
updated_by?: string | undefined;
|
|
131
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
132
94
|
}, {
|
|
133
95
|
_id: string;
|
|
134
96
|
created_at: number;
|
|
@@ -137,39 +99,6 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
137
99
|
type: "note";
|
|
138
100
|
created_by?: string | undefined;
|
|
139
101
|
updated_by?: string | undefined;
|
|
140
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
141
|
-
}>, z.ZodObject<{
|
|
142
|
-
_id: z.ZodString;
|
|
143
|
-
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
144
|
-
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
145
|
-
} & {
|
|
146
|
-
created_by: z.ZodLiteral<"system">;
|
|
147
|
-
message: z.ZodString;
|
|
148
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
149
|
-
type: z.ZodLiteral<"system_info">;
|
|
150
|
-
updated_by: z.ZodLiteral<"system">;
|
|
151
|
-
}, "strip", z.ZodTypeAny, {
|
|
152
|
-
_id: string;
|
|
153
|
-
created_at: number & {
|
|
154
|
-
__brand: "UnixTimestamp";
|
|
155
|
-
};
|
|
156
|
-
created_by: "system";
|
|
157
|
-
updated_at: number & {
|
|
158
|
-
__brand: "UnixTimestamp";
|
|
159
|
-
};
|
|
160
|
-
updated_by: "system";
|
|
161
|
-
message: string;
|
|
162
|
-
type: "system_info";
|
|
163
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
164
|
-
}, {
|
|
165
|
-
_id: string;
|
|
166
|
-
created_at: number;
|
|
167
|
-
created_by: "system";
|
|
168
|
-
updated_at: number;
|
|
169
|
-
updated_by: "system";
|
|
170
|
-
message: string;
|
|
171
|
-
type: "system_info";
|
|
172
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
173
102
|
}>, z.ZodObject<{
|
|
174
103
|
_id: z.ZodString;
|
|
175
104
|
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
@@ -177,11 +106,11 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
177
106
|
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
178
107
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
179
108
|
} & {
|
|
180
|
-
|
|
181
|
-
|
|
109
|
+
curr_value: z.ZodAny;
|
|
110
|
+
field: z.ZodString;
|
|
182
111
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
183
|
-
|
|
184
|
-
type: z.ZodLiteral<"
|
|
112
|
+
prev_value: z.ZodAny;
|
|
113
|
+
type: z.ZodLiteral<"field_changed">;
|
|
185
114
|
}, "strip", z.ZodTypeAny, {
|
|
186
115
|
_id: string;
|
|
187
116
|
created_at: number & {
|
|
@@ -190,24 +119,24 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
190
119
|
updated_at: number & {
|
|
191
120
|
__brand: "UnixTimestamp";
|
|
192
121
|
};
|
|
193
|
-
type: "
|
|
194
|
-
|
|
195
|
-
curr_status: string | boolean;
|
|
196
|
-
prev_status: string | boolean;
|
|
122
|
+
type: "field_changed";
|
|
123
|
+
field: string;
|
|
197
124
|
created_by?: string | undefined;
|
|
198
125
|
updated_by?: string | undefined;
|
|
126
|
+
curr_value?: any;
|
|
199
127
|
metadata?: Record<string, unknown> | null | undefined;
|
|
128
|
+
prev_value?: any;
|
|
200
129
|
}, {
|
|
201
130
|
_id: string;
|
|
202
131
|
created_at: number;
|
|
203
132
|
updated_at: number;
|
|
204
|
-
type: "
|
|
205
|
-
|
|
206
|
-
curr_status: string | boolean;
|
|
207
|
-
prev_status: string | boolean;
|
|
133
|
+
type: "field_changed";
|
|
134
|
+
field: string;
|
|
208
135
|
created_by?: string | undefined;
|
|
209
136
|
updated_by?: string | undefined;
|
|
137
|
+
curr_value?: any;
|
|
210
138
|
metadata?: Record<string, unknown> | null | undefined;
|
|
139
|
+
prev_value?: any;
|
|
211
140
|
}>]>, {
|
|
212
141
|
_id: string;
|
|
213
142
|
created_at: number & {
|
|
@@ -220,20 +149,6 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
220
149
|
type: "note";
|
|
221
150
|
created_by?: string | undefined;
|
|
222
151
|
updated_by?: string | undefined;
|
|
223
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
224
|
-
} | {
|
|
225
|
-
_id: string;
|
|
226
|
-
created_at: number & {
|
|
227
|
-
__brand: "UnixTimestamp";
|
|
228
|
-
};
|
|
229
|
-
created_by: "system";
|
|
230
|
-
updated_at: number & {
|
|
231
|
-
__brand: "UnixTimestamp";
|
|
232
|
-
};
|
|
233
|
-
updated_by: "system";
|
|
234
|
-
message: string;
|
|
235
|
-
type: "system_info";
|
|
236
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
237
152
|
} | {
|
|
238
153
|
_id: string;
|
|
239
154
|
created_at: number & {
|
|
@@ -242,13 +157,13 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
242
157
|
updated_at: number & {
|
|
243
158
|
__brand: "UnixTimestamp";
|
|
244
159
|
};
|
|
245
|
-
type: "
|
|
246
|
-
|
|
247
|
-
curr_status: string | boolean;
|
|
248
|
-
prev_status: string | boolean;
|
|
160
|
+
type: "field_changed";
|
|
161
|
+
field: string;
|
|
249
162
|
created_by?: string | undefined;
|
|
250
163
|
updated_by?: string | undefined;
|
|
164
|
+
curr_value?: any;
|
|
251
165
|
metadata?: Record<string, unknown> | null | undefined;
|
|
166
|
+
prev_value?: any;
|
|
252
167
|
}, {
|
|
253
168
|
_id: string;
|
|
254
169
|
created_at: number;
|
|
@@ -257,150 +172,16 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
257
172
|
type: "note";
|
|
258
173
|
created_by?: string | undefined;
|
|
259
174
|
updated_by?: string | undefined;
|
|
260
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
261
|
-
} | {
|
|
262
|
-
_id: string;
|
|
263
|
-
created_at: number;
|
|
264
|
-
created_by: "system";
|
|
265
|
-
updated_at: number;
|
|
266
|
-
updated_by: "system";
|
|
267
|
-
message: string;
|
|
268
|
-
type: "system_info";
|
|
269
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
270
175
|
} | {
|
|
271
176
|
_id: string;
|
|
272
177
|
created_at: number;
|
|
273
178
|
updated_at: number;
|
|
274
|
-
type: "
|
|
275
|
-
|
|
276
|
-
curr_status: string | boolean;
|
|
277
|
-
prev_status: string | boolean;
|
|
278
|
-
created_by?: string | undefined;
|
|
279
|
-
updated_by?: string | undefined;
|
|
280
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
281
|
-
}>;
|
|
282
|
-
export declare const CreateCommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<Omit<{
|
|
283
|
-
_id: z.ZodOptional<z.ZodString>;
|
|
284
|
-
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
285
|
-
created_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
286
|
-
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
287
|
-
updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
288
|
-
message: z.ZodString;
|
|
289
|
-
type: z.ZodLiteral<"note">;
|
|
290
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
291
|
-
}, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
292
|
-
message: string;
|
|
293
|
-
type: "note";
|
|
294
|
-
_id?: string | undefined;
|
|
295
|
-
created_by?: string | undefined;
|
|
296
|
-
updated_by?: string | undefined;
|
|
297
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
298
|
-
}, {
|
|
299
|
-
message: string;
|
|
300
|
-
type: "note";
|
|
301
|
-
_id?: string | undefined;
|
|
302
|
-
created_by?: string | undefined;
|
|
303
|
-
updated_by?: string | undefined;
|
|
304
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
305
|
-
}>, z.ZodObject<Omit<{
|
|
306
|
-
_id: z.ZodOptional<z.ZodString>;
|
|
307
|
-
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
308
|
-
created_by: z.ZodOptional<z.ZodLiteral<"system">>;
|
|
309
|
-
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
310
|
-
updated_by: z.ZodOptional<z.ZodLiteral<"system">>;
|
|
311
|
-
message: z.ZodString;
|
|
312
|
-
type: z.ZodLiteral<"system_info">;
|
|
313
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
314
|
-
}, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
315
|
-
message: string;
|
|
316
|
-
type: "system_info";
|
|
317
|
-
_id?: string | undefined;
|
|
318
|
-
created_by?: "system" | undefined;
|
|
319
|
-
updated_by?: "system" | undefined;
|
|
320
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
321
|
-
}, {
|
|
322
|
-
message: string;
|
|
323
|
-
type: "system_info";
|
|
324
|
-
_id?: string | undefined;
|
|
325
|
-
created_by?: "system" | undefined;
|
|
326
|
-
updated_by?: "system" | undefined;
|
|
327
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
328
|
-
}>, z.ZodObject<Omit<{
|
|
329
|
-
_id: z.ZodOptional<z.ZodString>;
|
|
330
|
-
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
331
|
-
created_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
332
|
-
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
333
|
-
updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
334
|
-
type: z.ZodLiteral<"status_changed">;
|
|
335
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
336
|
-
accessor: z.ZodString;
|
|
337
|
-
curr_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
338
|
-
prev_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
339
|
-
}, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
340
|
-
type: "status_changed";
|
|
341
|
-
accessor: string;
|
|
342
|
-
curr_status: string | boolean;
|
|
343
|
-
prev_status: string | boolean;
|
|
344
|
-
_id?: string | undefined;
|
|
345
|
-
created_by?: string | undefined;
|
|
346
|
-
updated_by?: string | undefined;
|
|
347
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
348
|
-
}, {
|
|
349
|
-
type: "status_changed";
|
|
350
|
-
accessor: string;
|
|
351
|
-
curr_status: string | boolean;
|
|
352
|
-
prev_status: string | boolean;
|
|
353
|
-
_id?: string | undefined;
|
|
354
|
-
created_by?: string | undefined;
|
|
355
|
-
updated_by?: string | undefined;
|
|
356
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
357
|
-
}>]>, {
|
|
358
|
-
message: string;
|
|
359
|
-
type: "note";
|
|
360
|
-
_id?: string | undefined;
|
|
361
|
-
created_by?: string | undefined;
|
|
362
|
-
updated_by?: string | undefined;
|
|
363
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
364
|
-
} | {
|
|
365
|
-
message: string;
|
|
366
|
-
type: "system_info";
|
|
367
|
-
_id?: string | undefined;
|
|
368
|
-
created_by?: "system" | undefined;
|
|
369
|
-
updated_by?: "system" | undefined;
|
|
370
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
371
|
-
} | {
|
|
372
|
-
type: "status_changed";
|
|
373
|
-
accessor: string;
|
|
374
|
-
curr_status: string | boolean;
|
|
375
|
-
prev_status: string | boolean;
|
|
376
|
-
_id?: string | undefined;
|
|
377
|
-
created_by?: string | undefined;
|
|
378
|
-
updated_by?: string | undefined;
|
|
379
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
380
|
-
}, {
|
|
381
|
-
message: string;
|
|
382
|
-
type: "note";
|
|
383
|
-
_id?: string | undefined;
|
|
384
|
-
created_by?: string | undefined;
|
|
385
|
-
updated_by?: string | undefined;
|
|
386
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
387
|
-
} | {
|
|
388
|
-
message: string;
|
|
389
|
-
type: "system_info";
|
|
390
|
-
_id?: string | undefined;
|
|
391
|
-
created_by?: "system" | undefined;
|
|
392
|
-
updated_by?: "system" | undefined;
|
|
393
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
394
|
-
} | {
|
|
395
|
-
type: "status_changed";
|
|
396
|
-
accessor: string;
|
|
397
|
-
curr_status: string | boolean;
|
|
398
|
-
prev_status: string | boolean;
|
|
399
|
-
_id?: string | undefined;
|
|
179
|
+
type: "field_changed";
|
|
180
|
+
field: string;
|
|
400
181
|
created_by?: string | undefined;
|
|
401
182
|
updated_by?: string | undefined;
|
|
183
|
+
curr_value?: any;
|
|
402
184
|
metadata?: Record<string, unknown> | null | undefined;
|
|
185
|
+
prev_value?: any;
|
|
403
186
|
}>;
|
|
404
187
|
export type Comment = z.infer<typeof CommentSchema>;
|
|
405
|
-
export type CreateCommentDto = z.infer<typeof CreateCommentSchema>;
|
|
406
|
-
export type UpdateCommentDto = Partial<Omit<CreateCommentDto, '_id' | 'created_at' | 'created_by'>>;
|
|
@@ -2,61 +2,38 @@
|
|
|
2
2
|
import { DocumentSchema } from './document.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
/* * */
|
|
5
|
-
const COMMENT_TYPE_OPTIONS = ['
|
|
5
|
+
const COMMENT_TYPE_OPTIONS = ['field_changed', 'note'];
|
|
6
6
|
export const CommentTypeSchema = z.enum(COMMENT_TYPE_OPTIONS);
|
|
7
7
|
/* * */
|
|
8
8
|
export const NoteCommentSchema = DocumentSchema.extend({
|
|
9
9
|
message: z.string(),
|
|
10
|
-
metadata: z.record(z.unknown()).nullish(),
|
|
11
10
|
type: z.literal(CommentTypeSchema.enum.note),
|
|
12
11
|
});
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
metadata: z.record(z.unknown()).nullish(),
|
|
17
|
-
type: z.literal(CommentTypeSchema.enum.system_info),
|
|
18
|
-
updated_by: z.literal('system'),
|
|
19
|
-
});
|
|
20
|
-
export const StatusChangedCommentSchema = DocumentSchema.extend({
|
|
21
|
-
accessor: z.string(),
|
|
22
|
-
curr_status: z.string().or(z.boolean()),
|
|
12
|
+
export const FieldChangedCommentSchema = DocumentSchema.extend({
|
|
13
|
+
curr_value: z.any(),
|
|
14
|
+
field: z.string(),
|
|
23
15
|
metadata: z.record(z.unknown()).nullish(),
|
|
24
|
-
|
|
25
|
-
type: z.literal(CommentTypeSchema.enum.
|
|
16
|
+
prev_value: z.any(),
|
|
17
|
+
type: z.literal(CommentTypeSchema.enum.field_changed),
|
|
26
18
|
});
|
|
19
|
+
/* * */
|
|
20
|
+
function validateFieldChanged(data, ctx) {
|
|
21
|
+
if (data.curr_value === data.prev_value) {
|
|
22
|
+
ctx.addIssue({
|
|
23
|
+
code: z.ZodIssueCode.custom,
|
|
24
|
+
message: 'curr_value and prev_value must differ',
|
|
25
|
+
path: ['curr_value'],
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/* * */
|
|
27
30
|
export const CommentSchema = z
|
|
28
31
|
.discriminatedUnion('type', [
|
|
29
32
|
NoteCommentSchema,
|
|
30
|
-
|
|
31
|
-
StatusChangedCommentSchema,
|
|
32
|
-
])
|
|
33
|
-
.superRefine((data, ctx) => {
|
|
34
|
-
if (data.type === CommentTypeSchema.enum.status_changed) {
|
|
35
|
-
const d = data;
|
|
36
|
-
if (d.curr_status === d.prev_status) {
|
|
37
|
-
ctx.addIssue({
|
|
38
|
-
code: z.ZodIssueCode.custom,
|
|
39
|
-
message: 'curr_status and prev_status must differ',
|
|
40
|
-
path: ['curr_status'],
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
export const CreateCommentSchema = z
|
|
46
|
-
.discriminatedUnion('type', [
|
|
47
|
-
NoteCommentSchema.partial({ _id: true, created_by: true, updated_by: true }).omit({ created_at: true, updated_at: true }),
|
|
48
|
-
SystemInfoCommentSchema.partial({ _id: true, created_by: true, updated_by: true }).omit({ created_at: true, updated_at: true }),
|
|
49
|
-
StatusChangedCommentSchema.partial({ _id: true, created_by: true, updated_by: true }).omit({ created_at: true, updated_at: true }),
|
|
33
|
+
FieldChangedCommentSchema,
|
|
50
34
|
])
|
|
51
35
|
.superRefine((data, ctx) => {
|
|
52
|
-
if (data.type === CommentTypeSchema.enum.
|
|
53
|
-
|
|
54
|
-
if (d.curr_status === d.prev_status) {
|
|
55
|
-
ctx.addIssue({
|
|
56
|
-
code: z.ZodIssueCode.custom,
|
|
57
|
-
message: 'curr_status and prev_status must differ',
|
|
58
|
-
path: ['curr_status'],
|
|
59
|
-
});
|
|
60
|
-
}
|
|
36
|
+
if (data.type === CommentTypeSchema.enum.field_changed) {
|
|
37
|
+
validateFieldChanged(data, ctx);
|
|
61
38
|
}
|
|
62
39
|
});
|
|
@@ -14,7 +14,6 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
14
14
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
15
15
|
} & {
|
|
16
16
|
message: z.ZodString;
|
|
17
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
18
17
|
type: z.ZodLiteral<"note">;
|
|
19
18
|
}, "strip", z.ZodTypeAny, {
|
|
20
19
|
_id: string;
|
|
@@ -28,7 +27,6 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
28
27
|
type: "note";
|
|
29
28
|
created_by?: string | undefined;
|
|
30
29
|
updated_by?: string | undefined;
|
|
31
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
32
30
|
}, {
|
|
33
31
|
_id: string;
|
|
34
32
|
created_at: number;
|
|
@@ -37,7 +35,6 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
37
35
|
type: "note";
|
|
38
36
|
created_by?: string | undefined;
|
|
39
37
|
updated_by?: string | undefined;
|
|
40
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
41
38
|
}>, "many">;
|
|
42
39
|
is_locked: z.ZodDefault<z.ZodBoolean>;
|
|
43
40
|
ride_id: z.ZodString;
|
|
@@ -62,7 +59,6 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
62
59
|
type: "note";
|
|
63
60
|
created_by?: string | undefined;
|
|
64
61
|
updated_by?: string | undefined;
|
|
65
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
66
62
|
}[];
|
|
67
63
|
ride_id: string;
|
|
68
64
|
created_by?: string | undefined;
|
|
@@ -79,7 +75,6 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
79
75
|
type: "note";
|
|
80
76
|
created_by?: string | undefined;
|
|
81
77
|
updated_by?: string | undefined;
|
|
82
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
83
78
|
}[];
|
|
84
79
|
ride_id: string;
|
|
85
80
|
created_by?: string | undefined;
|
|
@@ -101,7 +96,6 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
101
96
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
102
97
|
} & {
|
|
103
98
|
message: z.ZodString;
|
|
104
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
105
99
|
type: z.ZodLiteral<"note">;
|
|
106
100
|
}, "strip", z.ZodTypeAny, {
|
|
107
101
|
_id: string;
|
|
@@ -115,7 +109,6 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
115
109
|
type: "note";
|
|
116
110
|
created_by?: string | undefined;
|
|
117
111
|
updated_by?: string | undefined;
|
|
118
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
119
112
|
}, {
|
|
120
113
|
_id: string;
|
|
121
114
|
created_at: number;
|
|
@@ -124,7 +117,6 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
124
117
|
type: "note";
|
|
125
118
|
created_by?: string | undefined;
|
|
126
119
|
updated_by?: string | undefined;
|
|
127
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
128
120
|
}>, "many">;
|
|
129
121
|
ride_id: z.ZodString;
|
|
130
122
|
}, "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
|
|
@@ -141,7 +133,6 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
141
133
|
type: "note";
|
|
142
134
|
created_by?: string | undefined;
|
|
143
135
|
updated_by?: string | undefined;
|
|
144
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
145
136
|
}[];
|
|
146
137
|
ride_id: string;
|
|
147
138
|
_id?: string | undefined;
|
|
@@ -156,7 +147,6 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
156
147
|
type: "note";
|
|
157
148
|
created_by?: string | undefined;
|
|
158
149
|
updated_by?: string | undefined;
|
|
159
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
160
150
|
}[];
|
|
161
151
|
ride_id: string;
|
|
162
152
|
_id?: string | undefined;
|
|
@@ -176,7 +166,6 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
176
166
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
177
167
|
} & {
|
|
178
168
|
message: z.ZodString;
|
|
179
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
180
169
|
type: z.ZodLiteral<"note">;
|
|
181
170
|
}, "strip", z.ZodTypeAny, {
|
|
182
171
|
_id: string;
|
|
@@ -190,7 +179,6 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
190
179
|
type: "note";
|
|
191
180
|
created_by?: string | undefined;
|
|
192
181
|
updated_by?: string | undefined;
|
|
193
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
194
182
|
}, {
|
|
195
183
|
_id: string;
|
|
196
184
|
created_at: number;
|
|
@@ -199,7 +187,6 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
199
187
|
type: "note";
|
|
200
188
|
created_by?: string | undefined;
|
|
201
189
|
updated_by?: string | undefined;
|
|
202
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
203
190
|
}>, "many">>;
|
|
204
191
|
ride_id: z.ZodOptional<z.ZodString>;
|
|
205
192
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -218,7 +205,6 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
218
205
|
type: "note";
|
|
219
206
|
created_by?: string | undefined;
|
|
220
207
|
updated_by?: string | undefined;
|
|
221
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
222
208
|
}[] | undefined;
|
|
223
209
|
ride_id?: string | undefined;
|
|
224
210
|
}, {
|
|
@@ -233,7 +219,6 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
233
219
|
type: "note";
|
|
234
220
|
created_by?: string | undefined;
|
|
235
221
|
updated_by?: string | undefined;
|
|
236
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
237
222
|
}[] | undefined;
|
|
238
223
|
ride_id?: string | undefined;
|
|
239
224
|
}>;
|