Permalink
Browse files

added models and server files with boilerplate

  • Loading branch information...
brianogilvie committed Feb 9, 2019
1 parent f568b8d commit b5c4565048d6818196118a7fdc7f95c27c7d4137
Showing with 506 additions and 2 deletions.
  1. +48 −0 models/index.js
  2. +420 −0 package-lock.json
  3. +8 −2 package.json
  4. +1 −0 scripts/createDb.sh
  5. +13 −0 scripts/resetDb.js
  6. 0 scripts/seed.js
  7. +16 −0 server.js
@@ -0,0 +1,48 @@
const Sequelize = require('sequelize')
const dbName = 'ladybird_db'

const db = new Sequelize({
database: dbName,
dialect: 'postgres',
define: {
underscored: true
}
})

const Cocktail = db.define('cocktail', {
name: {
type: Sequelize.STRING,
allowNull: false,
},
small_price: Sequelize.INTEGER,
large_price: Sequelize.INTEGER,
ingredients: Sequelize.STRING,
alcohol_free: Sequelize.BOOLEAN,
})

const Wine = db.define('wine', {
category: {
type: Sequelize.ENUM,
values: ['white', 'rose', 'red']
},
varietal: Sequelize.STRING,
vineyard: Sequelize.STRING,
year: {
type: Sequelize.INTEGER,
len: [4,4],
},
glass_price: Sequelize.INTEGER,
bottle_price: Sequelize.INTEGER,
})

const Food = db.define('food', {
name: Sequelize.STRING,
ingredients: Sequelize.STRING,
price: Sequelize.INTEGER,
a_la_carte: {
type: Sequelize.BOOLEAN,
defaultValue: false,
}
})

module.exports = {db, Cocktail}
Oops, something went wrong.

0 comments on commit b5c4565

Please sign in to comment.