tried to return a participant

This commit is contained in:
Daniel Schick 2023-03-04 15:37:03 +01:00
parent d125a46957
commit 29419540de

View File

@ -1,5 +1,5 @@
import json import json
import mariadb
def GetParticipant(options): def GetParticipant(options):
""" """
@ -8,15 +8,25 @@ def GetParticipant(options):
""" """
conn = mariadb.connect(host="localhost", user="ds", password="kle1nes")
cur = conn.cursor()
query = "SELECT p.id, p.name, p.street, p.postal_code, p.city, p.flags FROM participant p INNER JOIN user u WHERE u.participant_id = p.id AND u.id = {id} "
cur.execute(query)
for (id, name, street, postal_code, city, flags) in cur:
# Implement your business logic here # Implement your business logic here
# All the parameters are present in the options argument # All the parameters are present in the options argument
return json.dumps({ return json.dumps({
"city": "<string>", "city": city,
"id": "<integer>", "id": id,
"name": "<string>", "name": name,
"postal code": "<string>", "postal code": postal_code,
"street": "<string>", "street": street,
}), 200 }), 200