Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
change template of default models for sequelize (access to types from…
Browse files Browse the repository at this point in the history
… DataTypes) (#267)
  • Loading branch information
maximelkin authored and daffl committed Sep 1, 2017
1 parent 613596a commit 27c4b6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions generators/service/templates/model/sequelize-user.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// See http://docs.sequelizejs.com/en/latest/docs/models-definition/
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
const sequelizeClient = app.get('sequelizeClient');
const <%= camelName %> = sequelizeClient.define('<%= kebabName %>', {
<% if(authentication.strategies.indexOf('local') !== -1) { %>
email: {
type: Sequelize.STRING,
allowNull: true,
type: DataTypes.STRING,
allowNull: false,
unique: true
},
password: {
type: Sequelize.STRING,
allowNull: true
type: DataTypes.STRING,
allowNull: false
},
<% } %>
<% authentication.oauthProviders.forEach(provider => { %>
Expand Down
3 changes: 2 additions & 1 deletion generators/service/templates/model/sequelize.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// See http://docs.sequelizejs.com/en/latest/docs/models-definition/
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
const sequelizeClient = app.get('sequelizeClient');
const <%= camelName %> = sequelizeClient.define('<%= kebabName %>', {
text: {
type: Sequelize.STRING,
type: DataTypes.STRING,
allowNull: false
}
}, {
Expand Down

0 comments on commit 27c4b6b

Please sign in to comment.