| 15 | * Returns null if no matching record exists. |
| 16 | */ |
| 17 | export async function getLogById(id: string): Promise<LogRecord | null> { |
| 18 | const [record] = await db |
| 19 | .select({ |
| 20 | id: workflowExecutionLogs.id, |
| 21 | workspaceId: workflowExecutionLogs.workspaceId, |
| 22 | startedAt: workflowExecutionLogs.startedAt, |
| 23 | workflowName: workflow.name, |
| 24 | }) |
| 25 | .from(workflowExecutionLogs) |
| 26 | .leftJoin(workflow, eq(workflowExecutionLogs.workflowId, workflow.id)) |
| 27 | .where(eq(workflowExecutionLogs.id, id)) |
| 28 | .limit(1) |
| 29 | |
| 30 | return record ?? null |
| 31 | } |