Skip to content

Commit

Permalink
move nodes routes to a controller class
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Mar 6, 2023
1 parent a6d7b42 commit e36aacc
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 156 deletions.
15 changes: 7 additions & 8 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import config from '@/config';
import * as Queue from '@/Queue';
import { getSharedWorkflowIds } from '@/WorkflowHelpers';

import { nodesController } from '@/api/nodes.api';
import { workflowsController } from '@/workflows/workflows.controller';
import {
EDITOR_UI_DIST_DIR,
Expand All @@ -85,6 +84,7 @@ import {
AuthController,
LdapController,
MeController,
NodesController,
NodeTypesController,
OwnerController,
PasswordResetController,
Expand Down Expand Up @@ -401,6 +401,12 @@ class Server extends AbstractServer {
controllers.push(new LdapController(service, sync, internalHooks));
}

if (config.getEnv('nodes.communityPackages.enabled')) {
controllers.push(
new NodesController(config, this.loadNodesAndCredentials, this.push, internalHooks),
);
}

controllers.forEach((controller) => registerController(app, config, controller));
}

Expand Down Expand Up @@ -486,13 +492,6 @@ class Server extends AbstractServer {

this.app.use(`/${this.restEndpoint}/credentials`, credentialsController);

// ----------------------------------------
// Packages and nodes management
// ----------------------------------------
if (config.getEnv('nodes.communityPackages.enabled')) {
this.app.use(`/${this.restEndpoint}/nodes`, nodesController);
}

// ----------------------------------------
// Workflow
// ----------------------------------------
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/controllers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { AuthController } from './auth.controller';
export { LdapController } from './ldap.controller';
export { MeController } from './me.controller';
export { NodesController } from './nodes.controller';
export { NodeTypesController } from './nodeTypes.controller';
export { OwnerController } from './owner.controller';
export { PasswordResetController } from './passwordReset.controller';
Expand Down
Loading

0 comments on commit e36aacc

Please sign in to comment.