From 8d16f724bd33821ac1ddb9ba3a999add45ce69b9 Mon Sep 17 00:00:00 2001 From: Jason Park Date: Sat, 11 Nov 2023 22:51:33 +0900 Subject: [PATCH] feat: fixing logic for post profile --- src/lambda/post-profile/utils.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/lambda/post-profile/utils.py b/src/lambda/post-profile/utils.py index ea67b26d2..208dd16c5 100644 --- a/src/lambda/post-profile/utils.py +++ b/src/lambda/post-profile/utils.py @@ -73,30 +73,21 @@ def handle(*args, **kwargs): def extract_and_format_date(event): try: - # Debug print to check what's in the event - print("Event Data:", event) - identities_str = event['requestContext']['authorizer']['claims']['identities'] # Debug print to see the identities string print("Identities String:", identities_str) identities = json.loads(identities_str) + + date_created_at = identities.get("dateCreated") + formatted_time = format_time(date_created_at) + + return formatted_time - # Debug print to see the parsed identities - print("Parsed Identities:", identities) - - if identities and isinstance(identities, list): - date_created_at = identities[0].get("dateCreated") - if date_created_at: - return format_time(date_created_at) - else: - print("dateCreated not found in identities") - else: - print("No identities found or identities is not a list.") except Exception as e: print(f"Error in extract_and_format_date: {e}") - return None + return None def format_time(timestamp_ms): timestamp_s = timestamp_ms / 1000.0