class Ticket(db.Model): # не закрив ticket_controller id = db.Column(db.Integer, primary_key=True, unique=True) name = db.Column(db.VARCHAR(length=40), nullable=False) description = db.Column(db.VARCHAR(length=400)) price = db.Column(db.Integer) endTimeReservation = db.Column(db.TIMESTAMP) reservationPrice = db.Column(db.Integer) status = db.Column(db.VARCHAR(20))
class Teacher(db.Model): __tablename__ = 'teachers' tid = db.Column('tid', db.Integer, primary_key=True) username = db.Column('username', db.VARCHAR(length=30), nullable=False) password = db.Column('password', db.VARCHAR(length=128), nullable=False) first_name = db.Column('first_name', db.VARCHAR(length=30)) last_name = db.Column('last_name', db.VARCHAR(length=40)) def __init__(self, username, password, first_name, last_name): self.username = username self.password = generate_password_hash(password) self.first_name = first_name self.last_name = last_name
class Category(db.Model): # не закрив ticket_controller id = db.Column(db.Integer, primary_key=True) name = db.Column(db.VARCHAR(length=40))
class Reservation(db.Model): id = db.Column(db.Integer, primary_key=True, unique=True) ticket_id = db.Column(db.Integer, db.ForeignKey(Ticket.id), unique=True) ticket = db.relationship("Ticket", backref="reservation") status = db.Column(db.VARCHAR(20))
class User(db.Model): # закрив user_controller id = db.Column(db.Integer, primary_key=True) username = db.Column(db.VARCHAR(length=40), nullable=False) email = db.Column(db.VARCHAR(30), nullable=False) password = db.Column(db.VARCHAR(128), nullable=False)
class Student(db.Model): __tablename__ = 'students' sid = db.Column('sid', db.Integer, primary_key=True) first_name = db.Column('first_name', db.VARCHAR(length=30)) last_name = db.Column('last_name', db.VARCHAR(length=40)) total_rating = db.Column('total_rating', db.Integer)