Solucion a tipos de datos, blindaje y resoluciones con el token expirado
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from fastapi import HTTPException
|
||||
import base64
|
||||
import logging
|
||||
from core.celery_app import celery_app
|
||||
|
||||
@@ -3,6 +3,7 @@ from celery import shared_task
|
||||
from sqlalchemy.orm import Session
|
||||
from core.database import CoreSessionLocal as SessionLocal
|
||||
from .service import DescargaReportService # FORCE RELOAD 2
|
||||
from fastapi import HTTPException
|
||||
import base64
|
||||
import traceback
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from celery import Task
|
||||
from fastapi import HTTPException
|
||||
from core.celery_app import celery_app
|
||||
from core.celery_app import celery_app
|
||||
from core.database import get_core_db as get_db
|
||||
|
||||
@@ -15,7 +15,7 @@ class ClienteSchema(BaseModel):
|
||||
ciudad: Optional[str] = ""
|
||||
estado: Optional[str] = ""
|
||||
pais: Optional[str] = ""
|
||||
tax_id: str
|
||||
tax_id: Optional[str] = ""
|
||||
programa: Optional[str] = ""
|
||||
autorizacion: Optional[str] = ""
|
||||
prosec: Optional[str] = ""
|
||||
@@ -23,7 +23,7 @@ class ClienteSchema(BaseModel):
|
||||
cert: Optional[str] = ""
|
||||
|
||||
# Si llega un None, lo convertimos en "" automáticamente
|
||||
@field_validator('direccion', 'nombre', mode='before')
|
||||
@field_validator('direccion', 'nombre', 'tax_id', mode='before')
|
||||
@classmethod
|
||||
def prevent_none(cls, v):
|
||||
return v or ""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from fastapi import HTTPException
|
||||
import base64
|
||||
import logging
|
||||
from core.celery_app import celery_app
|
||||
@@ -43,10 +44,12 @@ def generar_pdf_consolidado_async(self, invoice_id: int, company_id: int):
|
||||
"media_type": media_type
|
||||
}
|
||||
|
||||
except HTTPException as e:
|
||||
logger.error(f"HTTP Error en Celery Worker: {str(e.detail)}")
|
||||
return {"status": "error", "message": str(e.detail)}
|
||||
except Exception as e:
|
||||
logger.error(f"Error en Celery Worker: {str(e)}")
|
||||
return {"status": "error", "message": str(e)}
|
||||
|
||||
return {"status": "error", "message": f"Error interno en el servidor de reportes: {str(e)}"}
|
||||
finally:
|
||||
# 5. MUY IMPORTANTE: Cerramos la conexión para no saturar Postgres
|
||||
db.close()
|
||||
|
||||
@@ -15,7 +15,7 @@ class ClienteSchema(BaseModel):
|
||||
ciudad: Optional[str] = ""
|
||||
estado: Optional[str] = ""
|
||||
pais: Optional[str] = ""
|
||||
tax_id: str
|
||||
tax_id: Optional[str] = ""
|
||||
programa: Optional[str] = ""
|
||||
autorizacion: Optional[str] = ""
|
||||
prosec: Optional[str] = ""
|
||||
@@ -23,7 +23,7 @@ class ClienteSchema(BaseModel):
|
||||
cert: Optional[str] = ""
|
||||
|
||||
# Si llega un None, lo convertimos en "" automáticamente
|
||||
@field_validator('direccion', 'nombre', mode='before')
|
||||
@field_validator('direccion', 'nombre', 'tax_id', mode='before')
|
||||
@classmethod
|
||||
def prevent_none(cls, v):
|
||||
return v or ""
|
||||
|
||||
@@ -12,14 +12,14 @@ class ClienteSchema(BaseModel):
|
||||
ciudad: Optional[str] = ""
|
||||
estado: Optional[str] = ""
|
||||
pais: Optional[str] = ""
|
||||
tax_id: str
|
||||
tax_id: Optional[str] = ""
|
||||
programa: Optional[str] = ""
|
||||
autorizacion: Optional[str] = ""
|
||||
prosec: Optional[str] = ""
|
||||
reg_emp: Optional[str] = ""
|
||||
cert: Optional[str] = ""
|
||||
|
||||
@field_validator('direccion', 'nombre', mode='before')
|
||||
@field_validator('direccion', 'nombre', 'tax_id', mode='before')
|
||||
@classmethod
|
||||
def prevent_none(cls, v):
|
||||
return v or ""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from fastapi import HTTPException
|
||||
import base64
|
||||
from core.celery_app import celery_app
|
||||
from core.database import CoreSessionLocal
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from fastapi import HTTPException
|
||||
from core.celery_app import celery_app
|
||||
from core.database import get_core_db as get_db
|
||||
from .service import Mainx30DefinitiveService
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from celery import Task
|
||||
from fastapi import HTTPException
|
||||
from core.celery_app import celery_app
|
||||
from core.celery_app import celery_app
|
||||
from core.database import get_core_db as get_db
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from fastapi import HTTPException
|
||||
from core.celery_app import celery_app
|
||||
from core.database import CoreSessionLocal
|
||||
from .service import WinsaaiService
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from fastapi import HTTPException
|
||||
import logging
|
||||
from typing import List
|
||||
import base64
|
||||
|
||||
Reference in New Issue
Block a user