feat: add deployment endpoint

This commit is contained in:
BennyKok
2023-12-14 22:36:57 +08:00
parent 0835d966f1
commit 7e05fae7b3
29 changed files with 1776 additions and 190 deletions
+20 -1
View File
@@ -1,5 +1,5 @@
import { db } from "@/db/db";
import { workflowRunsTable } from "@/db/schema";
import { deploymentsTable, workflowRunsTable } from "@/db/schema";
import { desc, eq } from "drizzle-orm";
export async function findAllRuns(workflow_id: string) {
@@ -21,3 +21,22 @@ export async function findAllRuns(workflow_id: string) {
},
});
}
export async function findAllDeployments(workflow_id: string) {
return await db.query.deploymentsTable.findMany({
where: eq(deploymentsTable.workflow_id, workflow_id),
orderBy: desc(deploymentsTable.environment),
with: {
machine: {
columns: {
name: true,
},
},
version: {
columns: {
version: true,
},
},
},
});
}