diff --git a/src/server/BreCal/api/shipcalls.py b/src/server/BreCal/api/shipcalls.py index 396dc93..73a06c1 100644 --- a/src/server/BreCal/api/shipcalls.py +++ b/src/server/BreCal/api/shipcalls.py @@ -14,7 +14,16 @@ bp = Blueprint('shipcalls', __name__) @auth_guard() # no restriction by role def GetShipcalls(): if 'Authorization' in request.headers: - token = request.headers.get('Authorization') + token = request.headers.get('Authorization') # see impl/login to see the token encoding, which is a JWT token. + + """ + from BreCal.services.jwt_handler import decode_jwt + jwt = token.split('Bearer ')[1] # string key + payload = decode_jwt(jwt) # dictionary, which includes 'id' (user id) and 'participant_id' + + # oneline: + payload = decode_jwt(request.headers.get("Authorization").split("Bearer ")[-1]) + """ options = {} options["participant_id"] = request.args.get("participant_id") options["past_days"] = request.args.get("past_days", default=1, type=int) diff --git a/src/server/BreCal/database/enums.py b/src/server/BreCal/database/enums.py index 3092fd8..fe6b37f 100644 --- a/src/server/BreCal/database/enums.py +++ b/src/server/BreCal/database/enums.py @@ -1,4 +1,4 @@ -from enum import Enum, IntFlag +from enum import IntEnum, Enum, IntFlag class ParticipantType(IntFlag): """determines the type of a participant""" @@ -36,3 +36,6 @@ class StatusFlags(Enum): YELLOW = 2 RED = 3 +class PierSide(IntEnum): + PORTSIDE = 0 # Port/Backbord + STARBOARD_SIDE = 1 # Starboard / Steuerbord diff --git a/src/server/BreCal/local_db.py b/src/server/BreCal/local_db.py index 85dff68..4293ff3 100644 --- a/src/server/BreCal/local_db.py +++ b/src/server/BreCal/local_db.py @@ -16,7 +16,7 @@ def initPool(instancePath): print (config_path) if not os.path.exists(config_path): - print ('cannot find ' + config_path) + print ('cannot find ' + os.path.abspath(config_path)) print("instance path", instancePath) sys.exit(1) @@ -39,4 +39,4 @@ def getPoolConnection(): global config_path f = open(config_path); connection_data = json.load(f) - return mysql.connector.connect(**connection_data) \ No newline at end of file + return mysql.connector.connect(**connection_data) diff --git a/src/server/BreCal/schemas/model.py b/src/server/BreCal/schemas/model.py index bf157aa..f45bc11 100644 --- a/src/server/BreCal/schemas/model.py +++ b/src/server/BreCal/schemas/model.py @@ -230,7 +230,7 @@ class Shipcall: tug_required: bool pilot_required: bool flags: int - pier_side: bool + pier_side: bool # enumerator object in database/enum/PierSide bunkering: bool replenishing_terminal: bool replenishing_lock: bool