From 08adadcfea044f4e2858b22996dca33972c4e4d2 Mon Sep 17 00:00:00 2001 From: imbytecat Date: Sun, 18 Jan 2026 03:45:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84Todo=E5=90=88?= =?UTF-8?q?=E7=BA=A6=E9=AA=8C=E8=AF=81=E6=A8=A1=E5=BC=8F=EF=BC=8C=E5=88=86?= =?UTF-8?q?=E7=A6=BB=E6=8F=92=E5=85=A5=E4=B8=8E=E6=9B=B4=E6=96=B0=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重构Todo合约验证模式,分离插入和更新数据的校验Schema,并移除不必要的字段。 --- src/orpc/contracts/todo.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/orpc/contracts/todo.ts b/src/orpc/contracts/todo.ts index 69ea79f..b9195a7 100644 --- a/src/orpc/contracts/todo.ts +++ b/src/orpc/contracts/todo.ts @@ -7,11 +7,7 @@ import { import { z } from 'zod' import { todoTable } from '@/db/schema' -const selectSchema = createSelectSchema(todoTable).omit({ - id: true, - createdAt: true, - updatedAt: true, -}) +const selectSchema = createSelectSchema(todoTable) const insertSchema = createInsertSchema(todoTable).omit({ id: true, @@ -19,7 +15,11 @@ const insertSchema = createInsertSchema(todoTable).omit({ updatedAt: true, }) -const updateSchema = createUpdateSchema(todoTable) +const updateSchema = createUpdateSchema(todoTable).omit({ + id: true, + createdAt: true, + updatedAt: true, +}) export const todoContract = { list: oc.input(z.void()).output(z.array(selectSchema)),