POST zum Laufen gebracht.. RTFM! :-)

This commit is contained in:
Daniel Schick 2023-06-20 07:44:27 +02:00
parent d0a77b3f0f
commit 20f38fff91
3 changed files with 29 additions and 4 deletions

View File

@ -20,16 +20,22 @@ def GetTimes():
def PostTimes():
schema = model.Times()
print (request.is_json)
content = request.get_json(force=True)
print (content)
# body = parser.parse(schema, request, location='json')
body = parser.parse(schema, request, location='json')
return impl.times.PostTimes(body)
return impl.times.PostTimes(content)
@bp.route('/times', methods=['put'])
def PutTimes():
schema = model.Times()
print (request.is_json)
content = request.get_json()
print (content)
body = parser.parse(schema, request, location='json')

View File

@ -36,7 +36,18 @@ def PostTimes(body):
# This creates a *new* entry
return 400
# TODO: Validate the upload data
try:
commands = pydapper.using(local_db.connection_pool)
except Exception as ex:
logging.error(ex)
print(ex)
return json.dumps("call failed"), 500
return 0
def PutTimes(body):

View File

@ -77,6 +77,10 @@ class ParticipantList(Participant):
@dataclass
class Shipcall(Schema):
def __init__(self):
many = True
pass
id: int
ship_id: int
type: int
@ -127,6 +131,10 @@ class ShipcallId(Schema):
@dataclass
class Times(Schema):
def __init__(self):
many = True
pass
id: int
start_planned: datetime
end_planned: datetime