Debug
This commit is contained in:
parent
c57e36a445
commit
041e9eaf9b
1 changed files with 24 additions and 24 deletions
|
|
@ -182,12 +182,15 @@ class ShowDatabaseService:
|
|||
|
||||
log_show_database_action = ShowDatabaseAction()
|
||||
|
||||
dados_completos = log_show_database_action.execute(client_id_schema)
|
||||
dados_json = log_show_database_action.execute(client_id_schema)
|
||||
|
||||
if dados_completos and dados_completos.get("file"):
|
||||
if dados_json and dados_json.get("file"):
|
||||
|
||||
dados_json = json.loads(dados_completos["file"])
|
||||
standard_structure_json_string = dados_completos.get("standard_structure_json")
|
||||
# Extrai e carrega os dados JSON do campo 'file'
|
||||
dados_json = json.loads(dados_json["file"])
|
||||
|
||||
# Extrai as estruturas de dados relevantes
|
||||
standard_structure_json_string = dados_json.get("standard_structure_json")
|
||||
standard_structure_data: Dict[str, Any] = {}
|
||||
if standard_structure_json_string:
|
||||
try:
|
||||
|
|
@ -195,10 +198,11 @@ class ShowDatabaseService:
|
|||
except json.JSONDecodeError:
|
||||
pass
|
||||
|
||||
# Extrai a estrutura do cliente do JSON
|
||||
database_data = dados_json.get("database", {})
|
||||
client_structure: Dict[str, Any] = database_data.get("structure", {})
|
||||
|
||||
# 🚨 NOVO PASSO CRUCIAL: Normaliza as chaves para UPPERCASE em ambas as estruturas
|
||||
# NOVO PASSO CRUCIAL: Normaliza as chaves para UPPERCASE em ambas as estruturas
|
||||
standard_structure_data = _normalize_keys_to_upper(standard_structure_data)
|
||||
client_structure = _normalize_keys_to_upper(client_structure)
|
||||
|
||||
|
|
@ -212,26 +216,22 @@ class ShowDatabaseService:
|
|||
client_structure
|
||||
)
|
||||
|
||||
# 1. Lista para Análise Visual (estruturas Padrão e Cliente)
|
||||
data_list_for_visual_check = [
|
||||
{
|
||||
"ID": 1,
|
||||
"ESTRUTURA": "PADRÃO (STANDARD_STRUCTURE_JSON) - CHAVES NORMALIZADAS",
|
||||
"CONTEUDO": debug_padrao
|
||||
},
|
||||
{
|
||||
"ID": 2,
|
||||
"ESTRUTURA": "CLIENTE (CLIENT_STRUCTURE) - CHAVES NORMALIZADAS",
|
||||
"CONTEUDO": debug_cliente
|
||||
# Separa o campo 'partition' das demais chaves
|
||||
partition_info = database_data.get("partition", {})
|
||||
|
||||
# Monta o JSON final
|
||||
data = {
|
||||
"cns": dados_json.get("cns"),
|
||||
"cartorio": dados_json.get("cartorio"),
|
||||
"data": dados_json.get("data"),
|
||||
"hora": dados_json.get("hora"),
|
||||
"database": {
|
||||
"partition": partition_info,
|
||||
"default_schema": debug_padrao,
|
||||
"client_schema": debug_cliente,
|
||||
"client_only_items": elementos_unicos_cliente
|
||||
}
|
||||
]
|
||||
|
||||
# 2. Monta o retorno final com as duas seções
|
||||
return {
|
||||
"MESSAGE": "ESTRUTURAS DE BANCO DE DADOS PARA ANÁLISE VISUAL E ITENS EXCLUSIVOS DO CLIENTE",
|
||||
"DATA": data_list_for_visual_check,
|
||||
"ITENS_NAO_ENCONTRADOS_NO_PADRAO": elementos_unicos_cliente
|
||||
}
|
||||
}
|
||||
|
||||
else:
|
||||
raise HTTPException(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue