perf(core): Improvements to GET /workflows endpoint (#17086)

This commit is contained in:
Ricardo Espinoza
2025-07-08 14:40:55 -04:00
committed by GitHub
parent f3ef0a713c
commit cc39c50737
2 changed files with 27 additions and 0 deletions

View File

@@ -65,6 +65,12 @@ export class TagRepository extends Repository<TagEntity> {
const dbTags = await this.find({
where: { name: In(tags) },
relations: ['workflows'],
select: {
id: true,
workflows: {
id: true,
},
},
});
const workflowIdsPerTag = dbTags.map((tag) => tag.workflows.map((workflow) => workflow.id));

View File

@@ -211,9 +211,30 @@ export = {
where.id = In(workflowsIds);
}
const selectFields: (keyof WorkflowEntity)[] = [
'id',
'name',
'active',
'createdAt',
'updatedAt',
'isArchived',
'nodes',
'connections',
'settings',
'staticData',
'meta',
'versionId',
'triggerCount',
];
if (!excludePinnedData) {
selectFields.push('pinData');
}
const [workflows, count] = await Container.get(WorkflowRepository).findAndCount({
skip: offset,
take: limit,
select: selectFields,
where,
...(!Container.get(GlobalConfig).tags.disabled && { relations: ['tags'] }),
});