mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 19:40:34 +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:
@@ -40,12 +40,12 @@ export type AdminPermissionsRequest = z.infer<typeof adminPermissionsRequestSche
|
||||
export const adminInviteCreateRequestSchema = z.object({
|
||||
// string | number: the service parses with parseInt(String(x)), and the
|
||||
// admin UI sends numbers while older clients sent strings.
|
||||
max_uses: z.union([z.number(), z.string()]).optional(),
|
||||
max_uses: z.union([z.number().int(), z.string()]).optional(),
|
||||
expires_in_days: z.union([z.number(), z.string()]).optional(),
|
||||
role: z.enum(['user', 'admin']).optional(),
|
||||
// Optional trip binding (#1402): a user who registers via the link is
|
||||
// auto-added to this trip. Nullable/absent = a plain registration invite.
|
||||
trip_id: z.union([z.number(), z.string()]).nullable().optional(),
|
||||
trip_id: z.union([z.number().int(), z.string()]).nullable().optional(),
|
||||
});
|
||||
export type AdminInviteCreateRequest = z.infer<typeof adminInviteCreateRequestSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user