Created
August 7, 2016 14:03
-
-
Save nehalist/4ae5761dd8d2d37a53dd3ec8e754272f to your computer and use it in GitHub Desktop.
This file contains 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
// models/Project.js | |
module.exports = { | |
attributes: { | |
title: { | |
type: Sequelize.STRING | |
} | |
}, | |
associations: function() { | |
Project.belongsTo(Customer); | |
Project.hasMany(Contributor); | |
} | |
}; | |
// models/Contributor.js | |
module.exports = { | |
attributes: { | |
note: { | |
type: Sequelize.STRING | |
}, | |
}, | |
associations: function() { | |
Contributor.belongsTo(Project); | |
Contributor.belongsTo(User); | |
} | |
}; | |
// models/Customer.js | |
module.exports = { | |
attributes: { | |
name: { | |
type: Sequelize.STRING | |
} | |
}, | |
associations: function() { | |
Customer.hasMany(Project); | |
} | |
}; | |
// models/User.js | |
module.exports = { | |
attributes: { | |
username: { | |
type: Sequelize.STRING | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment