class ConversationThread(db.Model): id = db.Column(db.String, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) created_at = db.Column(db.Date, default=datetime.datetime.utcnow) isClosed = db.Column(db.Boolean, default=False) def __repr__(self): return f"{self.id}, {self.user_id}, {self.created_at}"
class Product(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), index=True) price = db.Column(db.Float) img_src = db.Column(db.String(120)) category = db.Column(db.String(30), index=True) rewe_plz = db.Column(db.Integer, db.ForeignKey('rewe.plz')) on_sale = db.Column(db.Boolean, index=True, default=False)
class Quiz(db.Model): id = db.Column(db.String, primary_key=True) classroom_id = db.Column(db.Integer, db.ForeignKey('classroom.classroom_id'), nullable=False) created_at = db.Column(db.Date, default=datetime.datetime.utcnow) def __repr__(self): return f"{self.id}, {self.classroom_id}, {self.created_at}"
class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(64), index=True, unique=True) plz = db.Column(db.Integer, db.ForeignKey('zipcode.id')) email = db.Column(db.String(120), index=True, unique=True) password_hash = db.Column(db.String(128)) created_at = db.Column(db.DateTime, index=True, default=datetime.utcnow) last_login_at = db.Column(db.DateTime) is_admin = db.Column(db.Boolean, default=False) def user_to_json(self): return { "id": self.id, "name": self.username, "email": self.email, "plz": self.plz, "password_hash": self.password_hash, "created_at": self.created_at } def __repr__(self): return '<User {}>'.format(self.username)
class Rewe(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), index=True) adress = db.Column(db.String(100), index=True, unique=True) plz = db.Column(db.Integer, db.ForeignKey('zipcode.id'))