Skip to content
This repository was archived by the owner on Feb 11, 2020. It is now read-only.

Commit 2c97f46

Browse files
author
Dr. Safi
committed
Add rethinnkdb connection option to nestedUnit controller.
1 parent f5cec4a commit 2c97f46

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

module/reusableNestedUnit/Controller.class.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import { mix } from 'mixwith'
1616
export default ({
1717
methodInstanceName,
1818
Superclass = EventEmitter, // defaulting to EventEmitter and not Object / Function because extending Object/Function manipulates this prototype in new calls for some reason.
19-
mixin
19+
mixin,
20+
rethinkdbConnection = Superclass.rethinkdbConnection
2021
}) => {
2122
let mixinArray = [/*commonMethod*/]
2223
let self =
@@ -35,6 +36,8 @@ export default ({
3536
@superclassInstanceContextPattern() // applied on the mixin i.e. specific controller.
3637
class ReusableController extends mix(Superclass).with(...mixinArray) {
3738

39+
static rethinkdbConnection = rethinkdbConnection
40+
3841
@cacheInstance({
3942
cacheArrayName: 'nestedUnit',
4043
keyArgumentName: 'nestedUnitKey'

module/reusableNestedUnit/entrypoint.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ let counter = [] // allows to have a unique set of relations among different nes
2525
function createStaticInstanceClasses({
2626
Superclass, /* Usually the higher Application class */
2727
implementationType,
28-
cacheName = false /* {Boolean || String} */
28+
cacheName = false, /* {Boolean || String} */
29+
rethinkdbConnection
2930
} = {}) {
3031
// Used as caching key.
3132
let automaticCacheNaming;
@@ -88,7 +89,8 @@ function createStaticInstanceClasses({
8889
let Controller = ControllerFunc({
8990
methodInstanceName: cacheName,
9091
Superclass,
91-
mixin: implementationConfig.ControllerMixin
92+
mixin: implementationConfig.ControllerMixin,
93+
rethinkdbConnection
9294
})
9395
let NestedUnit = NestedUnitFunc({ Superclass: Controller })
9496
let Unit = UnitFunc({ Superclass: Controller })

0 commit comments

Comments
 (0)