File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ class TMongoDBPlugin extends TAbstractDatabasePlugin {
2727 this . _schemas = value
2828 }
2929
30+ addSchema ( value ) {
31+ this . _schemas . push ( value )
32+ }
33+
3034 get types ( ) {
3135 return this . _types
3236 }
@@ -144,10 +148,13 @@ class TMongoDBPlugin extends TAbstractDatabasePlugin {
144148 }
145149
146150 beforeRegisterRoutes ( Mongoose ) {
151+
147152 super . beforeRegisterRoutes ( Mongoose )
148153
149154 this . _registerTypes ( Mongoose )
150155 TMongoDBPlugin . _registerTypesTo ( Mongoose , this . __dirname )
156+
157+ this . _registerSchemas ( Mongoose )
151158 TMongoDBPlugin . _registerSchemasTo ( Mongoose , this . __dirname )
152159
153160 }
@@ -163,6 +170,17 @@ class TMongoDBPlugin extends TAbstractDatabasePlugin {
163170
164171 }
165172
173+ _registerSchemas ( Mongoose ) {
174+
175+ for ( let schema of this . _schemas ) {
176+
177+ console . log ( `Register schema: ${ schema . name } ` )
178+ schema ( Mongoose )
179+
180+ }
181+
182+ }
183+
166184}
167185
168186export { TMongoDBPlugin }
You can’t perform that action at this time.
0 commit comments