Created
November 28, 2018 10:30
-
-
Save Eth3rnit3/cb0f87d03657f30b2e623b88c8679659 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = (sequelize, DataTypes) => { | |
const User = sequelize.define('User', { | |
email: DataTypes.STRING, | |
firstName: DataTypes.STRING, | |
lastName: DataTypes.STRING, | |
companyId: DataTypes.INTEGER | |
}, {}); | |
User.associate = function(models) { | |
User.belongsTo(models.Company, {foreignKey: 'companyId', as: 'company'}) | |
}; | |
return User; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment