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.

19 lines (18 loc) 727 B
/* * */ import { DocumentSchema } from './_common/document.js'; import { z } from 'zod'; /* * */ export const FileSchema = DocumentSchema.extend({ created_by: z.string(), description: z.string().nullish(), metadata: z.record(z.unknown()).nullish(), name: z.string(), resource_id: z.string(), scope: z.string(), size: z.number().describe('size in bytes'), type: z.string().describe('mime type'), updated_by: z.string(), url: z.string().nullish(), }).strict(); export const CreateFileSchema = FileSchema.omit({ _id: true, created_at: true, updated_at: true }); export const UpdateFileSchema = FileSchema.omit({ _id: true, created_at: true, created_by: true, updated_at: true }).partial();