fix: update workflow run with workflow id

This commit is contained in:
BennyKok
2023-12-10 20:59:23 +08:00
parent e5b8b4f7d9
commit ed853fc5f1
7 changed files with 377 additions and 11 deletions
+2 -10
View File
@@ -39,16 +39,8 @@ export async function findFirstTableWithVersion(workflow_id: string) {
}
export async function findAllRuns(workflow_id: string) {
const workflowVersion = await db.query.workflowVersionTable.findFirst({
where: eq(workflowVersionTable.workflow_id, workflow_id),
});
if (!workflowVersion) {
return [];
}
return await db.query.workflowRunsTable.findMany({
where: eq(workflowRunsTable.workflow_version_id, workflowVersion?.id),
where: eq(workflowRunsTable.workflow_id, workflow_id),
orderBy: desc(workflowRunsTable.created_at),
with: {
machine: {
@@ -77,7 +69,7 @@ export default async function Page({
return (
<div className="mt-4 w-full flex flex-col lg:flex-row gap-4">
<Card className="w-full lg:w-fit lg:min-w-[500px]">
<Card className="w-full lg:w-fit lg:min-w-[500px] h-fit">
<CardHeader>
<CardTitle>{workflow?.name}</CardTitle>
<CardDescription suppressHydrationWarning={true}>
+3
View File
@@ -78,6 +78,8 @@ export async function POST(request: Request) {
});
});
console.log(result);
// return the error
if (result instanceof Response) {
return result;
@@ -88,6 +90,7 @@ export async function POST(request: Request) {
.insert(workflowRunsTable)
.values({
id: result.prompt_id,
workflow_id: workflow_version_data.workflow_id,
workflow_version_id: workflow_version_data.id,
machine_id,
})