Allow for workshop/meal checkins #19

Merged
Muirrum merged 6 commits from meal-checkin into master 2023-12-01 17:30:16 -05:00
2 changed files with 66 additions and 1 deletions
Showing only changes of commit cc4fe8cea4 - Show all commits

View file

@ -41,7 +41,6 @@ class User(db.Model, UserMixin):
return hackers
@login.user_loader
def user_loader(user_id):
return User.query.filter_by(id=user_id).first()
@ -56,3 +55,45 @@ class PwResetRequest(db.Model):
id = Column(String, primary_key=True)
user_id = Column(Integer, ForeignKey('user.id'), nullable=False)
expires = Column(DateTime, nullable=False)
"""
Represents an event within the hackathon, that can be checked into
"""
class Event(db.Model):
id = Column(Integer, primary_key=True)
name = Column(String, nullable=False)
description = Column(String, nullable=True)
location = Column(String, nullable=False)
start_time = Column(DateTime, nullable=False)
end_time = Column(DateTime, nullable=False)
category = Column(String, nullable=True)
def create_json_output(lis):
events = []
for e in lis:
events.append({
'id': e.id,
'name': e.name,
'description': e.description,
'location': e.location,
'start': e.start_time,
'end': e.end_time,
'category': e.category
})
return events
def get_checkins(self):
checkins = EventCheckins.query.filter_by(event_id=self.id).all()
return checkins
class EventCheckins(db.Model):
__tablename__ = "event_checkins"
id = Column(Integer, primary_key=True)
event_id = Column(Integer, ForeignKey('event.id'), nullable=False)
user_id = Column(Integer, ForeignKey('user.id'), nullable=False)

View file

@ -0,0 +1,24 @@
"""create event table
Revision ID: d6917765911f
Revises: 261c004968a4
Create Date: 2023-12-01 13:22:41.055221
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd6917765911f'
down_revision = '261c004968a4'
branch_labels = None
depends_on = None
def upgrade():
pass
def downgrade():
pass