feat(core): Filter executions by project ID in internal API (#10976)
This commit is contained in:
@@ -54,6 +54,8 @@ import { ExecutionDataRepository } from './execution-data.repository';
|
||||
import type { ExecutionData } from '../entities/execution-data';
|
||||
import { ExecutionEntity } from '../entities/execution-entity';
|
||||
import { ExecutionMetadata } from '../entities/execution-metadata';
|
||||
import { SharedWorkflow } from '../entities/shared-workflow';
|
||||
import { WorkflowEntity } from '../entities/workflow-entity';
|
||||
|
||||
export interface IGetExecutionsQueryFilter {
|
||||
id?: FindOperator<string> | string;
|
||||
@@ -874,6 +876,7 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
||||
metadata,
|
||||
annotationTags,
|
||||
vote,
|
||||
projectId,
|
||||
} = query;
|
||||
|
||||
const fields = Object.keys(this.summaryFields)
|
||||
@@ -945,6 +948,12 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {
|
||||
}
|
||||
}
|
||||
|
||||
if (projectId) {
|
||||
qb.innerJoin(WorkflowEntity, 'w', 'w.id = execution.workflowId')
|
||||
.innerJoin(SharedWorkflow, 'sw', 'sw.workflowId = w.id')
|
||||
.where('sw.projectId = :projectId', { projectId });
|
||||
}
|
||||
|
||||
return qb;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ export namespace ExecutionSummaries {
|
||||
startedBefore: string;
|
||||
annotationTags: string[]; // tag IDs
|
||||
vote: AnnotationVote;
|
||||
projectId: string;
|
||||
}>;
|
||||
|
||||
type AccessFields = {
|
||||
|
||||
Reference in New Issue
Block a user