Example #1
0
def subToEvent(eventId, personId):
	if not Persister.checkParticepant(eventId, personId):
		particepant = Particepant(
				person_id=personId,
				event_id=eventId,
				event_scanned=0
			)
		if Persister.persist_object(particepant) == 200:
			return ({"responseCode": 200, "msg": "Added particepant entry."})
		else:
			return ({"responseCode": 400, "msg": "Could not add entry due to db error."})
	return ({"responseCode": 400, "msg": "Could not add participant entry because either some of the given data did not match or the entry already exists."})
Example #2
0
def unSubToEvent(eventId, personId):
    if Persister.checkParticepant(eventId, personId):
        print("particepant exists")
        particepant = Persister.getParticepant(eventId, personId)
        print(particepant)
        if Persister.remove_object(particepant) == 200:
            return ({"responseCode": 200, "msg": "Removed particepant entry."})
        else:
            return ({
                "responseCode": 500,
                "msg": "Could not remove entry due to db error."
            })
    return ({
        "responseCode":
        400,
        "msg":
        "Could not remove participant entry because either some of the given data did not match or the entry does not exists."
    })