fix(stores): allow null data
Some checks failed
TrafficCue Server CI / check (push) Failing after 52s
TrafficCue Server CD / build (push) Successful in 2m1s

This commit is contained in:
2025-09-27 20:38:41 +02:00
parent 30334d13d1
commit 546ca0ddc7

View File

@ -28,6 +28,7 @@ export const vehicleStore = z
.strict(); .strict();
export const routeStore = z.object({ export const routeStore = z.object({
name: z.string().min(1).max(100),
locations: z.array( locations: z.array(
z.object({ z.object({
lat: z.number().min(-90).max(90), lat: z.number().min(-90).max(90),
@ -80,6 +81,7 @@ export type SyncPayload = z.infer<typeof SyncPayload>;
export function verifyStoreData(type: StoreType, data: string) { export function verifyStoreData(type: StoreType, data: string) {
const schema = storeTypes[type]; const schema = storeTypes[type];
if (!schema) return false; if (!schema) return false;
if(data === "null") return true; // allow null data
try { try {
const parsedData = JSON.parse(data); const parsedData = JSON.parse(data);
schema.parse(parsedData); schema.parse(parsedData);