changes to organization model

This commit is contained in:
Arjun Patel
2019-03-13 22:10:06 -07:00
parent 0c88460b54
commit ac5d5db1ff
5 changed files with 109 additions and 57 deletions
+9 -4
View File
@@ -1,9 +1,11 @@
const uuidv4 = require('uuid/v4');
module.exports = (sequelize, DataTypes) => {
const Donor = sequelize.define('donors', {
id: {
type: DataTypes.INTEGER,
type: DataTypes.UUID,
primaryKey: true,
autoIncrement: true
defaultValue: uuidv4()
},
stripe_id: {
type: DataTypes.UUID,
@@ -28,17 +30,20 @@ module.exports = (sequelize, DataTypes) => {
validate: {
isEmail: true
},
allowNull: false
allowNull: false,
unique: true
},
password: {
type: DataTypes.STRING,
allowNull: false
},
age: DataTypes.INTEGER,
phone: DataTypes.BIGINT,
phone: DataTypes.DataTypes.STRING(20),
address: DataTypes.STRING,
city: DataTypes.STRING,
state: DataTypes.STRING,
zip: DataTypes.STRING(10),
country: DataTypes.STRING
});
return Donor;
+38 -18
View File
@@ -1,22 +1,28 @@
const uuidv4 = require('uuid/v4');
module.exports = (sequelize, DataTypes) => {
const Organization = sequelize.define('organizations', {
id: {
type: DataTypes.INTEGER,
type: DataTypes.UUID,
primaryKey: true,
autoIncrement: true
defaultValue: uuidv4()
},
name: { type: DataTypes.STRING, allowNull: false },
email: {
short_description: { type: DataTypes.STRING, allowNull: false },
primary_contact_email: {
type: DataTypes.STRING,
validate: {
isEmail: true
},
allowNull: false
allowNull: false,
unique: true
},
phone: {
password: {
type: DataTypes.STRING,
allowNull: false
},
address: {
type: DataTypes.STRING,
allowNull: false
@@ -25,29 +31,27 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.STRING,
allowNull: false
},
state: {
type: DataTypes.STRING(5),
allowNull: false
},
country: {
type: DataTypes.STRING,
defaultValue: 'USA',
allowNull: false
},
zip: {
type: DataTypes.STRING,
type: DataTypes.STRING(10),
allowNull: false
},
password: {
type: DataTypes.STRING,
allowNull: false
},
verified: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false
},
short_description: DataTypes.STRING,
primary_cause: { type: DataTypes.STRING, allowNull: false },
primary_region: { type: DataTypes.STRING, allowNull: false },
rating: { type: DataTypes.INTEGER, defaultValue: 0, allowNull: false },
total_rating: { type: DataTypes.INTEGER, defaultValue: 0 },
ein: {
type: DataTypes.STRING,
type: DataTypes.INTEGER,
allowNull: false
},
estimate_assets: {
@@ -58,6 +62,22 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.INTEGER,
defaultValue: 0
},
isNonprofit: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false
},
isVerified: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false
},
primary_contact_phone: {
type: DataTypes.STRING(20),
allowNull: false
},
primary_contact_first_name: {
type: DataTypes.STRING,
allowNull: false