specs for donors model
This commit is contained in:
@@ -18,10 +18,7 @@ exports.create = (req, res) => {
|
||||
});
|
||||
} else {
|
||||
// hash and store
|
||||
bcrypt.hash(req.body.password, null, null, function(
|
||||
error,
|
||||
hash
|
||||
) {
|
||||
bcrypt.hash(req.body.password, null, null, function(error, hash) {
|
||||
// Store hash in your password DB.
|
||||
if (error) {
|
||||
return res.status(500).json({
|
||||
@@ -49,8 +46,6 @@ exports.create = (req, res) => {
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
|
||||
return res.status(500).json({
|
||||
error
|
||||
});
|
||||
@@ -60,8 +55,6 @@ exports.create = (req, res) => {
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
|
||||
return res.status(500).json({
|
||||
error
|
||||
});
|
||||
|
||||
+39
-24
@@ -1,25 +1,40 @@
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const Donors = sequelize.define('donors', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
first_name: DataTypes.STRING,
|
||||
middle_name: DataTypes.STRING,
|
||||
last_name: DataTypes.STRING,
|
||||
email: DataTypes.STRING,
|
||||
password: DataTypes.STRING,
|
||||
age: DataTypes.INTEGER,
|
||||
phone: DataTypes.BIGINT,
|
||||
address: DataTypes.STRING,
|
||||
city: DataTypes.STRING,
|
||||
state: DataTypes.STRING,
|
||||
country: DataTypes.STRING
|
||||
},
|
||||
{
|
||||
freezeTableName: true,
|
||||
}
|
||||
);
|
||||
return Donors;
|
||||
}
|
||||
const Donors = sequelize.define(
|
||||
'donors',
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
first_name: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
middle_name: DataTypes.STRING,
|
||||
last_name: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
email: {
|
||||
type: DataTypes.STRING,
|
||||
isEmail: true,
|
||||
allowNull: false
|
||||
},
|
||||
password: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
age: DataTypes.INTEGER,
|
||||
phone: DataTypes.BIGINT,
|
||||
address: DataTypes.STRING,
|
||||
city: DataTypes.STRING,
|
||||
state: DataTypes.STRING,
|
||||
country: DataTypes.STRING
|
||||
},
|
||||
{
|
||||
freezeTableName: true
|
||||
}
|
||||
);
|
||||
return Donors;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user