feat(web): add display number for workflow

This commit is contained in:
BennyKok
2023-12-19 12:19:46 +08:00
parent 59ec8ecb06
commit 39dd760ba0
3 changed files with 8 additions and 3 deletions
+4 -1
View File
@@ -1,12 +1,15 @@
import { db } from "@/db/db";
import { deploymentsTable, workflowRunsTable } from "@/db/schema";
import { desc, eq } from "drizzle-orm";
import { desc, eq, sql } from "drizzle-orm";
export async function findAllRuns(workflow_id: string) {
return await db.query.workflowRunsTable.findMany({
where: eq(workflowRunsTable.workflow_id, workflow_id),
orderBy: desc(workflowRunsTable.created_at),
limit: 10,
extras: {
"number": sql<number>`row_number() over (order by created_at)`.as("number"),
},
with: {
machine: {
columns: {