fix(API): Add shared field to workflows list rest API handler (#17804)

This commit is contained in:
Guillaume Jacquart
2025-08-11 10:04:07 +02:00
committed by GitHub
parent a5fa808d4a
commit 31af6d11bb
4 changed files with 42 additions and 2 deletions

View File

@@ -103,7 +103,7 @@ export class ExportWorkflowsCommand extends BaseCommand<z.infer<typeof flagsSche
const workflows = await Container.get(WorkflowRepository).find({ const workflows = await Container.get(WorkflowRepository).find({
where: flags.id ? { id: flags.id } : {}, where: flags.id ? { id: flags.id } : {},
relations: ['tags'], relations: ['tags', 'shared', 'shared.project'],
}); });
if (workflows.length === 0) { if (workflows.length === 0) {

View File

@@ -0,0 +1,31 @@
type: object
additionalProperties: false
properties:
role:
type: string
example: 'workflow:owner'
workflowId:
type: string
example: '2tUt1wbLX592XDdX'
projectId:
type: string
example: '2tUt1wbLX592XDdX'
project:
type: object
properties:
id:
type: string
readOnly: true
name:
type: string
type:
type: string
readOnly: true
createdAt:
type: string
format: date-time
readOnly: true
updatedAt:
type: string
format: date-time
readOnly: true

View File

@@ -46,3 +46,7 @@ properties:
items: items:
$ref: '../../../tags/spec/schemas/tag.yml' $ref: '../../../tags/spec/schemas/tag.yml'
readOnly: true readOnly: true
shared:
type: array
items:
$ref: './sharedWorkflow.yml'

View File

@@ -225,18 +225,23 @@ export = {
'meta', 'meta',
'versionId', 'versionId',
'triggerCount', 'triggerCount',
'shared',
]; ];
if (!excludePinnedData) { if (!excludePinnedData) {
selectFields.push('pinData'); selectFields.push('pinData');
} }
const relations = ['shared'];
if (!Container.get(GlobalConfig).tags.disabled) {
relations.push('tags');
}
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, select: selectFields,
relations,
where, where,
...(!Container.get(GlobalConfig).tags.disabled && { relations: ['tags'] }),
}); });
if (excludePinnedData) { if (excludePinnedData) {