mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(core): Add ownership, sharing and credential details to GET /workflows (#4510)
* ⚡ Abstract into `getMany()` * ⚡ Use `getMany()` from free controller * ⚡ Use `getMany()` from paid controller * 🧪 Add tests * 🧪 Fix tests * ⚡ Add credential usage info * 🧪 Update tests * ⚡ Add type and adjust test
This commit is contained in:
@@ -11,6 +11,7 @@ import { SharedWorkflow } from '../databases/entities/SharedWorkflow';
|
||||
import { LoggerProxy } from 'n8n-workflow';
|
||||
import * as TagHelpers from '../TagHelpers';
|
||||
import { EECredentialsService as EECredentials } from '../credentials/credentials.service.ee';
|
||||
import { WorkflowsService } from './workflows.services';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export const EEWorkflowController = express.Router();
|
||||
@@ -181,6 +182,25 @@ EEWorkflowController.post(
|
||||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* (EE) GET /workflows
|
||||
*/
|
||||
EEWorkflowController.get(
|
||||
'/',
|
||||
ResponseHelper.send(async (req: WorkflowRequest.GetAll) => {
|
||||
const workflows = (await WorkflowsService.getMany(
|
||||
req.user,
|
||||
req.query.filter,
|
||||
)) as unknown as WorkflowEntity[];
|
||||
|
||||
return Promise.all(
|
||||
workflows.map(async (workflow) =>
|
||||
EEWorkflows.addCredentialsToWorkflow(EEWorkflows.addOwnerAndSharings(workflow), req.user),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
EEWorkflowController.patch(
|
||||
'/:id(\\d+)',
|
||||
ResponseHelper.send(async (req: WorkflowRequest.Update) => {
|
||||
|
||||
Reference in New Issue
Block a user