mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(API): Add shared field to workflows list rest API handler (#17804)
This commit is contained in:
committed by
GitHub
parent
a5fa808d4a
commit
31af6d11bb
@@ -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) {
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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'
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user