UNPKG

@tmlmobilidade/types

Version:

This package provides shared Zod validation schemas and their corresponding TypeScript types for use across projects. All types are automatically inferred from the schemas to ensure full type safety and reduce maintenance overhead.

38 lines (37 loc) 1.27 kB
/* * */ import { DocumentSchema } from '../_common/document.js'; import { z } from 'zod'; /* * */ export const HashedTripWaypointSchema = z.object({ arrival_time: z.string(), departure_time: z.string(), drop_off_type: z.string(), pickup_type: z.string(), shape_dist_traveled: z.number(), stop_id: z.string(), stop_lat: z.number(), stop_lon: z.number(), stop_name: z.string(), stop_sequence: z.number(), timepoint: z.string(), }).strict(); export const CreateHashedTripWaypointSchema = HashedTripWaypointSchema; export const UpdateHashedTripWaypointSchema = HashedTripWaypointSchema.partial(); ; /* * */ export const HashedTripSchema = DocumentSchema.extend({ agency_id: z.string(), line_id: z.string(), line_long_name: z.string(), line_short_name: z.string(), path: z.array(HashedTripWaypointSchema), pattern_id: z.string(), route_color: z.string(), route_id: z.string(), route_long_name: z.string(), route_short_name: z.string(), route_text_color: z.string(), trip_headsign: z.string(), }).strict(); export const CreateHashedTripSchema = HashedTripSchema.omit({ created_at: true, updated_at: true }); export const UpdateHashedTripSchema = CreateHashedTripSchema.partial();