Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

940 B
Raw Blame
import { z } from 'zod';

/**
 * Trip invite-link API contract (#1143).
 *
 * Members with 'share_manage' create/rotate the trip's single invite token
 * under POST /api/trips/:tripId/invite-link. `expires_in_days` accepts
 * number | digits-only string | null | absent on the wire: the client always
 * sends the key (null when no expiry was chosen — see tripInviteApi.createLink),
 * and the legacy raw-body route also took numeric strings from form input (the
 * empty string meaning "no expiry"). The string branch is digits-only so
 * garbage like "7abc" is a 400 instead of silently parseInt-ing to 7; the
 * controller still owns the number coercion (non-positive → no expiry).
 */
export const tripInviteLinkCreateRequestSchema = z.object({
  expires_in_days: z.union([z.number(), z.string().regex(/^\d*$/), z.null()]).optional(),
});
export type TripInviteLinkCreateRequest = z.infer<typeof tripInviteLinkCreateRequestSchema>;