feat: add deployment endpoint
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user