diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts new file mode 100644 index 0000000..9d06011 --- /dev/null +++ b/src/lib/schemas.ts @@ -0,0 +1,61 @@ +import { z } from "zod"; + +export const checklistItemSchema = z.object({ + id: z.string(), + text: z.string(), + checked: z.boolean(), +}); + +export const attachmentSchema = z.object({ + id: z.string(), + name: z.string(), + path: z.string(), + mode: z.enum(["link", "copy"]).default("link"), +}); + +export const labelSchema = z.object({ + id: z.string(), + name: z.string(), + color: z.string(), +}); + +export const cardSchema = z.object({ + id: z.string(), + title: z.string(), + description: z.string().default(""), + labels: z.array(z.string()).default([]), + checklist: z.array(checklistItemSchema).default([]), + dueDate: z.string().nullable().default(null), + attachments: z.array(attachmentSchema).default([]), + createdAt: z.string(), + updatedAt: z.string(), +}); + +export const columnSchema = z.object({ + id: z.string(), + title: z.string(), + cardIds: z.array(z.string()).default([]), + width: z.enum(["narrow", "standard", "wide"]).default("standard"), +}); + +export const boardSettingsSchema = z.object({ + attachmentMode: z.enum(["link", "copy"]).default("link"), +}); + +export const boardSchema = z.object({ + id: z.string(), + title: z.string(), + color: z.string().default("#6366f1"), + createdAt: z.string(), + updatedAt: z.string(), + columns: z.array(columnSchema).default([]), + cards: z.record(z.string(), cardSchema).default({}), + labels: z.array(labelSchema).default([]), + settings: boardSettingsSchema.default({ attachmentMode: "link" }), +}); + +export const appSettingsSchema = z.object({ + theme: z.enum(["light", "dark", "system"]).default("system"), + dataDirectory: z.string().nullable().default(null), + recentBoardIds: z.array(z.string()).default([]), +}); diff --git a/src/types/board.ts b/src/types/board.ts new file mode 100644 index 0000000..9b62eaf --- /dev/null +++ b/src/types/board.ts @@ -0,0 +1,64 @@ +export interface Board { + id: string; + title: string; + color: string; + createdAt: string; + updatedAt: string; + columns: Column[]; + cards: Record; + labels: Label[]; + settings: BoardSettings; +} + +export interface Column { + id: string; + title: string; + cardIds: string[]; + width: ColumnWidth; +} + +export type ColumnWidth = "narrow" | "standard" | "wide"; + +export interface Card { + id: string; + title: string; + description: string; + labels: string[]; + checklist: ChecklistItem[]; + dueDate: string | null; + attachments: Attachment[]; + createdAt: string; + updatedAt: string; +} + +export interface Label { + id: string; + name: string; + color: string; +} + +export interface ChecklistItem { + id: string; + text: string; + checked: boolean; +} + +export interface Attachment { + id: string; + name: string; + path: string; + mode: "link" | "copy"; +} + +export interface BoardSettings { + attachmentMode: "link" | "copy"; +} + +export interface BoardMeta { + id: string; + title: string; + color: string; + cardCount: number; + columnCount: number; + updatedAt: string; +} diff --git a/src/types/settings.ts b/src/types/settings.ts new file mode 100644 index 0000000..df9d675 --- /dev/null +++ b/src/types/settings.ts @@ -0,0 +1,5 @@ +export interface AppSettings { + theme: "light" | "dark" | "system"; + dataDirectory: string | null; + recentBoardIds: string[]; +}