class Feedback(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(50)) rating = db.Column(db.Integer, nullable=False) #ename = db.Column(db.String(50),db.ForeignKey('event.name')) eventId = db.Column(db.Integer, db.ForeignKey('event.id')) comment = db.Column(db.String(1000), nullable=False)
class Comment(db.Model): __tablename__ = 'Comment' commentid = db.Column(db.Integer, primary_key=True) eventid = db.Column(db.Integer, db.ForeignKey('Event.eventid')) guestid = db.Column(db.Integer, db.ForeignKey('Guest.guestid')) comment = db.Column(db.String(50)) def __init__(self, eventid, guestid, comment): self.eventid = eventid self.guestid = guestid self.comment = comment def get_commentId(self): try: return unicode(self.commentid) # python 2 support except NameError: return str(self.commentid) # python 3 support
class Event(db.Model): #Additional Attributes - Question 5 id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) name = db.Column(db.String(50), nullable=False) description = db.Column(db.String(1000), nullable=False) category = db.Column(db.String(50), nullable=False) start_date = db.Column(db.String(20), nullable=False) start_time = db.Column(db.String(20), nullable=False) end_date = db.Column(db.String(20), nullable=False) end_time = db.Column(db.String(20), nullable=False) cost = db.Column(db.Float, nullable=False) venue = db.Column(db.String(100), nullable=False) visible = db.Column(db.Boolean, nullable=False) creator = db.Column(db.Integer, db.ForeignKey('user.id'))
class Rating(db.Model): __tablename__ = 'Rating' rateid = db.Column(db.Integer, primary_key=True) eventid = db.Column(db.Integer, db.ForeignKey('Event.eventid')) rate_value = db.Column(db.Integer) def __init__(self, eventid, rate_value): self.eventid = eventid self.rate_value = rate_value def get_ratingId(self): try: return unicode(self.rateid) # python 2 support except NameError: return str(self.rateid) # python 3 support
class Event(db.Model): __tablename__ = 'Event' eventid = db.Column(db.Integer, primary_key=True) event_publicId = db.Column(db.String(50), unique=True) name = db.Column(db.String(50)) title = db.Column(db.String(50), nullable=False) category = db.Column(db.String(50)) start_date = db.Column(db.DateTime, nullable=False) end_date = db.Column(db.DateTime, nullable=False) description = db.Column(db.String(1000), nullable=False) cost = db.Column(db.Float(10)) venue = db.Column(db.String(50)) flyer = db.Column(db.Text) public = db.Column(db.Boolean) managerid = db.Column(db.Integer, db.ForeignKey('EventManager.managerid')) def __init__(self, name, title, category, start_date, end_date, description, cost, venue, flyer, managerid, public): self.event_publicId = str(uuid.uuid4()) self.name = name self.title = title self.category = category self.start_date = start_date self.end_date = end_date self.description = description self.cost = cost self.venue = venue self.flyer = flyer self.managerid = managerid self.public = public def get_eventId(self): try: return unicode(self.eventid) # python 2 support except NameError: return str(self.eventid) # python 3 support def get_eventPublicId(self): try: return unicode(self.event_publicId) # python 2 support except NameError: return str(self.event_publicId) # python 3 support
class EventFlyer(db.Model): id = db.Column(db.Integer, primary_key=True) eventId = db.Column(db.Integer, db.ForeignKey('event.id')) flyerPath = db.Column(db.String(100), nullable=False)