File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,23 @@ 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 ) {
48+ if ( model . config . classMethods ) {
49+ for ( const methodName in model . config . classMethods ) {
50+ Model [ methodName ] = model . config . classMethods [ methodName ]
51+ }
52+ }
53+
54+ if ( model . config . instanceMethods ) {
55+ for ( const methodName in model . config . instanceMethods ) {
56+ Model . prototype [ methodName ] = model . config . instanceMethods [ methodName ]
57+ }
58+ }
59+ }
60+
61+ this . app . orm [ model . globalId ] = Model
4662 }
4763 } )
4864 } )
Original file line number Diff line number Diff line change 2424 "dependencies" : {
2525 "joi" : " ^10.1.0" ,
2626 "lodash" : " ^4.17.3" ,
27- "sequelize" : " ^3.28.0 " ,
27+ "sequelize" : " ^4.3.1 " ,
2828 "snyk" : " ^1.22.1" ,
2929 "trailpack-datastore" : " ^2.0.0" ,
3030 "trails-service" : " ^2.0.0"
You can’t perform that action at this time.
0 commit comments