fix(repairs): stop rejecting log when broken serial already exists
The LogRepairRequest superRefine demanded brokenPartModelId or brokenMpn+brokenManufacturerId on every request, but the service only consumes those fields when ingesting a brand-new broken part. For serials already in Vector, the client correctly omits them — schema then false-rejected the payload. Drop the refine; the service still throws with the same message when ingest truly needs it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -25,16 +25,8 @@ export const LogRepairRequest = z
|
|||||||
path: ['hostId'],
|
path: ['hostId'],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const hasModel =
|
// Model fields are only required when the broken serial isn't already in Vector. The
|
||||||
v.brokenPartModelId !== undefined ||
|
// server resolves the serial before demanding them — see services/repairs.ts.
|
||||||
(v.brokenMpn !== undefined && v.brokenManufacturerId !== undefined);
|
|
||||||
if (!hasModel) {
|
|
||||||
ctx.addIssue({
|
|
||||||
code: z.ZodIssueCode.custom,
|
|
||||||
message: 'Provide brokenPartModelId or both brokenMpn and brokenManufacturerId',
|
|
||||||
path: ['brokenPartModelId'],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
export type LogRepairRequest = z.infer<typeof LogRepairRequest>;
|
export type LogRepairRequest = z.infer<typeof LogRepairRequest>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user