mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 11:06:06 +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>;
|
||||
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
@@ -117,12 +117,12 @@ export const budgetItemSchema = z.object({
|
||||
export type BudgetItem = z.infer<typeof budgetItemSchema>;
|
||||
|
||||
const payerInputSchema = z.object({
|
||||
user_id: z.number(),
|
||||
user_id: z.number().int(),
|
||||
amount: z.number(),
|
||||
});
|
||||
|
||||
const memberInputSchema = z.object({
|
||||
user_id: z.number(),
|
||||
user_id: z.number().int(),
|
||||
amount: z.number().nullable().optional(),
|
||||
});
|
||||
|
||||
@@ -161,17 +161,17 @@ export const budgetCreateItemRequestSchema = z.object({
|
||||
// Equal-split participants. When omitted, the item has no split (planning-only).
|
||||
member_ids: z.array(z.number()).optional(),
|
||||
members: z.array(memberInputSchema).optional(),
|
||||
persons: z.number().nullable().optional(),
|
||||
days: z.number().nullable().optional(),
|
||||
persons: z.number().int().nullable().optional(),
|
||||
days: z.number().int().nullable().optional(),
|
||||
note: z.string().nullable().optional(),
|
||||
ticket_json: z.string().nullable().optional(),
|
||||
expense_date: z.string().nullable().optional(),
|
||||
// Link this expense to a reservation (e.g. created from a booking's
|
||||
// "add expense" flow). The server stores it on budget_items.reservation_id.
|
||||
reservation_id: z.number().optional(),
|
||||
reservation_id: z.number().int().optional(),
|
||||
// The same for a place: the place form's "add expense" flow saves the place
|
||||
// first, then creates the expense against it (#1298).
|
||||
place_id: z.number().optional(),
|
||||
place_id: z.number().int().optional(),
|
||||
// Receipt files to link to this expense
|
||||
receipt_file_ids: z.array(z.number()).optional(),
|
||||
// Rates to freeze a foreign currency with when the server has none of its own.
|
||||
@@ -189,8 +189,8 @@ export const budgetUpdateItemRequestSchema = z.object({
|
||||
payers: z.array(payerInputSchema).optional(),
|
||||
member_ids: z.array(z.number()).optional(),
|
||||
members: z.array(memberInputSchema).optional(),
|
||||
persons: z.number().nullable().optional(),
|
||||
days: z.number().nullable().optional(),
|
||||
persons: z.number().int().nullable().optional(),
|
||||
days: z.number().int().nullable().optional(),
|
||||
note: z.string().nullable().optional(),
|
||||
ticket_json: z.string().nullable().optional(),
|
||||
expense_date: z.string().nullable().optional(),
|
||||
@@ -244,8 +244,8 @@ export const budgetSettlementSchema = z.object({
|
||||
export type BudgetSettlement = z.infer<typeof budgetSettlementSchema>;
|
||||
|
||||
export const budgetCreateSettlementRequestSchema = z.object({
|
||||
from_user_id: z.number(),
|
||||
to_user_id: z.number(),
|
||||
from_user_id: z.number().int(),
|
||||
to_user_id: z.number().int(),
|
||||
amount: z.number(),
|
||||
// The display currency the amount was entered in; the server freezes its FX rate.
|
||||
currency: z.string().nullable().optional(),
|
||||
@@ -261,8 +261,8 @@ export type BudgetCreateSettlementRequest = z.infer<typeof budgetCreateSettlemen
|
||||
|
||||
/** Edit a persisted settle-up transfer (same fields as create; full replace). */
|
||||
export const budgetUpdateSettlementRequestSchema = z.object({
|
||||
from_user_id: z.number(),
|
||||
to_user_id: z.number(),
|
||||
from_user_id: z.number().int(),
|
||||
to_user_id: z.number().int(),
|
||||
amount: z.number(),
|
||||
currency: z.string().nullable().optional(),
|
||||
settled_at: z.string().nullable().optional(),
|
||||
|
||||
@@ -29,7 +29,7 @@ export const collabNoteUpdateRequestSchema = z.object({
|
||||
content: z.string().nullable().optional(),
|
||||
category: z.string().nullable().optional(),
|
||||
color: z.string().nullable().optional(),
|
||||
pinned: z.union([z.boolean(), z.number()]).optional(),
|
||||
pinned: z.union([z.boolean(), z.number().int()]).optional(),
|
||||
website: z.string().nullable().optional(),
|
||||
});
|
||||
export type CollabNoteUpdateRequest = z.infer<typeof collabNoteUpdateRequestSchema>;
|
||||
@@ -44,7 +44,7 @@ export const collabPollCreateRequestSchema = z.object({
|
||||
export type CollabPollCreateRequest = z.infer<typeof collabPollCreateRequestSchema>;
|
||||
|
||||
export const collabPollVoteRequestSchema = z.object({
|
||||
option_index: z.number(),
|
||||
option_index: z.number().int(),
|
||||
});
|
||||
export type CollabPollVoteRequest = z.infer<typeof collabPollVoteRequestSchema>;
|
||||
|
||||
@@ -57,14 +57,14 @@ const httpUrl = z.url().refine((value) => /^https?:\/\//i.test(value.trim()), 'A
|
||||
export const collabLinkCreateRequestSchema = z.object({
|
||||
title: z.string().trim().min(1),
|
||||
url: httpUrl,
|
||||
pinned: z.union([z.boolean(), z.number()]).optional(),
|
||||
pinned: z.union([z.boolean(), z.number().int()]).optional(),
|
||||
});
|
||||
export type CollabLinkCreateRequest = z.infer<typeof collabLinkCreateRequestSchema>;
|
||||
|
||||
export const collabLinkUpdateRequestSchema = z.object({
|
||||
title: z.string().trim().min(1).optional(),
|
||||
url: httpUrl.optional(),
|
||||
pinned: z.union([z.boolean(), z.number()]).optional(),
|
||||
pinned: z.union([z.boolean(), z.number().int()]).optional(),
|
||||
});
|
||||
export type CollabLinkUpdateRequest = z.infer<typeof collabLinkUpdateRequestSchema>;
|
||||
|
||||
@@ -73,7 +73,7 @@ export type CollabLinkUpdateRequest = z.infer<typeof collabLinkUpdateRequestSche
|
||||
export const collabMessageCreateRequestSchema = z.object({
|
||||
text: z.string().max(5000).optional(),
|
||||
// Multipart fields arrive as strings; JSON chat still sends a number/null.
|
||||
reply_to: z.union([z.number(), z.string(), z.null()]).optional(),
|
||||
reply_to: z.union([z.number().int(), z.string(), z.null()]).optional(),
|
||||
});
|
||||
export type CollabMessageCreateRequest = z.infer<typeof collabMessageCreateRequestSchema>;
|
||||
|
||||
|
||||
@@ -157,15 +157,15 @@ export type CollectionReorderRequest = z.infer<typeof collectionReorderRequestSc
|
||||
|
||||
/** Save a place into a list from a raw maps/manual payload (or carrying provenance). */
|
||||
export const collectionSavePlaceRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
source_place_id: z.number().nullable().optional(),
|
||||
source_trip_id: z.number().nullable().optional(),
|
||||
collection_id: z.number().int(),
|
||||
source_place_id: z.number().int().nullable().optional(),
|
||||
source_trip_id: z.number().int().nullable().optional(),
|
||||
name: z.string().min(1),
|
||||
description: z.string().nullable().optional(),
|
||||
lat: z.number().nullable().optional(),
|
||||
lng: z.number().nullable().optional(),
|
||||
address: z.string().nullable().optional(),
|
||||
category_id: z.number().nullable().optional(),
|
||||
category_id: z.number().int().nullable().optional(),
|
||||
price: z.number().nullable().optional(),
|
||||
currency: z.string().nullable().optional(),
|
||||
notes: z.string().nullable().optional(),
|
||||
@@ -184,17 +184,17 @@ export type CollectionSavePlaceRequest = z.infer<typeof collectionSavePlaceReque
|
||||
|
||||
/** DEDICATED DTO for POST /places/from-trip — the server reads the place, so no place payload. */
|
||||
export const collectionSaveFromTripRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
source_trip_id: z.number(),
|
||||
source_place_id: z.number(),
|
||||
collection_id: z.number().int(),
|
||||
source_trip_id: z.number().int(),
|
||||
source_place_id: z.number().int(),
|
||||
force: z.boolean().optional(),
|
||||
});
|
||||
export type CollectionSaveFromTripRequest = z.infer<typeof collectionSaveFromTripRequestSchema>;
|
||||
|
||||
/** Bulk: copy several selected trip places into a list at once. */
|
||||
export const collectionSaveFromTripManyRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
source_trip_id: z.number(),
|
||||
collection_id: z.number().int(),
|
||||
source_trip_id: z.number().int(),
|
||||
source_place_ids: z.array(z.number()).min(1).max(1000),
|
||||
force: z.boolean().optional(),
|
||||
});
|
||||
@@ -215,8 +215,8 @@ export const collectionPlaceUpdateRequestSchema = z.object({
|
||||
// undefined (left unchanged) instead of being injected as 'idea' (see #1437). The
|
||||
// .catch('idea') guard against invalid values is preserved.
|
||||
status: collectionStatusSchema.removeDefault().optional(),
|
||||
category_id: z.number().nullable().optional(),
|
||||
collection_id: z.number().optional(), // move to another list
|
||||
category_id: z.number().int().nullable().optional(),
|
||||
collection_id: z.number().int().optional(), // move to another list
|
||||
links: collectionLinksSchema.optional(),
|
||||
tag_ids: z.array(z.number()).optional(),
|
||||
// Replace the place's per-collection label assignments (omit to leave unchanged).
|
||||
@@ -250,7 +250,7 @@ export type CollectionSetStatusManyRequest = z.infer<typeof collectionSetStatusM
|
||||
/** Same, but naming the places by their TRIP ids: the server resolves each one to
|
||||
* the lists it is saved in. Drives the planner's bulk "mark as visited" (#1469). */
|
||||
export const collectionSetStatusFromTripRequestSchema = z.object({
|
||||
trip_id: z.number(),
|
||||
trip_id: z.number().int(),
|
||||
place_ids: z.array(z.number()).min(1).max(1000),
|
||||
status: collectionStatusSchema,
|
||||
});
|
||||
@@ -273,7 +273,7 @@ export type CollectionDeleteManyRequest = z.infer<typeof collectionDeleteManyReq
|
||||
|
||||
/** Copy one or many saved places INTO a trip (dedup precheck on server). */
|
||||
export const collectionCopyToTripRequestSchema = z.object({
|
||||
trip_id: z.number(),
|
||||
trip_id: z.number().int(),
|
||||
place_ids: z.array(z.number()).min(1),
|
||||
force: z.boolean().optional(),
|
||||
});
|
||||
@@ -328,32 +328,32 @@ export type CollectionPlacesPageRequest = z.infer<typeof collectionPlacesPageReq
|
||||
|
||||
// Fusion invitations. user_id is NUMERIC ONLY — the UI always sends an id from availableUsers.
|
||||
export const collectionInviteRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
user_id: z.number(),
|
||||
collection_id: z.number().int(),
|
||||
user_id: z.number().int(),
|
||||
role: collectionRoleSchema.optional(),
|
||||
});
|
||||
export type CollectionInviteRequest = z.infer<typeof collectionInviteRequestSchema>;
|
||||
|
||||
export const collectionInviteActionRequestSchema = z.object({ collection_id: z.number() });
|
||||
export const collectionInviteActionRequestSchema = z.object({ collection_id: z.number().int() });
|
||||
export type CollectionInviteActionRequest = z.infer<typeof collectionInviteActionRequestSchema>;
|
||||
|
||||
export const collectionInviteCancelRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
user_id: z.number(),
|
||||
collection_id: z.number().int(),
|
||||
user_id: z.number().int(),
|
||||
});
|
||||
export type CollectionInviteCancelRequest = z.infer<typeof collectionInviteCancelRequestSchema>;
|
||||
|
||||
/** Owner removes an ALREADY-ACCEPTED member (kick). */
|
||||
export const collectionRemoveMemberRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
user_id: z.number(),
|
||||
collection_id: z.number().int(),
|
||||
user_id: z.number().int(),
|
||||
});
|
||||
export type CollectionRemoveMemberRequest = z.infer<typeof collectionRemoveMemberRequestSchema>;
|
||||
|
||||
/** Owner changes an accepted member's permission role. */
|
||||
export const collectionSetMemberRoleRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
user_id: z.number(),
|
||||
collection_id: z.number().int(),
|
||||
user_id: z.number().int(),
|
||||
role: collectionRoleSchema,
|
||||
});
|
||||
export type CollectionSetMemberRoleRequest = z.infer<typeof collectionSetMemberRoleRequestSchema>;
|
||||
@@ -363,7 +363,7 @@ const labelColorSchema = z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
|
||||
|
||||
/** Create a custom label in a list. */
|
||||
export const collectionLabelCreateRequestSchema = z.object({
|
||||
collection_id: z.number(),
|
||||
collection_id: z.number().int(),
|
||||
name: z.string().trim().min(1).max(60),
|
||||
color: labelColorSchema.optional(),
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ import { z } from 'zod';
|
||||
* bodies. The bespoke 400/403/404 controller messages pin the rest.
|
||||
*/
|
||||
|
||||
const nullableIdField = z.union([z.string(), z.number()]).nullable().optional();
|
||||
const nullableIdField = z.union([z.string(), z.number().int()]).nullable().optional();
|
||||
|
||||
/**
|
||||
* Multipart text fields riding along with the upload — always strings on the
|
||||
|
||||
@@ -25,6 +25,8 @@ const looseBoolean = z.union([z.boolean(), z.literal('true'), z.literal('false')
|
||||
|
||||
/** `Number(x) || fallback` — the client sends these as strings from query-ish forms. */
|
||||
const looseNumber = z.union([z.number(), z.string()]).optional();
|
||||
/** A row id the same loose way: a whole number, or a string the service converts. */
|
||||
const looseId = z.union([z.number().int(), z.string()]).optional();
|
||||
|
||||
/**
|
||||
* The UTC offset the caller means its calendar days in, in minutes east of UTC
|
||||
@@ -119,7 +121,7 @@ export const synologySearchSchema = z.looseObject({
|
||||
export const photoSelectionSchema = z.looseObject({
|
||||
provider: z.string(),
|
||||
asset_ids: z.array(z.string()),
|
||||
owner_id: z.number().optional(),
|
||||
owner_id: z.number().int().optional(),
|
||||
passphrase: z.string().optional(),
|
||||
});
|
||||
|
||||
@@ -131,13 +133,13 @@ export const addTripPhotosSchema = z.looseObject({
|
||||
});
|
||||
|
||||
export const setTripPhotoSharingSchema = z.looseObject({
|
||||
photo_id: looseNumber,
|
||||
photo_id: looseId,
|
||||
shared: z.unknown().optional(),
|
||||
});
|
||||
|
||||
/** The photo to unlink from the trip. Same shape the sharing toggle takes. */
|
||||
export const removeTripPhotoSchema = z.looseObject({
|
||||
photo_id: looseNumber,
|
||||
photo_id: looseId,
|
||||
});
|
||||
|
||||
export const createAlbumLinkSchema = z.looseObject({
|
||||
|
||||
@@ -102,9 +102,9 @@ export const packingCreateItemRequestSchema = z.object({
|
||||
checked: z.union([z.boolean(), z.number().int().min(0).max(1)]).optional(),
|
||||
// Same shapes as the update schema below (#2154) — the create route used to
|
||||
// strip these three silently, forcing a second write to set them.
|
||||
weight_grams: z.number().nullable().optional(),
|
||||
bag_id: z.number().nullable().optional(),
|
||||
quantity: z.number().optional(),
|
||||
weight_grams: z.number().int().nullable().optional(),
|
||||
bag_id: z.number().int().nullable().optional(),
|
||||
quantity: z.number().int().optional(),
|
||||
// Mark the new item private to its creator (#858, legacy flag).
|
||||
is_private: z.boolean().optional(),
|
||||
// Three-tier sharing (#858): which list the item belongs to, and — for 'shared' —
|
||||
@@ -133,9 +133,9 @@ export const packingUpdateItemRequestSchema = z.object({
|
||||
// The legacy route accepted both boolean and 0/1 for checked — both stay valid.
|
||||
checked: z.union([z.boolean(), z.number().int().min(0).max(1)]).optional(),
|
||||
category: z.string().optional(),
|
||||
weight_grams: z.number().nullable().optional(),
|
||||
bag_id: z.number().nullable().optional(),
|
||||
quantity: z.number().optional(),
|
||||
weight_grams: z.number().int().nullable().optional(),
|
||||
bag_id: z.number().int().nullable().optional(),
|
||||
quantity: z.number().int().optional(),
|
||||
// Count packed pieces of a multi-piece item (#2296). Reaching the quantity
|
||||
// checks the item; null or 0 clears the count. Ticking `checked` resets it.
|
||||
packed_quantity: z.number().int().min(0).max(999).nullable().optional(),
|
||||
@@ -158,15 +158,15 @@ export const packingCreateBagRequestSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
color: z.string().optional(),
|
||||
// Same shape as the update schema below (#2154) — POST used to strip it.
|
||||
weight_limit_grams: z.number().nullable().optional(),
|
||||
weight_limit_grams: z.number().int().nullable().optional(),
|
||||
});
|
||||
export type PackingCreateBagRequest = z.infer<typeof packingCreateBagRequestSchema>;
|
||||
|
||||
export const packingUpdateBagRequestSchema = z.object({
|
||||
name: z.string().optional(),
|
||||
color: z.string().optional(),
|
||||
weight_limit_grams: z.number().nullable().optional(),
|
||||
user_id: z.number().nullable().optional(),
|
||||
weight_limit_grams: z.number().int().nullable().optional(),
|
||||
user_id: z.number().int().nullable().optional(),
|
||||
});
|
||||
export type PackingUpdateBagRequest = z.infer<typeof packingUpdateBagRequestSchema>;
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ export const placeBulkUpdateRequestSchema = z.object({
|
||||
ids: z.array(z.number()),
|
||||
// null clears the category ("No category"); a number sets it. Optional so the
|
||||
// field can be omitted, but the endpoint requires it to be present to act.
|
||||
category_id: z.number().nullable().optional(),
|
||||
category_id: z.number().int().nullable().optional(),
|
||||
});
|
||||
export type PlaceBulkUpdateRequest = z.infer<typeof placeBulkUpdateRequestSchema>;
|
||||
|
||||
|
||||
@@ -283,15 +283,15 @@ export const reservationPositionsRequestSchema = z.object({
|
||||
// day_plan_position is optional on the wire: the legacy route never
|
||||
// validated position items, and an absent value binds NULL (clears the
|
||||
// stored position) — pinned by the server integration suite (RESV-006).
|
||||
positions: z.array(z.object({ id: z.number(), day_plan_position: z.number().optional() })),
|
||||
day_id: z.union([z.number(), z.string()]).nullable().optional(),
|
||||
positions: z.array(z.object({ id: z.number().int(), day_plan_position: z.number().optional() })),
|
||||
day_id: z.union([z.number().int(), z.string()]).nullable().optional(),
|
||||
});
|
||||
export type ReservationPositionsRequest = z.infer<typeof reservationPositionsRequestSchema>;
|
||||
|
||||
export const accommodationCreateRequestSchema = z.object({
|
||||
place_id: z.union([z.number(), z.string()]),
|
||||
start_day_id: z.union([z.number(), z.string()]),
|
||||
end_day_id: z.union([z.number(), z.string()]),
|
||||
place_id: z.union([z.number().int(), z.string()]),
|
||||
start_day_id: z.union([z.number().int(), z.string()]),
|
||||
end_day_id: z.union([z.number().int(), z.string()]),
|
||||
check_in: z.string().nullable().optional(),
|
||||
check_in_end: z.string().nullable().optional(),
|
||||
check_out: z.string().nullable().optional(),
|
||||
|
||||
@@ -17,8 +17,8 @@ export const todoCreateItemRequestSchema = z.object({
|
||||
category: z.string().nullable().optional(),
|
||||
due_date: z.string().nullable().optional(),
|
||||
description: z.string().nullable().optional(),
|
||||
assigned_user_id: z.number().nullable().optional(),
|
||||
priority: z.number().optional(),
|
||||
assigned_user_id: z.number().int().nullable().optional(),
|
||||
priority: z.number().int().optional(),
|
||||
});
|
||||
export type TodoCreateItemRequest = z.infer<typeof todoCreateItemRequestSchema>;
|
||||
|
||||
@@ -31,8 +31,8 @@ export const todoUpdateItemRequestSchema = z.object({
|
||||
category: z.string().nullable().optional(),
|
||||
due_date: z.string().nullable().optional(),
|
||||
description: z.string().nullable().optional(),
|
||||
assigned_user_id: z.number().nullable().optional(),
|
||||
priority: z.number().nullable().optional(),
|
||||
assigned_user_id: z.number().int().nullable().optional(),
|
||||
priority: z.number().int().nullable().optional(),
|
||||
});
|
||||
export type TodoUpdateItemRequest = z.infer<typeof todoUpdateItemRequestSchema>;
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ export const tripCreateRequestSchema = z.object({
|
||||
start_date: z.string().nullable().optional(),
|
||||
end_date: z.string().nullable().optional(),
|
||||
currency: z.string().optional(),
|
||||
reminder_days: z.number().optional(),
|
||||
reminder_days: z.number().int().optional(),
|
||||
day_count: z.number().optional(),
|
||||
});
|
||||
export type TripCreateRequest = z.infer<typeof tripCreateRequestSchema>;
|
||||
@@ -127,9 +127,9 @@ export const tripUpdateRequestSchema = z.object({
|
||||
*/
|
||||
date_shift_mode: z.enum(['keep_bookings', 'shift_all']).optional(),
|
||||
currency: z.string().optional(),
|
||||
reminder_days: z.number().optional(),
|
||||
reminder_days: z.number().int().optional(),
|
||||
day_count: z.number().optional(),
|
||||
is_archived: z.union([z.boolean(), z.number()]).optional(),
|
||||
is_archived: z.union([z.boolean(), z.number().int()]).optional(),
|
||||
// Bounded like a place's image url: a replaced cover is queued for release,
|
||||
// and every upload path the old value spells out is one queued object.
|
||||
cover_image: z.string().max(2048).nullable().optional(),
|
||||
|
||||
@@ -29,7 +29,7 @@ export const vacayUpdatePlanRequestSchema = z.object({
|
||||
company_holidays_enabled: z.boolean().optional(),
|
||||
carry_over_enabled: z.boolean().optional(),
|
||||
weekend_days: z.string().optional(),
|
||||
week_start: z.number().optional(),
|
||||
week_start: z.number().int().optional(),
|
||||
});
|
||||
export type VacayUpdatePlanRequest = z.infer<typeof vacayUpdatePlanRequestSchema>;
|
||||
|
||||
@@ -60,17 +60,17 @@ export const vacaySetColorRequestSchema = z.object({
|
||||
export type VacaySetColorRequest = z.infer<typeof vacaySetColorRequestSchema>;
|
||||
|
||||
export const vacayInviteRequestSchema = z.object({
|
||||
user_id: z.union([z.number(), z.string()]),
|
||||
user_id: z.union([z.number().int(), z.string()]),
|
||||
});
|
||||
export type VacayInviteRequest = z.infer<typeof vacayInviteRequestSchema>;
|
||||
|
||||
export const vacayInviteActionRequestSchema = z.object({
|
||||
plan_id: z.number().optional(),
|
||||
plan_id: z.number().int().optional(),
|
||||
});
|
||||
export type VacayInviteActionRequest = z.infer<typeof vacayInviteActionRequestSchema>;
|
||||
|
||||
export const vacayAddYearRequestSchema = z.object({
|
||||
year: z.union([z.number(), z.string()]),
|
||||
year: z.union([z.number().int(), z.string()]),
|
||||
});
|
||||
export type VacayAddYearRequest = z.infer<typeof vacayAddYearRequestSchema>;
|
||||
|
||||
@@ -110,7 +110,7 @@ export const vacayCompanyHolidayRequestSchema = z.object({
|
||||
export type VacayCompanyHolidayRequest = z.infer<typeof vacayCompanyHolidayRequestSchema>;
|
||||
|
||||
export const vacayUpdateStatsRequestSchema = z.object({
|
||||
vacation_days: z.number().optional(),
|
||||
vacation_days: z.number().int().optional(),
|
||||
target_user_id: z.union([z.number(), z.string()]).optional(),
|
||||
});
|
||||
export type VacayUpdateStatsRequest = z.infer<typeof vacayUpdateStatsRequestSchema>;
|
||||
@@ -118,7 +118,7 @@ export type VacayUpdateStatsRequest = z.infer<typeof vacayUpdateStatsRequestSche
|
||||
// Read-only calendar sharing (#444/#667): grant another user view access to
|
||||
// your vacation calendar without fusing plans.
|
||||
export const vacayShareRequestSchema = z.object({
|
||||
user_id: z.union([z.number(), z.string()]),
|
||||
user_id: z.union([z.number().int(), z.string()]),
|
||||
});
|
||||
export type VacayShareRequest = z.infer<typeof vacayShareRequestSchema>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user