Skip to content

Commit

Permalink
Refactors exports in model files to use es2015 modules (diegohaz#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdschaffe authored and diegohaz committed Nov 16, 2016
1 parent 06e600c commit aab2a8d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions generators/api/templates/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ const <%= camel %>Schema = new Schema({}, { timestamps: true })
}
}

module.exports = mongoose.model('<%= pascal %>', <%= camel %>Schema)
export default module.exports
const model = mongoose.model('<%= pascal %>', <%= camel %>Schema)

export const schema = model.schema
export default model
6 changes: 4 additions & 2 deletions generators/app/templates/api/password-reset/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ passwordResetSchema.methods = {
}
}

module.exports = mongoose.model('PasswordReset', passwordResetSchema)
export default module.exports
const model = mongoose.model('PasswordReset', passwordResetSchema)

export const schema = model.schema
export default model
6 changes: 4 additions & 2 deletions generators/app/templates/api/user/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,7 @@ userSchema.statics = {

userSchema.plugin(mongooseKeywords, { paths: ['email', 'name'] })

module.exports = mongoose.model('User', userSchema)
export default module.exports
const model = mongoose.model('User', userSchema)

export const schema = model.schema
export default model

0 comments on commit aab2a8d

Please sign in to comment.