mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 06:37:33 +00:00
feat(contracts): todo, settings, collab and file routes declare their response schemas
shared gains the response schemas these routes answer with (rows in their storage spelling, as the routes have always sent them) plus the common success and empty answers, all exported for the client to type its calls with. Every JSON handler in the four controllers carries its @ResponseContract; the file download, which streams, is marked exempt. The files e2e fixture table gains the note_id column the real one has.
This commit is contained in:
@@ -20,3 +20,10 @@ export const nonEmptyString = z.string().trim().min(1);
|
||||
|
||||
/** ISO-8601 timestamp string (the shape TREK serialises dates as in JSON). */
|
||||
export const isoDateTime = z.string().datetime({ offset: true });
|
||||
|
||||
/** The `{ success: true }` body a write answers with when it has nothing else to say. */
|
||||
export const successResponseSchema = z.object({ success: z.literal(true) });
|
||||
export type SuccessResponse = z.infer<typeof successResponseSchema>;
|
||||
|
||||
/** A 204 answer: the handler returns nothing, so no body goes out. */
|
||||
export const emptyResponseSchema = z.undefined();
|
||||
|
||||
Reference in New Issue
Block a user