refactoring models and create grant to async await

This commit is contained in:
Arjun Patel
2019-03-16 23:49:11 -07:00
parent e5c204890e
commit 5587c296e4
6 changed files with 97 additions and 79 deletions
+21 -2
View File
@@ -1,14 +1,33 @@
const Organization = require('./Organization'),
Grant = require('./Grant');
module.exports = (sequelize, DataTypes) => {
const GrantsOrganizations = sequelize.define('Grants_Organizations', {
const GrantOrganization = sequelize.define('GrantOrganization', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
grant_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: Grant(sequelize, DataTypes),
key: 'id'
}
},
organization_id: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: Organization(sequelize, DataTypes),
key: 'id'
}
},
amount: {
type: DataTypes.INTEGER,
allowNull: false
}
});
return GrantsOrganizations;
return GrantOrganization;
};