feat: restringe soloAdmin (Bucefalo CRM) a agentes, default WhatsApp+fallbackEmail y archivado reversible
This commit is contained in:
@@ -23,8 +23,11 @@ async def list_clientes(
|
||||
auth: dict = Depends(require_scope("clientes:leer")),
|
||||
pagination: PaginationParams = Depends(PaginationParams),
|
||||
q: str | None = Query(None, description="Search by nombre, empresa, or email"),
|
||||
incluirArchivados: bool = Query(False, description="Solo personal humano"),
|
||||
):
|
||||
where_clauses: list[str] = []
|
||||
if auth.get("auth_type") == "agent" or not incluirArchivados:
|
||||
where_clauses.append("archivado = false")
|
||||
params: list = []
|
||||
idx = 1
|
||||
|
||||
@@ -116,7 +119,7 @@ async def get_cliente(
|
||||
raise HTTPException(status_code=404, detail="Cliente no encontrado")
|
||||
|
||||
cotizaciones = await db.fetch(
|
||||
'SELECT * FROM "Cotizacion" WHERE "clienteId" = $1 '
|
||||
'SELECT * FROM "Cotizacion" WHERE "clienteId" = $1 AND archivado = false '
|
||||
'ORDER BY "createdAt" DESC LIMIT 10',
|
||||
cliente_id,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user