module . exports = { param collectionName async getModel ( collectionName ) { const model = this . model [ collectionName ] || null ; const collections = collectionName . split ( '_' ) ; const type = `${ this . helper . capitalize ( collections [ 0 ] ) }${ this . helper . capitalize ( collections [ 1 ] ) }` ; if ( ! model ) { const module = this . app . models [ type ] ; const collection = await module ( collections [ 2 ] ) ( ) ; this . model [ collectionName ] = collection . model ( collectionName ) ; return collection . model ( collectionName ) ; } return model ; } , param modelName param suffix return async createModel ( modelName , suffix , collectionName ) { const currentModal = await this . getModel ( collectionName ) ; if ( currentModal ) { return null ; } else { const module = this . app . models [ modelName ] ; const model = await module ( suffix ) ( ) ; this . model [ collectionName ] = model . model ( collectionName ) ; return null ; } } , } ;