File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,21 @@ module.exports = class SequelizeTrailpack extends Trailpack {
4242 _ . each ( this . models , ( model , modelName ) => {
4343 _ . each ( this . connections , ( connection , name ) => {
4444 if ( model . connection == name ) {
45- this . app . orm [ model . globalId ] = connection . define ( modelName , model . schema , model . config )
45+ const Model = connection . define ( modelName , model . schema , model . config )
46+
47+ if ( model . config . classMethods ) {
48+ for ( let methodName in model . config . classMethods ) {
49+ Model [ methodName ] = model . config . classMethods [ methodName ]
50+ }
51+ }
52+
53+ if ( model . config . instanceMethods ) {
54+ for ( let methodName in model . config . instanceMethods ) {
55+ Model . prototype [ methodName ] = model . config . instanceMethods [ methodName ]
56+ }
57+ }
58+
59+ this . app . orm [ model . globalId ] = Model
4660 }
4761 } )
4862 } )
You can’t perform that action at this time.
0 commit comments