diff --git a/src/orpc/contract.ts b/src/orpc/contract.ts index 19f8b05..c132aa1 100644 --- a/src/orpc/contract.ts +++ b/src/orpc/contract.ts @@ -1,5 +1,5 @@ -import { todoContract } from './contracts/todo' +import * as todo from './contracts/todo' export const contract = { - todo: todoContract, + todo, } diff --git a/src/orpc/contracts/todo.ts b/src/orpc/contracts/todo.ts index b9195a7..4e06241 100644 --- a/src/orpc/contracts/todo.ts +++ b/src/orpc/contracts/todo.ts @@ -21,25 +21,23 @@ const updateSchema = createUpdateSchema(todoTable).omit({ updatedAt: true, }) -export const todoContract = { - list: oc.input(z.void()).output(z.array(selectSchema)), +export const list = oc.input(z.void()).output(z.array(selectSchema)) - create: oc.input(insertSchema).output(selectSchema), +export const create = oc.input(insertSchema).output(selectSchema) - update: oc - .input( - z.object({ - id: z.uuid(), - data: updateSchema, - }), - ) - .output(selectSchema), +export const update = oc + .input( + z.object({ + id: z.uuid(), + data: updateSchema, + }), + ) + .output(selectSchema) - remove: oc - .input( - z.object({ - id: z.uuid(), - }), - ) - .output(z.void()), -} +export const remove = oc + .input( + z.object({ + id: z.uuid(), + }), + ) + .output(z.void())