mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
perf(core): Improvements to GET /workflows endpoint (#17086)
This commit is contained in:
@@ -65,6 +65,12 @@ export class TagRepository extends Repository<TagEntity> {
|
|||||||
const dbTags = await this.find({
|
const dbTags = await this.find({
|
||||||
where: { name: In(tags) },
|
where: { name: In(tags) },
|
||||||
relations: ['workflows'],
|
relations: ['workflows'],
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
workflows: {
|
||||||
|
id: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const workflowIdsPerTag = dbTags.map((tag) => tag.workflows.map((workflow) => workflow.id));
|
const workflowIdsPerTag = dbTags.map((tag) => tag.workflows.map((workflow) => workflow.id));
|
||||||
|
|||||||
@@ -211,9 +211,30 @@ export = {
|
|||||||
where.id = In(workflowsIds);
|
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({
|
const [workflows, count] = await Container.get(WorkflowRepository).findAndCount({
|
||||||
skip: offset,
|
skip: offset,
|
||||||
take: limit,
|
take: limit,
|
||||||
|
select: selectFields,
|
||||||
where,
|
where,
|
||||||
...(!Container.get(GlobalConfig).tags.disabled && { relations: ['tags'] }),
|
...(!Container.get(GlobalConfig).tags.disabled && { relations: ['tags'] }),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user