(20241209) Standardizing the data models for the database. Started with mail authentication.

This commit is contained in:
2024-12-09 12:05:12 +05:30
parent 30088dcea4
commit e2c9200941
11 changed files with 262 additions and 244 deletions
+21 -9
View File
@@ -37,6 +37,9 @@ sys.path.append("..")
# To use Quart:
from quart import current_app
# The data model:
from models.data.core.user_info import CoreUserInfoModel
# *****************************************************************************************************************
# ***** ****
@@ -84,18 +87,27 @@ async def get_session(session_token):
"""
try:
# Fetch the raw info from cache:
raw_info = await current_app.module_cache.get(key = session_token)
session_info = {
"fullName": raw_info["value"]["full_name"],
"userId": raw_info["value"]["user_id"],
"entityId": raw_info["value"]["entity_id"],
"billingAccountId": raw_info["value"]["billing_account_id"],
"departmentId": raw_info["value"]["department_id"],
"branchId": raw_info["value"]["branch_id"],
"industry": raw_info["value"]["industry"]
}
# Feed needed field into the core model:
session_info = CoreUserInfoModel(
fullName = raw_info["value"]["full_name"],
userId = raw_info["value"]["user_id"],
entityId = raw_info["value"]["entity_id"],
billingAccountId = raw_info["value"]["billing_account_id"],
departmentId = raw_info["value"]["department_id"],
branchId = raw_info["value"]["branch_id"],
industry = raw_info["value"]["industry"]
)
# Done here:
return session_info
# In case something goes wrong:
except Exception as exception:
current_app.printer(exception)
return None