mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
fix(db): refuse a fraction for an integer column at the request boundary
Every integer column is bigint on Postgres. SQLite stored a fraction sent to one (a packing quantity of 1.5, a budget item for 2.5 days, an id of 3.5) as a REAL, while Postgres rounded it in a statement MikroORM renders and refused it with a 500 in a Kysely statement, so the engines held different data for the same request. The request schemas of those fields now take whole numbers only, and INTCOL (tests/unit/contracts/integer-columns.test.ts) holds the class: it reads the integer columns from the entities and fails on any DTO field or inline MCP tool field of that name that takes any number.
This commit is contained in:
@@ -74,7 +74,7 @@ export const assignmentSchema = z.object({
|
||||
export type Assignment = z.infer<typeof assignmentSchema>;
|
||||
|
||||
export const assignmentCreateRequestSchema = z.object({
|
||||
place_id: z.union([z.number(), z.string()]),
|
||||
place_id: z.union([z.number().int(), z.string()]),
|
||||
notes: z.string().nullable().optional(),
|
||||
/**
|
||||
* MDT-02: puts one stage of a multi-day tour on the day instead of the whole
|
||||
@@ -94,7 +94,7 @@ export const assignmentMoveRequestSchema = z.object({
|
||||
new_day_id: z.union([z.number(), z.string()]),
|
||||
// The client api types this `number | null` (assignmentsApi.move) and the
|
||||
// legacy route accepted null (`orderIndex || 0`) — keep null on the wire.
|
||||
order_index: z.number().nullable().optional(),
|
||||
order_index: z.number().int().nullable().optional(),
|
||||
});
|
||||
export type AssignmentMoveRequest = z.infer<typeof assignmentMoveRequestSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user