tasko/actions/update-card/schema.ts

37 lines
810 B
TypeScript
Raw Normal View History

2024-02-16 01:49:19 +00:00
import { z } from 'zod';
2024-02-15 02:30:10 +00:00
export const UpdateCard = z.object({
boardId: z.string(),
description: z.optional(
z
.string({
2024-02-16 01:49:19 +00:00
invalid_type_error: 'Description must be a string',
required_error: 'Description is required',
2024-02-15 02:30:10 +00:00
})
.min(3, {
2024-02-16 01:49:19 +00:00
message: 'Description must be at least 3 characters',
2024-02-15 02:30:10 +00:00
})
),
title: z.optional(
z
.string({
2024-02-16 01:49:19 +00:00
required_error: 'Title is required',
invalid_type_error: 'Title must be a string',
2024-02-15 02:30:10 +00:00
})
.min(3, {
2024-02-16 01:49:19 +00:00
message: 'Title must be at least 3 characters',
2024-02-15 02:30:10 +00:00
})
),
dueDate: z.optional(
z.date({
invalid_type_error: 'Due date must be a date',
})
),
startedAt: z.optional(
z.date({
invalid_type_error: 'Due date must be a date',
})
),
2024-02-15 02:30:10 +00:00
id: z.string(),
});