(20241212) Reorganizing code to perform core actions in one place.

This commit is contained in:
2024-12-12 18:34:51 +05:30
parent 70c817b3b8
commit fb95e0b38c
50 changed files with 1259 additions and 3166 deletions
+6 -3
View File
@@ -63,6 +63,9 @@ from utils_v2.api.async_quart import (
# GMail-related utils:
from utils_v2.goog.gmail.gmail_client import SCOPES_GMAIL_MAIL_MANAGEMENT
# Data Models:
from models.core.auth_token import CoreAuthTokenModel
# Common:
from shared import constants
@@ -113,7 +116,7 @@ def init(blueprint_setup_state):
api_version = "1.0.0",
project = constants.PROJECT_NAME,
log_type = constants.MODULE_NAME,
operation = "gmailCllbk",
operation = "gmailClbk",
log_input = 2,
log_output = 1,
sensitive_keys = ["sessionToken", "X-Session-Token"]
@@ -156,7 +159,7 @@ async def handle_gmail_callback() -> render_template:
# Here's where we do the checking of the e-mails,
# if they don't match, we reject the authorization:
auth_token = await current_app.mail_oauth_model.get_token(
auth_token = await current_app.mail_controller.get_token(
mongo_conn = current_app.data_mongo,
token_id = g.inbound_data["state"]
)
@@ -211,7 +214,7 @@ async def handle_gmail_callback() -> render_template:
auth_token.clientUserId = google_tokens.client_user_id
auth_token.token = google_tokens.model_dump()
auth_token.status = "active"
tokens_saved = await current_app.mail_oauth_model.set_token(
tokens_saved = await current_app.mail_controller.set_token(
db_conn = current_app.sql_writer,
mongo_conn = current_app.data_mongo,
session_token = g.inbound_headers.get("X-Session-Token"),