mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +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({
|
||||
where: { name: In(tags) },
|
||||
relations: ['workflows'],
|
||||
select: {
|
||||
id: true,
|
||||
workflows: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const workflowIdsPerTag = dbTags.map((tag) => tag.workflows.map((workflow) => workflow.id));
|
||||
|
||||
@@ -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'] }),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user