Skip to content

Commit

Permalink
feat: add the necessary project files
Browse files Browse the repository at this point in the history
  • Loading branch information
Hemalatah authored Apr 10, 2017
1 parent 28c8dc0 commit b0a929d
Show file tree
Hide file tree
Showing 6 changed files with 838 additions and 0 deletions.
1 change: 1 addition & 0 deletions client_secrets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"web":{"client_id":"572235577549-tfbi0cfuv710lnbiddopr0ol0lu7ussp.apps.googleusercontent.com","project_id":"restaurant-menu-app-163714","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://accounts.google.com/o/oauth2/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"4uwv69qFZ7_Ui70Lum1wxL-K","redirect_uris":"http://localhost:5000"}}
63 changes: 63 additions & 0 deletions database_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine

Base = declarative_base()


class User(Base):
__tablename__ = 'user'

id = Column(Integer, primary_key=True)
name = Column(String(250), nullable=False)
email = Column(String(250), nullable=False)
picture = Column(String(250))


class Restaurant(Base):
__tablename__ = 'restaurant'

id = Column(Integer, primary_key=True)
name = Column(String(250), nullable=False)
user_id = Column(Integer, ForeignKey('user.id'))
user = relationship(User)

@property
def serialize(self):
"""Return object data in easily serializeable format"""
return {
'name': self.name,
'id': self.id,
}


class MenuItem(Base):
__tablename__ = 'menu_item'

name = Column(String(80), nullable=False)
id = Column(Integer, primary_key=True)
description = Column(String(250))
price = Column(String(8))
course = Column(String(250))
restaurant_id = Column(Integer, ForeignKey('restaurant.id'))
restaurant = relationship(Restaurant)
user_id = Column(Integer, ForeignKey('user.id'))
user = relationship(User)

@property
def serialize(self):
"""Return object data in easily serializeable format"""
return {
'name': self.name,
'description': self.description,
'id': self.id,
'price': self.price,
'course': self.course,
}


engine = create_engine('sqlite:///restaurantmenuwithusers.db')


Base.metadata.create_all(engine)
Binary file added database_setup.pyc
Binary file not shown.
Loading

0 comments on commit b0a929d

Please sign in to comment.