import type { RunSummary } from "@codemation/core"; import { inject } from "@codemation/core"; import { ApplicationTokens } from "../../applicationTokens"; import type { WorkflowRunRepository } from "../../domain/runs/WorkflowRunRepository"; import { HandlesQuery } from "../../infrastructure/di/HandlesQueryRegistry"; import { QueryHandler } from "../bus/QueryHandler"; import { ListWorkflowRunsQuery } from "./ListWorkflowRunsQuery"; @HandlesQuery.for(ListWorkflowRunsQuery) export class ListWorkflowRunsQueryHandler extends QueryHandler> { constructor( @inject(ApplicationTokens.WorkflowRunRepository) private readonly workflowRunRepository: WorkflowRunRepository, ) { super(); } async execute(query: ListWorkflowRunsQuery): Promise> { return await this.workflowRunRepository.listRuns({ workflowId: query.workflowId, limit: 50 }); } }