From 97ba070b0e3e242be8c19e0be8ffb149441c1f2b Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Thu, 28 Mar 2024 11:19:02 -0700 Subject: [PATCH] debug staging --- app/organization/invite_rest.py | 10 ++++++++-- app/service_invite/rest.py | 4 ++++ app/utils.py | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/organization/invite_rest.py b/app/organization/invite_rest.py index 580c10da6..60cba4322 100644 --- a/app/organization/invite_rest.py +++ b/app/organization/invite_rest.py @@ -28,6 +28,7 @@ from app.organization.organization_schema import ( post_update_invited_org_user_status_schema, ) from app.schema_validation import validate +from app.utils import hilite organization_invite_blueprint = Blueprint("organization_invite", __name__) @@ -83,12 +84,17 @@ def invite_user_to_org(organization_id): # This is for the login.gov path, note 24 hour expiry to match # The expiration of invitations. redis_key = f"organization-invite-{invited_org_user.email_address}" - redis_store.set( + redis_store.raw_set( redis_key, organization_id, ex=3600 * 24, ) - + current_app.logger.info( + hilite(f"STORING THIS ORGANIZATION ID IN REDIS {organization_id}") + ) + current_app.logger.info( + hilite(f"URL: {os.environ['LOGIN_DOT_GOV_REGISTRATION_URL']}") + ) send_notification_to_queue(saved_notification, queue=QueueNames.NOTIFY) return jsonify(data=invited_org_user.serialize()), 201 diff --git a/app/service_invite/rest.py b/app/service_invite/rest.py index 849261cb2..d9df54d21 100644 --- a/app/service_invite/rest.py +++ b/app/service_invite/rest.py @@ -25,6 +25,7 @@ from app.notifications.process_notifications import ( send_notification_to_queue, ) from app.schemas import invited_user_schema +from app.utils import hilite service_invite = Blueprint("service_invite", __name__) @@ -80,6 +81,9 @@ def _create_service_invite(invited_user, invite_link_host): json.dumps(data), ex=3600 * 24, ) + current_app.logger.info( + hilite(f"STORING ALL THIS IN REDIS FOR SERVICE INVITE {json.dumps(data)}") + ) send_notification_to_queue(saved_notification, queue=QueueNames.NOTIFY) diff --git a/app/utils.py b/app/utils.py index 833dce55f..9519e2076 100644 --- a/app/utils.py +++ b/app/utils.py @@ -123,3 +123,11 @@ def get_reference_from_personalisation(personalisation): if personalisation: return personalisation.get("reference") return None + + +# Function used for debugging. +# Do print(hilite(message)) while debugging, then remove your print statements +def hilite(message): + ansi_green = "\033[32m" + ansi_reset = "\033[0m" + return f"{ansi_green}{message}{ansi_reset}"