From 5b24e7b726401f45ee46f01491027e966e01b92d Mon Sep 17 00:00:00 2001 From: Tristan VALCKE Date: Mon, 12 Aug 2019 17:52:21 +0200 Subject: [PATCH] fix(tabstractdatabaseplugin): update controller ctor call and parameters --- sources/core/plugins/TAbstractDatabasePlugin.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/core/plugins/TAbstractDatabasePlugin.js b/sources/core/plugins/TAbstractDatabasePlugin.js index 4b2eb49..882caa5 100644 --- a/sources/core/plugins/TAbstractDatabasePlugin.js +++ b/sources/core/plugins/TAbstractDatabasePlugin.js @@ -19,9 +19,10 @@ class TAbstractDatabasePlugin { for ( let index = 0, numberOfDescriptor = descriptors.length ; index < numberOfDescriptor ; index++ ) { - const descriptor = descriptors[ index ] - const controller = new ControllerCtors[ descriptor.controller.name ]( Driver, descriptor.controller.options ) - const router = Router( { mergeParams: true } ) + const descriptor = descriptors[ index ] + const ControllerClass = ControllerCtors.get( descriptor.controller.name ) + const controller = new ControllerClass( { driver: Driver, ...descriptor.controller.options } ) + const router = Router( { mergeParams: true } ) console.log( `\tAdd controller for base route: ${descriptor.route}` ) Application.use( descriptor.route, TAbstractDatabasePlugin._populateRouter( router, controller, descriptor.controller.can ) )