diff --git a/src/server/BreCal/validators/input_validation_times.py b/src/server/BreCal/validators/input_validation_times.py index dbe4b3b..688c651 100644 --- a/src/server/BreCal/validators/input_validation_times.py +++ b/src/server/BreCal/validators/input_validation_times.py @@ -29,32 +29,32 @@ def build_post_data_type_dependent_required_fields_dict()->dict[ShipcallType,dic ShipcallType.arrival:{ ParticipantType.undefined:[], # should not be set in POST requests ParticipantType.BSMD:[], # should not be set in POST requests - ParticipantType.TERMINAL:["operations_start"], - ParticipantType.AGENCY:["eta_berth"], - ParticipantType.MOORING:["eta_berth"], - ParticipantType.PILOT:["eta_berth"], - ParticipantType.PORT_ADMINISTRATION:["eta_berth"], - ParticipantType.TUG:["eta_berth"], + ParticipantType.TERMINAL:[], + ParticipantType.AGENCY:[], + ParticipantType.MOORING:[], + ParticipantType.PILOT:[], + ParticipantType.PORT_ADMINISTRATION:[], + ParticipantType.TUG:[], }, ShipcallType.departure:{ ParticipantType.undefined:[], # should not be set in POST requests ParticipantType.BSMD:[], # should not be set in POST requests - ParticipantType.TERMINAL:["operations_end"], - ParticipantType.AGENCY:["etd_berth"], - ParticipantType.MOORING:["etd_berth"], - ParticipantType.PILOT:["etd_berth"], - ParticipantType.PORT_ADMINISTRATION:["etd_berth"], - ParticipantType.TUG:["etd_berth"], + ParticipantType.TERMINAL:[], + ParticipantType.AGENCY:[], + ParticipantType.MOORING:[], + ParticipantType.PILOT:[], + ParticipantType.PORT_ADMINISTRATION:[], + ParticipantType.TUG:[], }, ShipcallType.shifting:{ ParticipantType.undefined:[], # should not be set in POST requests ParticipantType.BSMD:[], # should not be set in POST requests - ParticipantType.TERMINAL:["operations_start"], - ParticipantType.AGENCY:["etd_berth"], - ParticipantType.MOORING:["etd_berth"], - ParticipantType.PILOT:["etd_berth"], - ParticipantType.PORT_ADMINISTRATION:["etd_berth"], - ParticipantType.TUG:["etd_berth"], + ParticipantType.TERMINAL:[], + ParticipantType.AGENCY:[], + ParticipantType.MOORING:[], + ParticipantType.PILOT:[], + ParticipantType.PORT_ADMINISTRATION:[], + ParticipantType.TUG:[], }, } return post_data_type_dependent_required_fields_dict @@ -482,3 +482,44 @@ class InputValidationTimes(): has_bsmd_flag = ParticipantFlag.BSMD in [ParticipantFlag(participant.get("flags"))] return has_bsmd_flag + +def deprecated_build_post_data_type_dependent_required_fields_dict()->dict[ShipcallType,dict[ParticipantType,typing.Optional[list[str]]]]: + """ + The required fields of a POST-request depend on ShipcallType and ParticipantType. This function creates + a dictionary, which maps those types to a list of required fields. + + The participant types 'undefined' and 'bsmd' should not be used in POST-requests. They return 'None'. + """ + post_data_type_dependent_required_fields_dict = { + ShipcallType.arrival:{ + ParticipantType.undefined:[], # should not be set in POST requests + ParticipantType.BSMD:[], # should not be set in POST requests + ParticipantType.TERMINAL:[], + ParticipantType.AGENCY:["eta_berth"], + ParticipantType.MOORING:["eta_berth"], + ParticipantType.PILOT:["eta_berth"], + ParticipantType.PORT_ADMINISTRATION:["eta_berth"], + ParticipantType.TUG:["eta_berth"], + }, + ShipcallType.departure:{ + ParticipantType.undefined:[], # should not be set in POST requests + ParticipantType.BSMD:[], # should not be set in POST requests + ParticipantType.TERMINAL:[], + ParticipantType.AGENCY:["etd_berth"], + ParticipantType.MOORING:["etd_berth"], + ParticipantType.PILOT:["etd_berth"], + ParticipantType.PORT_ADMINISTRATION:["etd_berth"], + ParticipantType.TUG:["etd_berth"], + }, + ShipcallType.shifting:{ + ParticipantType.undefined:[], # should not be set in POST requests + ParticipantType.BSMD:[], # should not be set in POST requests + ParticipantType.TERMINAL:[], + ParticipantType.AGENCY:["etd_berth"], + ParticipantType.MOORING:["etd_berth"], + ParticipantType.PILOT:["etd_berth"], + ParticipantType.PORT_ADMINISTRATION:["etd_berth"], + ParticipantType.TUG:["etd_berth"], + }, + } + return post_data_type_dependent_required_fields_dict