@tmlmobilidade/types
Version:
23 lines (22 loc) • 907 B
JavaScript
/* * */
import { DocumentSchema } from '../_common/document.js';
import { GtfsAgencySchema } from '../gtfs/agency.js';
import { GtfsFeedInfoSchema } from '../gtfs/feed-info.js';
import { PlanAppStatusSchema } from './plan-app-status.js';
import { PlanPcgiLegacySchema } from './plan-pcgi-legacy.js';
import { z } from 'zod';
/* * */
export const PlanSchema = DocumentSchema.extend({
apps: z.object({
controller: PlanAppStatusSchema,
merger: PlanAppStatusSchema,
}).default({}),
gtfs_agency: GtfsAgencySchema,
gtfs_feed_info: GtfsFeedInfoSchema,
hash: z.string(),
is_locked: z.boolean().default(false),
operation_file_id: z.string(),
pcgi_legacy: PlanPcgiLegacySchema,
});
export const CreatePlanSchema = PlanSchema.omit({ _id: true, created_at: true, updated_at: true });
export const UpdatePlanSchema = CreatePlanSchema.omit({ created_by: true }).partial();