partial commit of integrating the input validation (references and mandatory fields)

This commit is contained in:
scopesorting 2023-12-12 17:07:09 +01:00 committed by Max Metz
parent 3f08c342c7
commit 29de011229
3 changed files with 23 additions and 1 deletions

View File

@ -46,6 +46,7 @@ def create_app(test_config=None):
app.config.from_mapping(test_config)
try:
import os
print(f'Instance path = {app.instance_path}')
os.makedirs(app.instance_path)
except OSError:

View File

@ -68,7 +68,6 @@ def evaluate_shipcall_state(mysql_connector_instance, shipcall_id:int=None, debu
with mysql.connector.connect(**mysql_connection_data) as mysql_connector_instance:
evaluate_shipcall_state(mysql_connector_instance)
returns None
"""
sql_handler = SQLHandler(sql_connection=mysql_connector_instance, read_all=True)
vr = ValidationRules(sql_handler)

View File

@ -123,6 +123,17 @@ def PostShipcalls(schemaModel):
query += "?" + param_key + "?"
query += ")"
# #TODO: enter completeness validation here. Only shipcalls, where all required fields are filled in are valid
# "Pflichtfelder: z.B. die Felder bei der Neuanlage eines shipcalls müssen entsprechend des Anlauf-Typs belegt sein, damit gespeichert werden kann" - Daniel Schick
# #TODO: enter role validation here. Only users of correct type should be allowed to post a shipcall
# #TODO: enter reference validation here
# full_id_existances = check_id_existances(mysql_connector_instance=sql_connection, schemaModel=schemaModel, debug=False)
# if not full_id_existances:
# pooledConnection.close()
# return json.dumps({"message" : "call failed. missing mandatory keywords."}), 500, {'Content-Type': 'application/json; charset=utf-8'}
commands.execute(query, schemaModel)
new_id = commands.execute_scalar("select last_insert_id()")
@ -206,6 +217,17 @@ def PutShipcalls(schemaModel):
query += key + " = ?" + param_key + "? "
query += "WHERE id = ?id?"
# #TODO: enter role validation here.
# #TODO: enter completeness validation here. Only shipcalls, where all required fields are filled in are valid
# #TODO: enter reference validation here
# full_id_existances = check_id_existances(mysql_connector_instance=sql_connection, schemaModel=schemaModel, debug=False)
# if not full_id_existances:
# return ... (500)
affected_rows = commands.execute(query, param=schemaModel)
pquery = "SELECT id, participant_id, type FROM shipcall_participant_map where shipcall_id = ?id?"