fix: Add createSelectSchema for workflowVersionTable

This commit is contained in:
BennyKok 2024-01-24 02:11:56 +00:00
parent b24bdb070e
commit 6437de4def

View File

@ -1,8 +1,9 @@
import { workflowVersionSchema } from "@/db/schema"; import { workflowVersionSchema, workflowVersionTable } from "@/db/schema";
import type { App } from "@/routes/app"; import type { App } from "@/routes/app";
import { authError } from "@/routes/authError"; import { authError } from "@/routes/authError";
import { getWorkflowVersion } from "@/server/crudWorkflow"; import { getWorkflowVersion } from "@/server/crudWorkflow";
import { z, createRoute } from "@hono/zod-openapi"; import { z, createRoute } from "@hono/zod-openapi";
import { createSelectSchema } from "drizzle-zod";
const route = createRoute({ const route = createRoute({
method: "get", method: "get",
@ -19,7 +20,20 @@ const route = createRoute({
200: { 200: {
content: { content: {
"application/json": { "application/json": {
schema: workflowVersionSchema, schema: createSelectSchema(workflowVersionTable, {
workflow_api: (schema) =>
schema.workflow_api.openapi({
type: "object",
}),
workflow: (schema) =>
schema.workflow.openapi({
type: "object",
}),
snapshot: (schema) =>
schema.snapshot.openapi({
type: "object",
}),
}),
}, },
}, },
description: "Retrieve the output", description: "Retrieve the output",