Beispiel #1
0
class Ticket(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    event_id = db.Column(db.Integer,
                         db.ForeignKey('event.id', ondelete='CASCADE'),
                         nullable=False)
    ticket_type = db.Column(db.String(30), nullable=False)
    # number of tickets per type
    num_tickets = db.Column(db.Integer, nullable=False)
    num_bought = db.Column(db.Integer, nullable=False, server_default="0")
    price = db.Column(db.Float, nullable=False)
Beispiel #2
0
class UserBookings(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    user_id = db.Column(db.Integer(),
                        db.ForeignKey('user.id', ondelete='CASCADE'))

    event_id = db.Column(db.Integer(), nullable=False)
    ticket_id = db.Column(db.Integer(), nullable=False)
    ticket_type = db.Column(db.String(100), nullable=False)
    number_booked = db.Column(db.Integer(), nullable=False)
    number_scanned = db.Column(db.Integer(), nullable=False)
    payment_status = db.Column(db.String(100), nullable=False)

    image_file = db.Column(db.String(50),
                           nullable=False,
                           default='default_qr.jpeg')
Beispiel #3
0
class Event(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    # controllable items start here
    title = db.Column(db.String(100), nullable=False)
    event_type = db.Column(db.Text, nullable=False)
    # date and time will be the event date and time

    event_date = db.Column(db.Date, nullable=False)
    time_from = db.Column(db.Time, nullable=False)
    time_to = db.Column(db.Time, nullable=False)

    # num_tickets = db.Column(db.Integer, nullable=False)
    content = db.Column(db.Text, nullable=False)
    content_eng = db.Column(db.Text, nullable=True)
    address = db.Column(db.String(100), nullable=False)
    city = db.Column(db.String(100), nullable=False)
    location = db.Column(db.String(100), nullable=False)

    tickets = db.relationship('Ticket',
                              backref='event',
                              lazy=True,
                              cascade='all,delete-orphan')

    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default_event.jpg')

    # automatically set items start here
    # date_posted will be for when the event is created
    date_posted = db.Column(db.DateTime,
                            nullable=False,
                            default=datetime.utcnow)
    # lower case, table and column name is referenced
    # for backref/relationship purposes
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    staffers = db.relationship('User',
                               secondary='event_staff',
                               backref=db.backref('users', lazy='dynamic'))

    # automatically set items stop here

    def __repr__(self):  # how our object is printed
        return f"Event('{self.title}','{self.date_posted}','{self.content}')"
Beispiel #4
0
class UserRoles(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    user_id = db.Column(db.Integer(),
                        db.ForeignKey('user.id', ondelete='CASCADE'))
    role_id = db.Column(db.Integer(),
                        db.ForeignKey('role.id', ondelete='CASCADE'))
Beispiel #5
0
class EventStaff(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    user_id = db.Column(db.Integer(),
                        db.ForeignKey('user.id', ondelete='CASCADE'))
    event_id = db.Column(db.Integer(),
                         db.ForeignKey('event.id', ondelete='CASCADE'))