Skip to content

Commit

Permalink
new updates for stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
Curiouspaul1 committed Dec 7, 2023
1 parent 8f89c07 commit 2497060
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/rsvp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

# fetch rsvp sessions
@rsvp.get('/<ticket_id>')
@cross_origin()
def fetch_rsvps(ticket_id):
attendee_profile: Attendees = Attendees.query.get(ticket_id)
schema = EventSchema()
Expand Down Expand Up @@ -122,6 +123,7 @@ def sign_up():


@rsvp.patch('/<ticket_no>')
@cross_origin()
def patch(ticket_no):
# parse data
schema = EditRsvpSchema()
Expand Down Expand Up @@ -191,6 +193,7 @@ def patch(ticket_no):


@rsvp.put('/<ticket_no>')
@cross_origin()
def put(ticket_no):
schema = EditRsvpSchema()
try:
Expand Down
4 changes: 4 additions & 0 deletions core/venue.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
Venue
)
from schema import EventSchema, VerifySchema
from flask_cors import cross_origin

venue = Blueprint('venue', __name__, url_prefix='/venue')

@venue.get('/<venue_id>')
@cross_origin()
def fetch_venue_events(venue_id):
events = Event.query.filter_by(venue_id=venue_id).all()
schema = EventSchema(many=True)
Expand All @@ -22,13 +24,15 @@ def fetch_venue_events(venue_id):
}

@venue.get('/time_codes')
@cross_origin()
def fetch_time_code():
return {
'status': 'success',
'data': time_code
}

@venue.post('/verify')
@cross_origin()
def verify():
schema = VerifySchema()
try:
Expand Down
8 changes: 8 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,11 @@ def create_venues():
db.session.close()

return 'ok'


time_code = {
"MYWKLBUP": 1,
"QILRK0Q5": 2,
"ECW0C6W3": 3,
"QRAQWC42": 4
}
9 changes: 9 additions & 0 deletions schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ class EventSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Event
load_instance = True


class VerifySchema(ma.Schema):
ticket_id = fields.String(required=True, validate=validate.Regexp("^DSCA[0-9]{9}$"))
venue_id = fields.String(required=True, validate=validate.Length(max=10))
time_code = fields.String(required=True, validate=validate.OneOf([
"MYWKLBUP", "QILRK0Q5", "ECW0C6W3", "QRAQWC42"
]))

0 comments on commit 2497060

Please sign in to comment.