@@ -5,7 +5,7 @@ import { Hono } from "hono";
55import { z } from "zod" ;
66
77import { ApiContext } from "../../context" ;
8- import { createDatabase , organizations , workflows } from "../../db" ;
8+ import { createDatabase , organizations } from "../../db" ;
99import { CloudflareExecutionStore } from "../../runtime/cloudflare-execution-store" ;
1010
1111const adminExecutionsRoutes = new Hono < ApiContext > ( ) ;
@@ -127,10 +127,9 @@ adminExecutionsRoutes.get(
127127 const result = ( await response . json ( ) ) as { data ?: any [ ] } ;
128128 const rows = result . data || [ ] ;
129129
130- // Get organization and workflow names for the results
130+ // Get organization names for the results
131131 const db = createDatabase ( c . env . DB ) ;
132132 const orgIds = [ ...new Set ( rows . map ( ( r ) => r . index1 ) ) ] ;
133- const workflowIds = [ ...new Set ( rows . map ( ( r ) => r . blob2 ) ) ] ;
134133
135134 // Fetch organization names
136135 const orgsMap = new Map < string , string > ( ) ;
@@ -141,15 +140,6 @@ adminExecutionsRoutes.get(
141140 orgs . forEach ( ( o ) => orgsMap . set ( o . id , o . name ) ) ;
142141 }
143142
144- // Fetch workflow names
145- const workflowsMap = new Map < string , string > ( ) ;
146- if ( workflowIds . length > 0 ) {
147- const wfs = await db
148- . select ( { id : workflows . id , name : workflows . name } )
149- . from ( workflows ) ;
150- wfs . forEach ( ( w ) => workflowsMap . set ( w . id , w . name ) ) ;
151- }
152-
153143 const executions = rows . map ( ( row ) => {
154144 const timestamp = new Date ( row . timestamp ) ;
155145 const startedAt = row . double2 ? new Date ( row . double2 ) : timestamp ;
@@ -158,7 +148,7 @@ adminExecutionsRoutes.get(
158148 return {
159149 id : row . blob1 ,
160150 workflowId : row . blob2 ,
161- workflowName : workflowsMap . get ( row . blob2 ) || "Unknown Workflow" ,
151+ workflowName : row . blob6 || "Unknown Workflow" ,
162152 organizationId : row . index1 ,
163153 organizationName : orgsMap . get ( row . index1 ) || "Unknown Organization" ,
164154 status : row . blob4 as ExecutionStatusType ,
@@ -213,14 +203,9 @@ adminExecutionsRoutes.get(
213203 return c . json ( { error : "Execution not found" } , 404 ) ;
214204 }
215205
216- // Get workflow and org names
206+ // Get org name
217207 const db = createDatabase ( c . env . DB ) ;
218208
219- const [ workflow ] = await db
220- . select ( { name : workflows . name } )
221- . from ( workflows )
222- . where ( eq ( workflows . id , execution . workflowId ) ) ;
223-
224209 const [ org ] = await db
225210 . select ( { name : organizations . name } )
226211 . from ( organizations )
@@ -230,7 +215,7 @@ adminExecutionsRoutes.get(
230215 execution : {
231216 id : execution . id ,
232217 workflowId : execution . workflowId ,
233- workflowName : workflow ?. name || "Unknown Workflow" ,
218+ workflowName : execution . workflowName ,
234219 organizationId,
235220 organizationName : org ?. name || "Unknown Organization" ,
236221 status : execution . status ,
0 commit comments