Compare commits
4 Commits
1.5.0
...
2033a35a2b
| Author | SHA1 | Date | |
|---|---|---|---|
| 2033a35a2b | |||
| 96cd09476c | |||
| 96084b89c0 | |||
| 771b6eba30 |
@@ -1,22 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
from sqlalchemy import text
|
|
||||||
from app.core.database import engine
|
|
||||||
|
|
||||||
async def add_columns():
|
|
||||||
print("Starting schema update...")
|
|
||||||
async with engine.begin() as conn:
|
|
||||||
try:
|
|
||||||
await conn.execute(text("ALTER TABLE tickets ADD COLUMN system_id UUID REFERENCES systems(id)"))
|
|
||||||
print("Added system_id column")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error adding system_id (might exist): {e}")
|
|
||||||
|
|
||||||
try:
|
|
||||||
await conn.execute(text("ALTER TABLE tickets ADD COLUMN category_id UUID REFERENCES categories(id)"))
|
|
||||||
print("Added category_id column")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error adding category_id (might exist): {e}")
|
|
||||||
print("Schema update finished.")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(add_columns())
|
|
||||||
@@ -133,10 +133,10 @@ class ClientProfileUpdate(ClientProfileBase):
|
|||||||
class ClientProfileResponse(ClientProfileBase):
|
class ClientProfileResponse(ClientProfileBase):
|
||||||
"""Schema de respuesta para ClientProfile."""
|
"""Schema de respuesta para ClientProfile."""
|
||||||
|
|
||||||
id: Optional[uuid.UUID] = None
|
id: uuid.UUID
|
||||||
tenant_id: uuid.UUID
|
tenant_id: uuid.UUID
|
||||||
created_at: Optional[datetime] = None
|
created_at: datetime
|
||||||
updated_at: Optional[datetime] = None
|
updated_at: datetime
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|||||||
0
backend/app/api/v1/endpoints/audit.py
Normal file
0
backend/app/api/v1/endpoints/audit.py
Normal file
@@ -50,49 +50,11 @@ async def get_current_client_profile(
|
|||||||
profile = result.scalar_one_or_none()
|
profile = result.scalar_one_or_none()
|
||||||
|
|
||||||
if not profile:
|
if not profile:
|
||||||
# Si no existe, devolver un perfil vacío con solo tenant_id
|
# Si no existe, crear uno vacío
|
||||||
# No crear en base de datos hasta que el usuario guarde
|
profile = ClientProfile(tenant_id=current_tenant.id)
|
||||||
return ClientProfileResponse(
|
db.add(profile)
|
||||||
id=None,
|
await db.commit()
|
||||||
tenant_id=current_tenant.id,
|
await db.refresh(profile)
|
||||||
business_name=None,
|
|
||||||
commercial_name=None,
|
|
||||||
client_code=None,
|
|
||||||
client_type=None,
|
|
||||||
rfc=None,
|
|
||||||
tax_id=None,
|
|
||||||
country=None,
|
|
||||||
state=None,
|
|
||||||
city=None,
|
|
||||||
address=None,
|
|
||||||
external_number=None,
|
|
||||||
internal_number=None,
|
|
||||||
postal_code=None,
|
|
||||||
neighborhood=None,
|
|
||||||
main_phone=None,
|
|
||||||
secondary_phone=None,
|
|
||||||
direct_phone=None,
|
|
||||||
phone_extension=None,
|
|
||||||
fax=None,
|
|
||||||
business_hours=None,
|
|
||||||
website=None,
|
|
||||||
main_email=None,
|
|
||||||
billing_email=None,
|
|
||||||
advertising_medium=None,
|
|
||||||
nationality=None,
|
|
||||||
logo_url=None,
|
|
||||||
company_representative=None,
|
|
||||||
legal_representative=None,
|
|
||||||
credit_limit=None,
|
|
||||||
payment_terms=None,
|
|
||||||
preferred_currency="MXN",
|
|
||||||
send_to_billing=False,
|
|
||||||
is_active_client=True,
|
|
||||||
is_prospect=False,
|
|
||||||
notes=None,
|
|
||||||
created_at=None,
|
|
||||||
updated_at=None
|
|
||||||
)
|
|
||||||
|
|
||||||
return profile
|
return profile
|
||||||
|
|
||||||
|
|||||||
@@ -79,23 +79,19 @@ async def create_ticket(
|
|||||||
Crear un nuevo ticket
|
Crear un nuevo ticket
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Generar número de ticket único basado en el máximo existente
|
# Generar número de ticket único
|
||||||
result = await db.execute(
|
result = await db.execute(
|
||||||
select(Ticket.ticket_number)
|
select(func.count(Ticket.id)).where(Ticket.tenant_id == current_user.tenant_id)
|
||||||
.where(Ticket.tenant_id == current_user.tenant_id)
|
|
||||||
.order_by(Ticket.ticket_number.desc())
|
|
||||||
.limit(1)
|
|
||||||
)
|
)
|
||||||
last_ticket_number = result.scalar_one_or_none()
|
count = result.scalar() or 0
|
||||||
|
ticket_number = f"TK-{count + 1:06d}"
|
||||||
|
|
||||||
if last_ticket_number:
|
# Generar número de ticket único
|
||||||
# Extraer el número del formato TK-XXXXXX
|
result = await db.execute(
|
||||||
last_number = int(last_ticket_number.split('-')[1])
|
select(func.count(Ticket.id)).where(Ticket.tenant_id == current_user.tenant_id)
|
||||||
next_number = last_number + 1
|
)
|
||||||
else:
|
count = result.scalar() or 0
|
||||||
next_number = 1
|
ticket_number = f"TK-{count + 1:06d}"
|
||||||
|
|
||||||
ticket_number = f"TK-{next_number:06d}"
|
|
||||||
|
|
||||||
# Convertir IDs de string a UUID si son proporcionados
|
# Convertir IDs de string a UUID si son proporcionados
|
||||||
category_uuid = uuid.UUID(ticket.category_id) if ticket.category_id else None
|
category_uuid = uuid.UUID(ticket.category_id) if ticket.category_id else None
|
||||||
@@ -161,76 +157,6 @@ async def create_ticket(
|
|||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail=f"Invalid UUID format: {str(e)}"
|
detail=f"Invalid UUID format: {str(e)}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
|
||||||
await db.rollback()
|
|
||||||
raise HTTPException(
|
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
|
||||||
detail=f"Error creating ticket: {str(e)}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/", response_model=List[TicketResponse])
|
|
||||||
async def get_tickets(
|
|
||||||
skip: int = 0,
|
|
||||||
limit: int = 100,
|
|
||||||
status_filter: Optional[str] = None,
|
|
||||||
db: AsyncSession = Depends(get_db),
|
|
||||||
current_user: User = Depends(get_current_user)
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Obtener tickets del usuario actual
|
|
||||||
"""
|
|
||||||
query = select(Ticket).where(
|
|
||||||
Ticket.tenant_id == current_user.tenant_id,
|
|
||||||
Ticket.created_by == current_user.id
|
|
||||||
)
|
|
||||||
|
|
||||||
if status_filter:
|
|
||||||
try:
|
|
||||||
status_enum = TicketStatus[status_filter.upper()]
|
|
||||||
query = query.where(Ticket.status == status_enum)
|
|
||||||
except KeyError:
|
|
||||||
raise HTTPException(
|
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
|
||||||
detail=f"Invalid status: {status_filter}"
|
|
||||||
)
|
|
||||||
|
|
||||||
query = query.order_by(Ticket.created_at.desc()).offset(skip).limit(limit)
|
|
||||||
|
|
||||||
result = await db.execute(query)
|
|
||||||
tickets = result.scalars().all()
|
|
||||||
|
|
||||||
# ✅ CORREGIDO: Usar affected_system_id
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
"id": str(t.id),
|
|
||||||
"ticket_number": t.ticket_number,
|
|
||||||
"subject": t.subject,
|
|
||||||
"title": t.subject,
|
|
||||||
"description": t.description,
|
|
||||||
"status": t.status.value,
|
|
||||||
"priority": t.priority.value,
|
|
||||||
"category_id": str(t.category_id) if t.category_id else None,
|
|
||||||
"affected_system_id": str(t.affected_system_id) if t.affected_system_id else None, # ✅ CORREGIDO
|
|
||||||
"created_by": str(t.created_by),
|
|
||||||
"assigned_to": str(t.assigned_to) if t.assigned_to else None,
|
|
||||||
"created_at": t.created_at,
|
|
||||||
"updated_at": t.updated_at
|
|
||||||
}
|
|
||||||
for t in tickets
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/admin/all", response_model=List[dict])
|
|
||||||
async def get_all_tickets_admin(
|
|
||||||
skip: int = 0,
|
|
||||||
limit: int = 100,
|
|
||||||
status_filter: Optional[str] = None,
|
|
||||||
priority_filter: Optional[str] = None,
|
|
||||||
tenant_id_filter: Optional[str] = None,
|
|
||||||
category_filter: Optional[str] = None,
|
|
||||||
assigned_to_filter: Optional[str] = None,
|
|
||||||
search: Optional[str] = None,
|
|
||||||
date_from: Optional[str] = None,
|
date_from: Optional[str] = None,
|
||||||
date_to: Optional[str] = None,
|
date_to: Optional[str] = None,
|
||||||
db: AsyncSession = Depends(get_db),
|
db: AsyncSession = Depends(get_db),
|
||||||
@@ -385,8 +311,6 @@ async def get_ticket(
|
|||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Obtener un ticket específico
|
Obtener un ticket específico
|
||||||
Roles ADMIN/SUPPORT_MANAGER/AGENT: Pueden ver todos los tickets del tenant
|
|
||||||
Roles CLIENT_USER/CLIENT_ADMIN: Solo pueden ver sus propios tickets
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
ticket_uuid = uuid.UUID(ticket_id)
|
ticket_uuid = uuid.UUID(ticket_id)
|
||||||
@@ -396,16 +320,12 @@ async def get_ticket(
|
|||||||
detail="Invalid ticket ID format"
|
detail="Invalid ticket ID format"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Construir query basado en el rol del usuario
|
|
||||||
query = select(Ticket).where(
|
query = select(Ticket).where(
|
||||||
Ticket.id == ticket_uuid,
|
Ticket.id == ticket_uuid,
|
||||||
Ticket.tenant_id == current_user.tenant_id
|
Ticket.tenant_id == current_user.tenant_id,
|
||||||
|
Ticket.created_by == current_user.id
|
||||||
)
|
)
|
||||||
|
|
||||||
# Si es cliente, solo puede ver sus propios tickets
|
|
||||||
if current_user.role in ["CLIENT_USER", "CLIENT_ADMIN"]:
|
|
||||||
query = query.where(Ticket.created_by == current_user.id)
|
|
||||||
|
|
||||||
result = await db.execute(query)
|
result = await db.execute(query)
|
||||||
ticket = result.scalars().first()
|
ticket = result.scalars().first()
|
||||||
|
|
||||||
@@ -442,8 +362,6 @@ async def update_ticket(
|
|||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Actualizar un ticket
|
Actualizar un ticket
|
||||||
Roles ADMIN/SUPPORT_MANAGER/AGENT: Pueden actualizar cualquier ticket del tenant
|
|
||||||
Roles CLIENT_USER/CLIENT_ADMIN: Solo pueden actualizar sus propios tickets
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
ticket_uuid = uuid.UUID(ticket_id)
|
ticket_uuid = uuid.UUID(ticket_id)
|
||||||
@@ -453,16 +371,12 @@ async def update_ticket(
|
|||||||
detail="Invalid ticket ID format"
|
detail="Invalid ticket ID format"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Construir query basado en el rol del usuario
|
|
||||||
query = select(Ticket).where(
|
query = select(Ticket).where(
|
||||||
Ticket.id == ticket_uuid,
|
Ticket.id == ticket_uuid,
|
||||||
Ticket.tenant_id == current_user.tenant_id
|
Ticket.tenant_id == current_user.tenant_id,
|
||||||
|
Ticket.created_by == current_user.id
|
||||||
)
|
)
|
||||||
|
|
||||||
# Si es cliente, solo puede actualizar sus propios tickets
|
|
||||||
if current_user.role in ["CLIENT_USER", "CLIENT_ADMIN"]:
|
|
||||||
query = query.where(Ticket.created_by == current_user.id)
|
|
||||||
|
|
||||||
result = await db.execute(query)
|
result = await db.execute(query)
|
||||||
db_ticket = result.scalars().first()
|
db_ticket = result.scalars().first()
|
||||||
|
|
||||||
@@ -524,8 +438,6 @@ async def close_ticket(
|
|||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Cerrar un ticket
|
Cerrar un ticket
|
||||||
Roles ADMIN/SUPPORT_MANAGER/AGENT: Pueden cerrar cualquier ticket del tenant
|
|
||||||
Roles CLIENT_USER/CLIENT_ADMIN: Solo pueden cerrar sus propios tickets
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
ticket_uuid = uuid.UUID(ticket_id)
|
ticket_uuid = uuid.UUID(ticket_id)
|
||||||
@@ -535,16 +447,12 @@ async def close_ticket(
|
|||||||
detail="Invalid ticket ID format"
|
detail="Invalid ticket ID format"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Construir query basado en el rol del usuario
|
|
||||||
query = select(Ticket).where(
|
query = select(Ticket).where(
|
||||||
Ticket.id == ticket_uuid,
|
Ticket.id == ticket_uuid,
|
||||||
Ticket.tenant_id == current_user.tenant_id
|
Ticket.tenant_id == current_user.tenant_id,
|
||||||
|
Ticket.created_by == current_user.id
|
||||||
)
|
)
|
||||||
|
|
||||||
# Si es cliente, solo puede cerrar sus propios tickets
|
|
||||||
if current_user.role in ["CLIENT_USER", "CLIENT_ADMIN"]:
|
|
||||||
query = query.where(Ticket.created_by == current_user.id)
|
|
||||||
|
|
||||||
result = await db.execute(query)
|
result = await db.execute(query)
|
||||||
db_ticket = result.scalars().first()
|
db_ticket = result.scalars().first()
|
||||||
|
|
||||||
|
|||||||
0
backend/app/models/audit.py
Normal file
0
backend/app/models/audit.py
Normal file
0
backend/app/models/refresh_token.py
Normal file
0
backend/app/models/refresh_token.py
Normal file
0
backend/app/services/audit_service.py
Normal file
0
backend/app/services/audit_service.py
Normal file
0
backend/app/services/token_service.py
Normal file
0
backend/app/services/token_service.py
Normal file
@@ -1,32 +0,0 @@
|
|||||||
"""Script para verificar información del admin"""
|
|
||||||
import asyncio
|
|
||||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
|
||||||
from sqlalchemy import select
|
|
||||||
from app.models.user import User
|
|
||||||
import os
|
|
||||||
|
|
||||||
async def check_user():
|
|
||||||
database_url = os.getenv('DATABASE_URL', 'postgresql+asyncpg://postgres:postgres@db:5432/servicemanager')
|
|
||||||
engine = create_async_engine(database_url)
|
|
||||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
|
||||||
|
|
||||||
async with async_session() as session:
|
|
||||||
result = await session.execute(
|
|
||||||
select(User).where(User.email == 'admin@example.com')
|
|
||||||
)
|
|
||||||
user = result.scalar_one_or_none()
|
|
||||||
|
|
||||||
if user:
|
|
||||||
print(f'User found:')
|
|
||||||
print(f' Email: {user.email}')
|
|
||||||
print(f' Role: {user.role}')
|
|
||||||
print(f' Tenant ID: {user.tenant_id}')
|
|
||||||
print(f' User ID: {user.id}')
|
|
||||||
else:
|
|
||||||
print('User not found')
|
|
||||||
|
|
||||||
await engine.dispose()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(check_user())
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
"""Script para verificar información del test_user"""
|
|
||||||
import asyncio
|
|
||||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
|
||||||
from sqlalchemy import select
|
|
||||||
from app.models.user import User
|
|
||||||
import os
|
|
||||||
|
|
||||||
async def check_user():
|
|
||||||
database_url = os.getenv('DATABASE_URL', 'postgresql+asyncpg://postgres:postgres@db:5432/servicemanager')
|
|
||||||
engine = create_async_engine(database_url)
|
|
||||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
|
||||||
|
|
||||||
async with async_session() as session:
|
|
||||||
result = await session.execute(
|
|
||||||
select(User).where(User.email == 'test_user@example.com')
|
|
||||||
)
|
|
||||||
user = result.scalar_one_or_none()
|
|
||||||
|
|
||||||
if user:
|
|
||||||
print(f'User found:')
|
|
||||||
print(f' Email: {user.email}')
|
|
||||||
print(f' Role: {user.role}')
|
|
||||||
print(f' Tenant ID: {user.tenant_id}')
|
|
||||||
print(f' User ID: {user.id}')
|
|
||||||
else:
|
|
||||||
print('User not found')
|
|
||||||
|
|
||||||
await engine.dispose()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(check_user())
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
"""
|
|
||||||
Script para verificar y actualizar password del test_user
|
|
||||||
"""
|
|
||||||
import asyncio
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
from sqlalchemy import select
|
|
||||||
from passlib.context import CryptContext
|
|
||||||
|
|
||||||
# Configurar el path
|
|
||||||
backend_path = os.path.join(os.path.dirname(__file__), 'backend')
|
|
||||||
sys.path.insert(0, backend_path)
|
|
||||||
|
|
||||||
from app.core.database import AsyncSessionLocal
|
|
||||||
from app.models.user import User
|
|
||||||
|
|
||||||
# Configurar passlib igual que en security.py
|
|
||||||
pwd_context = CryptContext(
|
|
||||||
schemes=["argon2", "bcrypt"],
|
|
||||||
deprecated="auto",
|
|
||||||
argon2__memory_cost=65536,
|
|
||||||
argon2__time_cost=3,
|
|
||||||
argon2__parallelism=4,
|
|
||||||
)
|
|
||||||
|
|
||||||
async def check_and_fix_test_user():
|
|
||||||
"""Verificar y actualizar password del test_user"""
|
|
||||||
|
|
||||||
# Contraseñas posibles
|
|
||||||
possible_passwords = [
|
|
||||||
"admin123",
|
|
||||||
"TestPassword123!",
|
|
||||||
"password123",
|
|
||||||
"test123",
|
|
||||||
"hashed_password"
|
|
||||||
]
|
|
||||||
|
|
||||||
async with AsyncSessionLocal() as session:
|
|
||||||
try:
|
|
||||||
# Buscar test_user
|
|
||||||
result = await session.execute(
|
|
||||||
select(User).where(User.email == "test_user@example.com")
|
|
||||||
)
|
|
||||||
user = result.scalar_one_or_none()
|
|
||||||
|
|
||||||
if not user:
|
|
||||||
print("❌ Usuario test_user@example.com no encontrado")
|
|
||||||
return
|
|
||||||
|
|
||||||
print(f"✅ Usuario encontrado: {user.email}")
|
|
||||||
print(f"Hash actual: {user.password_hash}")
|
|
||||||
|
|
||||||
# Probar contraseñas posibles
|
|
||||||
found_password = None
|
|
||||||
for password in possible_passwords:
|
|
||||||
if pwd_context.verify(password, user.password_hash):
|
|
||||||
found_password = password
|
|
||||||
break
|
|
||||||
|
|
||||||
if found_password:
|
|
||||||
print(f"🎉 Contraseña encontrada: {found_password}")
|
|
||||||
else:
|
|
||||||
print("❌ Ninguna contraseña coincide")
|
|
||||||
print("Estableciendo nueva contraseña: admin123")
|
|
||||||
|
|
||||||
# Establecer nueva contraseña
|
|
||||||
new_password = "admin123"
|
|
||||||
user.password_hash = pwd_context.hash(new_password)
|
|
||||||
await session.commit()
|
|
||||||
print(f"✅ Contraseña actualizada a: {new_password}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error: {e}")
|
|
||||||
await session.rollback()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(check_and_fix_test_user())
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
"""Script para verificar información del ticket"""
|
|
||||||
import asyncio
|
|
||||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
|
||||||
from sqlalchemy import select
|
|
||||||
from app.models.ticket import Ticket
|
|
||||||
from app.models.user import User
|
|
||||||
import uuid
|
|
||||||
import os
|
|
||||||
|
|
||||||
async def check_ticket():
|
|
||||||
database_url = os.getenv('DATABASE_URL', 'postgresql+asyncpg://postgres:postgres@db:5432/servicemanager')
|
|
||||||
engine = create_async_engine(database_url)
|
|
||||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
|
||||||
|
|
||||||
ticket_id = '2bd79718-440d-4144-b660-c0c6051fcf73'
|
|
||||||
|
|
||||||
async with async_session() as session:
|
|
||||||
result = await session.execute(
|
|
||||||
select(Ticket).where(Ticket.id == uuid.UUID(ticket_id))
|
|
||||||
)
|
|
||||||
ticket = result.scalar_one_or_none()
|
|
||||||
|
|
||||||
if ticket:
|
|
||||||
creator_result = await session.execute(
|
|
||||||
select(User).where(User.id == ticket.created_by)
|
|
||||||
)
|
|
||||||
creator = creator_result.scalar_one_or_none()
|
|
||||||
|
|
||||||
print(f'Ticket found:')
|
|
||||||
print(f' ID: {ticket.id}')
|
|
||||||
print(f' Number: {ticket.ticket_number}')
|
|
||||||
print(f' Subject: {ticket.subject}')
|
|
||||||
print(f' Status: {ticket.status}')
|
|
||||||
print(f' Tenant ID: {ticket.tenant_id}')
|
|
||||||
print(f' Created by ID: {ticket.created_by}')
|
|
||||||
if creator:
|
|
||||||
print(f' Creator email: {creator.email}')
|
|
||||||
print(f' Creator role: {creator.role}')
|
|
||||||
print(f' Assigned to: {ticket.assigned_to}')
|
|
||||||
else:
|
|
||||||
print('Ticket not found')
|
|
||||||
|
|
||||||
await engine.dispose()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(check_ticket())
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
"""Script para verificar números de tickets existentes"""
|
|
||||||
import asyncio
|
|
||||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
|
||||||
from sqlalchemy import select
|
|
||||||
from app.models.ticket import Ticket
|
|
||||||
import os
|
|
||||||
|
|
||||||
async def check_tickets():
|
|
||||||
database_url = os.getenv('DATABASE_URL', 'postgresql+asyncpg://postgres:postgres@db:5432/servicemanager')
|
|
||||||
engine = create_async_engine(database_url)
|
|
||||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
|
||||||
|
|
||||||
tenant_id = 'c186c814-4f5a-4293-aae9-46f57637bb35'
|
|
||||||
|
|
||||||
async with async_session() as session:
|
|
||||||
result = await session.execute(
|
|
||||||
select(Ticket.ticket_number, Ticket.id, Ticket.subject)
|
|
||||||
.where(Ticket.tenant_id == tenant_id)
|
|
||||||
.order_by(Ticket.ticket_number)
|
|
||||||
)
|
|
||||||
tickets = result.all()
|
|
||||||
|
|
||||||
print(f"Tickets existentes para tenant {tenant_id}:")
|
|
||||||
print("=" * 80)
|
|
||||||
for ticket_number, ticket_id, subject in tickets:
|
|
||||||
print(f" {ticket_number} | {ticket_id} | {subject}")
|
|
||||||
print("=" * 80)
|
|
||||||
print(f"Total: {len(tickets)} tickets")
|
|
||||||
|
|
||||||
if tickets:
|
|
||||||
last_ticket = tickets[-1]
|
|
||||||
last_number = int(last_ticket[0].split('-')[1])
|
|
||||||
next_number = last_number + 1
|
|
||||||
print(f"\nÚltimo número: {last_ticket[0]} (número: {last_number})")
|
|
||||||
print(f"Próximo número debería ser: TK-{next_number:06d}")
|
|
||||||
|
|
||||||
await engine.dispose()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(check_tickets())
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Add parent directory to path so we can import 'app'
|
|
||||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
|
|
||||||
from sqlalchemy import select
|
|
||||||
from app.core.database import AsyncSessionLocal
|
|
||||||
from app.models.tenant import Tenant
|
|
||||||
from app.models.ticket import Ticket
|
|
||||||
from app.models.category import Category # ✅ AÑADIR ESTO
|
|
||||||
from app.models.system import System # ✅ AÑADIR ESTO
|
|
||||||
from app.models.user import User
|
|
||||||
from app.core.security import SecurityUtils
|
|
||||||
|
|
||||||
async def fix_password():
|
|
||||||
async with AsyncSessionLocal() as session:
|
|
||||||
# Find the admin user
|
|
||||||
email = "admin@aduanasoft.com"
|
|
||||||
result = await session.execute(select(User).where(User.email == email))
|
|
||||||
user = result.scalar_one_or_none()
|
|
||||||
|
|
||||||
if user:
|
|
||||||
print(f"User {email} found.")
|
|
||||||
# Reset password to 'admin123'
|
|
||||||
new_password = "admin123"
|
|
||||||
hashed = SecurityUtils.hash_password(new_password)
|
|
||||||
user.password_hash = hashed
|
|
||||||
|
|
||||||
try:
|
|
||||||
await session.commit()
|
|
||||||
print(f"Password for {email} updated successfully!")
|
|
||||||
print(f"New password is: {new_password}")
|
|
||||||
except Exception as e:
|
|
||||||
await session.rollback()
|
|
||||||
print(f"Error updating password: {e}")
|
|
||||||
else:
|
|
||||||
print(f"User {email} not found!")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(fix_password())
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
"""Script para listar todos los usuarios"""
|
|
||||||
import asyncio
|
|
||||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
|
||||||
from sqlalchemy import select
|
|
||||||
from app.models.user import User
|
|
||||||
import os
|
|
||||||
|
|
||||||
async def list_users():
|
|
||||||
database_url = os.getenv('DATABASE_URL', 'postgresql+asyncpg://postgres:postgres@db:5432/servicemanager')
|
|
||||||
engine = create_async_engine(database_url)
|
|
||||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
|
||||||
|
|
||||||
async with async_session() as session:
|
|
||||||
result = await session.execute(select(User))
|
|
||||||
users = result.scalars().all()
|
|
||||||
|
|
||||||
if users:
|
|
||||||
print(f'Found {len(users)} users:')
|
|
||||||
for user in users:
|
|
||||||
print(f'\n Email: {user.email}')
|
|
||||||
print(f' Role: {user.role}')
|
|
||||||
print(f' Tenant ID: {user.tenant_id}')
|
|
||||||
print(f' User ID: {user.id}')
|
|
||||||
else:
|
|
||||||
print('No users found')
|
|
||||||
|
|
||||||
await engine.dispose()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(list_users())
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
"""
|
|
||||||
Script para establecer contraseña real al test_user
|
|
||||||
"""
|
|
||||||
import asyncio
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
from sqlalchemy import select
|
|
||||||
from passlib.context import CryptContext
|
|
||||||
|
|
||||||
# Configurar el path
|
|
||||||
backend_path = os.path.join(os.path.dirname(__file__), 'backend')
|
|
||||||
sys.path.insert(0, backend_path)
|
|
||||||
|
|
||||||
from app.core.database import AsyncSessionLocal
|
|
||||||
from app.models.user import User
|
|
||||||
|
|
||||||
# Configurar passlib
|
|
||||||
pwd_context = CryptContext(
|
|
||||||
schemes=["argon2", "bcrypt"],
|
|
||||||
deprecated="auto",
|
|
||||||
argon2__memory_cost=65536,
|
|
||||||
argon2__time_cost=3,
|
|
||||||
argon2__parallelism=4,
|
|
||||||
)
|
|
||||||
|
|
||||||
async def set_test_user_password():
|
|
||||||
"""Establecer contraseña admin123 para test_user"""
|
|
||||||
|
|
||||||
new_password = "admin123"
|
|
||||||
password_hash = pwd_context.hash(new_password)
|
|
||||||
|
|
||||||
async with AsyncSessionLocal() as session:
|
|
||||||
try:
|
|
||||||
# Buscar test_user
|
|
||||||
result = await session.execute(
|
|
||||||
select(User).where(User.email == "test_user@example.com")
|
|
||||||
)
|
|
||||||
user = result.scalar_one_or_none()
|
|
||||||
|
|
||||||
if not user:
|
|
||||||
print("❌ Usuario test_user@example.com no encontrado")
|
|
||||||
return
|
|
||||||
|
|
||||||
print(f"✅ Usuario encontrado: {user.email}")
|
|
||||||
print(f"Hash anterior: {user.password_hash}")
|
|
||||||
|
|
||||||
# Establecer nueva contraseña hash
|
|
||||||
user.password_hash = password_hash
|
|
||||||
await session.commit()
|
|
||||||
|
|
||||||
print(f"🎉 Contraseña establecida: {new_password}")
|
|
||||||
print(f"✅ Nuevo hash: {password_hash[:50]}...")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error: {e}")
|
|
||||||
await session.rollback()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(set_test_user_password())
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
"""Script para verificar el acceso a tickets con diferentes usuarios"""
|
|
||||||
import asyncio
|
|
||||||
import httpx
|
|
||||||
import os
|
|
||||||
|
|
||||||
BASE_URL = "http://localhost:8000/api/v1"
|
|
||||||
TICKET_ID = "2bd79718-440d-4144-b660-c0c6051fcf73"
|
|
||||||
|
|
||||||
async def login(email: str, password: str, tenant_slug: str = "aduanasoft"):
|
|
||||||
"""Login y obtener token"""
|
|
||||||
async with httpx.AsyncClient() as client:
|
|
||||||
response = await client.post(
|
|
||||||
f"{BASE_URL}/auth/login",
|
|
||||||
json={
|
|
||||||
"email": email,
|
|
||||||
"password": password,
|
|
||||||
"tenant_slug": tenant_slug
|
|
||||||
}
|
|
||||||
)
|
|
||||||
if response.status_code == 200:
|
|
||||||
data = response.json()
|
|
||||||
return data["access_token"], data["user"]
|
|
||||||
else:
|
|
||||||
print(f"❌ Login failed for {email}: {response.text}")
|
|
||||||
return None, None
|
|
||||||
|
|
||||||
async def get_ticket(ticket_id: str, token: str, tenant_id: str):
|
|
||||||
"""Intentar obtener un ticket"""
|
|
||||||
async with httpx.AsyncClient() as client:
|
|
||||||
response = await client.get(
|
|
||||||
f"{BASE_URL}/tickets/{ticket_id}",
|
|
||||||
headers={
|
|
||||||
"Authorization": f"Bearer {token}",
|
|
||||||
"X-Tenant-ID": tenant_id
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return response.status_code, response.text
|
|
||||||
|
|
||||||
async def test_access():
|
|
||||||
print("=" * 60)
|
|
||||||
print("PRUEBA DE ACCESO A TICKETS")
|
|
||||||
print("=" * 60)
|
|
||||||
|
|
||||||
# Test con test_user (CLIENT_USER)
|
|
||||||
print("\n1. Probando con test_user (CLIENT_USER)...")
|
|
||||||
token, user = await login("test_user@example.com", "TestPassword123!")
|
|
||||||
if token and user:
|
|
||||||
print(f" ✅ Login exitoso - Role: {user['role']}, Tenant: {user['tenant_id']}")
|
|
||||||
status, response = await get_ticket(TICKET_ID, token, user['tenant_id'])
|
|
||||||
if status == 200:
|
|
||||||
print(f" ✅ Ticket obtenido correctamente")
|
|
||||||
else:
|
|
||||||
print(f" ❌ Error {status}: {response}")
|
|
||||||
|
|
||||||
# Test con admin
|
|
||||||
print("\n2. Probando con admin (ADMIN)...")
|
|
||||||
token, user = await login("admin@aduanasoft.com", "Admin123!")
|
|
||||||
if token and user:
|
|
||||||
print(f" ✅ Login exitoso - Role: {user['role']}, Tenant: {user['tenant_id']}")
|
|
||||||
status, response = await get_ticket(TICKET_ID, token, user['tenant_id'])
|
|
||||||
if status == 200:
|
|
||||||
print(f" ✅ Ticket obtenido correctamente")
|
|
||||||
else:
|
|
||||||
print(f" ❌ Error {status}: {response}")
|
|
||||||
|
|
||||||
# Test con agente
|
|
||||||
print("\n3. Probando con agente (AGENT)...")
|
|
||||||
token, user = await login("agente@aduanasoft.com", "Agente123!")
|
|
||||||
if token and user:
|
|
||||||
print(f" ✅ Login exitoso - Role: {user['role']}, Tenant: {user['tenant_id']}")
|
|
||||||
status, response = await get_ticket(TICKET_ID, token, user['tenant_id'])
|
|
||||||
if status == 200:
|
|
||||||
print(f" ✅ Ticket obtenido correctamente")
|
|
||||||
else:
|
|
||||||
print(f" ❌ Error {status}: {response}")
|
|
||||||
|
|
||||||
print("\n" + "=" * 60)
|
|
||||||
print("Nota: Este ticket fue creado por test_user@example.com")
|
|
||||||
print("Ahora todos los usuarios del mismo tenant deberían poder verlo")
|
|
||||||
print("según su rol (admins y agentes: todos, clientes: solo propios)")
|
|
||||||
print("=" * 60)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(test_access())
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
"""
|
|
||||||
Script para actualizar el password del usuario admin
|
|
||||||
Ejecutar: python fix_admin_password.py
|
|
||||||
"""
|
|
||||||
import asyncio
|
|
||||||
import sys
|
|
||||||
from sqlalchemy import select, update
|
|
||||||
from passlib.context import CryptContext
|
|
||||||
|
|
||||||
# Importar desde el proyecto
|
|
||||||
sys.path.insert(0, '/app')
|
|
||||||
from app.core.database import AsyncSessionLocal
|
|
||||||
from app.models.user import User
|
|
||||||
|
|
||||||
# Configurar passlib igual que en security.py
|
|
||||||
pwd_context = CryptContext(
|
|
||||||
schemes=["argon2", "bcrypt"],
|
|
||||||
deprecated="auto",
|
|
||||||
argon2__memory_cost=65536,
|
|
||||||
argon2__time_cost=3,
|
|
||||||
argon2__parallelism=4,
|
|
||||||
)
|
|
||||||
|
|
||||||
async def fix_admin_password():
|
|
||||||
"""Actualizar password del admin a 'admin123'"""
|
|
||||||
|
|
||||||
# Generar hash del password
|
|
||||||
new_password = "admin123"
|
|
||||||
password_hash = pwd_context.hash(new_password)
|
|
||||||
|
|
||||||
print(f"Nuevo hash generado para password: {new_password}")
|
|
||||||
print(f"Hash: {password_hash[:50]}...")
|
|
||||||
|
|
||||||
async with AsyncSessionLocal() as session:
|
|
||||||
try:
|
|
||||||
# Buscar usuario admin
|
|
||||||
result = await session.execute(
|
|
||||||
select(User).where(User.email == "admin@aduanasoft.com")
|
|
||||||
)
|
|
||||||
user = result.scalar_one_or_none()
|
|
||||||
|
|
||||||
if not user:
|
|
||||||
print("❌ Usuario admin no encontrado")
|
|
||||||
return
|
|
||||||
|
|
||||||
print(f"✅ Usuario encontrado: {user.email} (ID: {user.id})")
|
|
||||||
|
|
||||||
# Actualizar password
|
|
||||||
user.password_hash = password_hash
|
|
||||||
|
|
||||||
await session.commit()
|
|
||||||
|
|
||||||
print("✅ Password actualizado exitosamente")
|
|
||||||
print(f" Email: admin@aduanasoft.com")
|
|
||||||
print(f" Password: admin123")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
await session.rollback()
|
|
||||||
print(f"❌ Error: {e}")
|
|
||||||
raise
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
print("=" * 60)
|
|
||||||
print("ACTUALIZAR PASSWORD DEL ADMIN")
|
|
||||||
print("=" * 60)
|
|
||||||
asyncio.run(fix_admin_password())
|
|
||||||
print("=" * 60)
|
|
||||||
@@ -8,7 +8,7 @@ export default defineConfig({
|
|||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://backend:8000',
|
target: 'http://servicemanager-backend:8000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '')
|
rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { auth } from '$lib/stores/auth.js';
|
import { auth } from '$lib/stores/auth.js';
|
||||||
|
;
|
||||||
|
|
||||||
export let toggleSidebar: () => void;
|
export let toggleSidebar: () => void;
|
||||||
|
|
||||||
|
|||||||
@@ -62,16 +62,7 @@
|
|||||||
name: 'Auditoría',
|
name: 'Auditoría',
|
||||||
href: '/audit',
|
href: '/audit',
|
||||||
icon: 'M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z'
|
icon: 'M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z'
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseNavigation;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isCurrentPage(href: string) {
|
|
||||||
return $page.url.pathname === href || ($page.url.pathname.startsWith(href) && href !== '/');
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Mobile sidebar backdrop -->
|
<!-- Mobile sidebar backdrop -->
|
||||||
|
|||||||
@@ -25,15 +25,11 @@ async function request<T>(endpoint: string, options: RequestOptions = {}): Promi
|
|||||||
|
|
||||||
const authState = get(auth);
|
const authState = get(auth);
|
||||||
const token = authState.token || (typeof window !== 'undefined' ? localStorage.getItem('internal_auth_token') : null);
|
const token = authState.token || (typeof window !== 'undefined' ? localStorage.getItem('internal_auth_token') : null);
|
||||||
const user = authState.user || (typeof window !== 'undefined' ? JSON.parse(localStorage.getItem('internal_auth_user') || 'null') : null);
|
|
||||||
|
|
||||||
const headers = new Headers(init.headers);
|
const headers = new Headers(init.headers);
|
||||||
if (token) {
|
if (token) {
|
||||||
headers.set('Authorization', `Bearer ${token}`);
|
headers.set('Authorization', `Bearer ${token}`);
|
||||||
}
|
}
|
||||||
if (user && user.tenant_id) {
|
|
||||||
headers.set('X-Tenant-ID', user.tenant_id);
|
|
||||||
}
|
|
||||||
if (!headers.has('Content-Type')) {
|
if (!headers.has('Content-Type')) {
|
||||||
headers.set('Content-Type', 'application/json');
|
headers.set('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
@@ -69,15 +65,11 @@ async function request<T>(endpoint: string, options: RequestOptions = {}): Promi
|
|||||||
async function downloadFile(endpoint: string, filename: string): Promise<void> {
|
async function downloadFile(endpoint: string, filename: string): Promise<void> {
|
||||||
const authState = get(auth);
|
const authState = get(auth);
|
||||||
const token = authState.token || (typeof window !== 'undefined' ? localStorage.getItem('internal_auth_token') : null);
|
const token = authState.token || (typeof window !== 'undefined' ? localStorage.getItem('internal_auth_token') : null);
|
||||||
const user = authState.user || (typeof window !== 'undefined' ? JSON.parse(localStorage.getItem('internal_auth_user') || 'null') : null);
|
|
||||||
|
|
||||||
const headers = new Headers();
|
const headers = new Headers();
|
||||||
if (token) {
|
if (token) {
|
||||||
headers.set('Authorization', `Bearer ${token}`);
|
headers.set('Authorization', `Bearer ${token}`);
|
||||||
}
|
}
|
||||||
if (user && user.tenant_id) {
|
|
||||||
headers.set('X-Tenant-ID', user.tenant_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await fetch(`${API_BASE}${endpoint}`, {
|
const response = await fetch(`${API_BASE}${endpoint}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|||||||
0
frontend-internal/src/routes/audit/+page.svelte
Normal file
0
frontend-internal/src/routes/audit/+page.svelte
Normal file
@@ -9,7 +9,6 @@
|
|||||||
let categories = [];
|
let categories = [];
|
||||||
let systems = [];
|
let systems = [];
|
||||||
let users = [];
|
let users = [];
|
||||||
let tenants = []; // Nueva lista de tenants
|
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let showModal = false;
|
let showModal = false;
|
||||||
let showEditModal = false;
|
let showEditModal = false;
|
||||||
@@ -19,15 +18,6 @@
|
|||||||
// Filtros
|
// Filtros
|
||||||
let filterStatus = '';
|
let filterStatus = '';
|
||||||
let filterPriority = '';
|
let filterPriority = '';
|
||||||
let filterTenant = ''; // Nuevo filtro por cliente/tenant
|
|
||||||
let filterCategory = ''; // Filtro por categoría
|
|
||||||
let filterAssignedTo = ''; // Filtro por asignado a
|
|
||||||
let searchText = ''; // Búsqueda por texto
|
|
||||||
let filterDateFrom = ''; // Fecha desde
|
|
||||||
let filterDateTo = ''; // Fecha hasta
|
|
||||||
|
|
||||||
// Estado de filtros
|
|
||||||
$: activeFiltersCount = [filterTenant, filterStatus, filterPriority, filterCategory, filterAssignedTo, searchText, filterDateFrom, filterDateTo].filter(f => f && f.trim()).length;
|
|
||||||
|
|
||||||
// Form para editar
|
// Form para editar
|
||||||
let editFormData = {
|
let editFormData = {
|
||||||
@@ -60,34 +50,25 @@
|
|||||||
{ value: 'URGENT', label: 'Urgente', color: 'red' }
|
{ value: 'URGENT', label: 'Urgente', color: 'red' }
|
||||||
];
|
];
|
||||||
|
|
||||||
// Ajustar la función loadData para usar el endpoint administrativo con filtros
|
// Ajustar la función loadData para asegurar que los filtros se envíen correctamente
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
try {
|
try {
|
||||||
// Preparar parámetros filtrando valores vacíos
|
const [ticketsData, categoriesData, systemsData, usersData] = await Promise.all([
|
||||||
const ticketParams = {};
|
api.get('/tickets/', {
|
||||||
if (filterStatus) ticketParams.status_filter = filterStatus;
|
params: {
|
||||||
if (filterPriority) ticketParams.priority_filter = filterPriority;
|
status: filterStatus || undefined,
|
||||||
if (filterTenant) ticketParams.tenant_id_filter = filterTenant;
|
priority: filterPriority || undefined
|
||||||
if (filterCategory) ticketParams.category_filter = filterCategory;
|
}
|
||||||
if (filterAssignedTo) ticketParams.assigned_to_filter = filterAssignedTo;
|
}),
|
||||||
if (searchText) ticketParams.search = searchText;
|
|
||||||
if (filterDateFrom) ticketParams.date_from = filterDateFrom;
|
|
||||||
if (filterDateTo) ticketParams.date_to = filterDateTo;
|
|
||||||
|
|
||||||
const [ticketsData, categoriesData, systemsData, usersData, tenantsData] = await Promise.all([
|
|
||||||
// Usar el nuevo endpoint administrativo
|
|
||||||
api.get('/tickets/admin/all', ticketParams),
|
|
||||||
api.get('/categories/'),
|
api.get('/categories/'),
|
||||||
api.get('/systems/'),
|
api.get('/systems/'),
|
||||||
api.get('/users/'),
|
api.get('/users/')
|
||||||
api.get('/tenants/') // Cargar lista de tenants
|
|
||||||
]);
|
]);
|
||||||
tickets = ticketsData;
|
tickets = ticketsData;
|
||||||
categories = categoriesData;
|
categories = categoriesData;
|
||||||
systems = systemsData;
|
systems = systemsData;
|
||||||
users = usersData;
|
users = usersData;
|
||||||
tenants = tenantsData;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast.error('Error cargando datos: ' + (e.message || 'Error desconocido'));
|
toast.error('Error cargando datos: ' + (e.message || 'Error desconocido'));
|
||||||
} finally {
|
} finally {
|
||||||
@@ -99,28 +80,6 @@
|
|||||||
function applyFilters() {
|
function applyFilters() {
|
||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limpiar todos los filtros
|
|
||||||
function clearFilters() {
|
|
||||||
filterStatus = '';
|
|
||||||
filterPriority = '';
|
|
||||||
filterTenant = '';
|
|
||||||
filterCategory = '';
|
|
||||||
filterAssignedTo = '';
|
|
||||||
searchText = '';
|
|
||||||
filterDateFrom = '';
|
|
||||||
filterDateTo = '';
|
|
||||||
applyFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Búsqueda en tiempo real (debounced)
|
|
||||||
let searchTimeout;
|
|
||||||
function handleSearchInput() {
|
|
||||||
clearTimeout(searchTimeout);
|
|
||||||
searchTimeout = setTimeout(() => {
|
|
||||||
applyFilters();
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openCreateModal() {
|
function openCreateModal() {
|
||||||
selectedTicket = null;
|
selectedTicket = null;
|
||||||
@@ -260,31 +219,12 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="px-4 py-8 mx-auto max-w-7xl sm:px-6 lg:px-8">
|
<div class="px-4 py-8 mx-auto max-w-7xl sm:px-6 lg:px-8">
|
||||||
<div class="sm:flex sm:items-center sm:justify-between">
|
<div class="sm:flex sm:items-center">
|
||||||
<div class="sm:flex-auto">
|
<div class="sm:flex-auto">
|
||||||
<h1 class="text-xl font-semibold text-gray-900">Tickets de Soporte</h1>
|
<h1 class="text-xl font-semibold text-gray-900">Tickets de Soporte</h1>
|
||||||
<p class="mt-2 text-sm text-gray-700">
|
<p class="mt-2 text-sm text-gray-700">Gestión de tickets del sistema de mesa de ayuda.</p>
|
||||||
Gestión de tickets del sistema de mesa de ayuda.
|
|
||||||
{#if activeFiltersCount > 0}
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 ml-2">
|
|
||||||
{activeFiltersCount} filtro{activeFiltersCount !== 1 ? 's' : ''} activo{activeFiltersCount !== 1 ? 's' : ''}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none space-x-3">
|
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
|
||||||
{#if activeFiltersCount > 0}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
on:click={clearFilters}
|
|
||||||
class="inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50"
|
|
||||||
>
|
|
||||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
||||||
</svg>
|
|
||||||
Limpiar filtros
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
on:click={openCreateModal}
|
on:click={openCreateModal}
|
||||||
@@ -295,139 +235,46 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Filtros Avanzados -->
|
<!-- Filtros -->
|
||||||
<div class="mt-6 bg-white shadow sm:rounded-lg">
|
<div class="mt-6 bg-white shadow sm:rounded-lg p-4">
|
||||||
<div class="px-4 py-5 sm:p-6">
|
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
|
||||||
<h3 class="text-lg leading-6 font-medium text-gray-900 mb-4">Filtros</h3>
|
<div>
|
||||||
|
<label for="filterStatus" class="block text-sm font-medium text-gray-700">Estado</label>
|
||||||
<!-- Primera fila - Búsqueda y Filtros principales -->
|
<select
|
||||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-4 mb-4">
|
id="filterStatus"
|
||||||
<!-- Búsqueda por texto -->
|
bind:value={filterStatus}
|
||||||
<div class="sm:col-span-2">
|
on:change={applyFilters}
|
||||||
<label for="searchText" class="block text-sm font-medium text-gray-700 mb-1">Búsqueda</label>
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm border p-2"
|
||||||
<div class="relative">
|
>
|
||||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
<option value="">Todos</option>
|
||||||
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
{#each STATUSES as status}
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
<option value={status.value}>{status.label}</option>
|
||||||
</svg>
|
{/each}
|
||||||
</div>
|
</select>
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
id="searchText"
|
|
||||||
bind:value={searchText}
|
|
||||||
on:input={handleSearchInput}
|
|
||||||
placeholder="Buscar en título o descripción..."
|
|
||||||
class="pl-10 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Cliente/Empresa -->
|
|
||||||
<div>
|
|
||||||
<label for="filterTenant" class="block text-sm font-medium text-gray-700 mb-1">Cliente/Empresa</label>
|
|
||||||
<select
|
|
||||||
id="filterTenant"
|
|
||||||
bind:value={filterTenant}
|
|
||||||
on:change={applyFilters}
|
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
||||||
>
|
|
||||||
<option value="">Todos los clientes</option>
|
|
||||||
{#each tenants as tenant}
|
|
||||||
<option value={tenant.id}>{tenant.name}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Estado -->
|
|
||||||
<div>
|
|
||||||
<label for="filterStatus" class="block text-sm font-medium text-gray-700 mb-1">Estado</label>
|
|
||||||
<select
|
|
||||||
id="filterStatus"
|
|
||||||
bind:value={filterStatus}
|
|
||||||
on:change={applyFilters}
|
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
||||||
>
|
|
||||||
<option value="">Todos</option>
|
|
||||||
{#each STATUSES as status}
|
|
||||||
<option value={status.value}>{status.label}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Segunda fila - Filtros secundarios -->
|
<div>
|
||||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-5">
|
<label for="filterPriority" class="block text-sm font-medium text-gray-700">Prioridad</label>
|
||||||
<!-- Prioridad -->
|
<select
|
||||||
<div>
|
id="filterPriority"
|
||||||
<label for="filterPriority" class="block text-sm font-medium text-gray-700 mb-1">Prioridad</label>
|
bind:value={filterPriority}
|
||||||
<select
|
on:change={applyFilters}
|
||||||
id="filterPriority"
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm border p-2"
|
||||||
bind:value={filterPriority}
|
>
|
||||||
on:change={applyFilters}
|
<option value="">Todas</option>
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
{#each PRIORITIES as priority}
|
||||||
>
|
<option value={priority.value}>{priority.label}</option>
|
||||||
<option value="">Todas</option>
|
{/each}
|
||||||
{#each PRIORITIES as priority}
|
</select>
|
||||||
<option value={priority.value}>{priority.label}</option>
|
</div>
|
||||||
{/each}
|
|
||||||
</select>
|
<div class="flex items-end">
|
||||||
</div>
|
<button
|
||||||
|
on:click={loadData}
|
||||||
<!-- Categoría -->
|
class="w-full inline-flex justify-center items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
||||||
<div>
|
>
|
||||||
<label for="filterCategory" class="block text-sm font-medium text-gray-700 mb-1">Categoría</label>
|
Actualizar
|
||||||
<select
|
</button>
|
||||||
id="filterCategory"
|
|
||||||
bind:value={filterCategory}
|
|
||||||
on:change={applyFilters}
|
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
||||||
>
|
|
||||||
<option value="">Todas</option>
|
|
||||||
{#each categories as category}
|
|
||||||
<option value={category.id}>{category.name}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Asignado a -->
|
|
||||||
<div>
|
|
||||||
<label for="filterAssignedTo" class="block text-sm font-medium text-gray-700 mb-1">Asignado a</label>
|
|
||||||
<select
|
|
||||||
id="filterAssignedTo"
|
|
||||||
bind:value={filterAssignedTo}
|
|
||||||
on:change={applyFilters}
|
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
||||||
>
|
|
||||||
<option value="">Todos</option>
|
|
||||||
{#each users.filter(u => u.role === 'AGENT' || u.role === 'SUPPORT_MANAGER' || u.role === 'ADMIN') as user}
|
|
||||||
<option value={user.id}>{user.first_name} {user.last_name}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Fecha desde -->
|
|
||||||
<div>
|
|
||||||
<label for="filterDateFrom" class="block text-sm font-medium text-gray-700 mb-1">Desde</label>
|
|
||||||
<input
|
|
||||||
type="date"
|
|
||||||
id="filterDateFrom"
|
|
||||||
bind:value={filterDateFrom}
|
|
||||||
on:change={applyFilters}
|
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Fecha hasta -->
|
|
||||||
<div>
|
|
||||||
<label for="filterDateTo" class="block text-sm font-medium text-gray-700 mb-1">Hasta</label>
|
|
||||||
<input
|
|
||||||
type="date"
|
|
||||||
id="filterDateTo"
|
|
||||||
bind:value={filterDateTo}
|
|
||||||
on:change={applyFilters}
|
|
||||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -441,13 +288,12 @@
|
|||||||
<thead class="bg-gray-50">
|
<thead class="bg-gray-50">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Ticket</th>
|
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Ticket</th>
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Cliente/Empresa</th>
|
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Asunto</th>
|
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Asunto</th>
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Estado</th>
|
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Estado</th>
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Prioridad</th>
|
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Prioridad</th>
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Creado por</th>
|
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Categoría</th>
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Asignado a</th>
|
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Asignado a</th>
|
||||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Fecha</th>
|
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Creado</th>
|
||||||
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
|
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
|
||||||
<span class="sr-only">Acciones</span>
|
<span class="sr-only">Acciones</span>
|
||||||
</th>
|
</th>
|
||||||
@@ -455,9 +301,9 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody class="divide-y divide-gray-200 bg-white">
|
<tbody class="divide-y divide-gray-200 bg-white">
|
||||||
{#if isLoading}
|
{#if isLoading}
|
||||||
<tr><td colspan="9" class="text-center py-4">Cargando...</td></tr>
|
<tr><td colspan="8" class="text-center py-4">Cargando...</td></tr>
|
||||||
{:else if tickets.length === 0}
|
{:else if tickets.length === 0}
|
||||||
<tr><td colspan="9" class="text-center py-4">No hay tickets registrados</td></tr>
|
<tr><td colspan="8" class="text-center py-4">No hay tickets registrados</td></tr>
|
||||||
{:else}
|
{:else}
|
||||||
{#each tickets as ticket}
|
{#each tickets as ticket}
|
||||||
<tr
|
<tr
|
||||||
@@ -467,10 +313,6 @@
|
|||||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
|
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
|
||||||
{ticket.ticket_number || ticket.id.substring(0, 8)}
|
{ticket.ticket_number || ticket.id.substring(0, 8)}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-3 py-4 text-sm text-gray-900">
|
|
||||||
<div class="font-medium text-indigo-600">{ticket.tenant?.name || 'N/A'}</div>
|
|
||||||
<div class="text-xs text-gray-500">{ticket.tenant?.contact_email || ''}</div>
|
|
||||||
</td>
|
|
||||||
<td class="px-3 py-4 text-sm text-gray-900">
|
<td class="px-3 py-4 text-sm text-gray-900">
|
||||||
<div class="font-medium">{ticket.subject}</div>
|
<div class="font-medium">{ticket.subject}</div>
|
||||||
<div class="text-gray-500 truncate max-w-xs">{ticket.description}</div>
|
<div class="text-gray-500 truncate max-w-xs">{ticket.description}</div>
|
||||||
@@ -485,10 +327,8 @@
|
|||||||
{getPriorityBadge(ticket.priority).label}
|
{getPriorityBadge(ticket.priority).label}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-3 py-4 text-sm text-gray-900">
|
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||||
<div class="font-medium">{ticket.created_by_user?.first_name} {ticket.created_by_user?.last_name}</div>
|
{getCategoryName(ticket.category_id)}
|
||||||
<div class="text-xs text-gray-500">{ticket.created_by_user?.email}</div>
|
|
||||||
<div class="text-xs text-indigo-600">{ticket.created_by_user?.role || ''}</div>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||||
{getUserName(ticket.assigned_to)}
|
{getUserName(ticket.assigned_to)}
|
||||||
|
|||||||
Binary file not shown.
@@ -1,34 +0,0 @@
|
|||||||
# Test de Attachments API
|
|
||||||
# Ejecutar desde PowerShell
|
|
||||||
|
|
||||||
# 1. Login
|
|
||||||
$body = '{"email":"admin@aduanasoft.com","password":"admin123","tenant_slug":"aduanasoft"}'
|
|
||||||
$login = Invoke-RestMethod -Uri "http://localhost:8000/v1/auth/login" -Method POST -Body $body -ContentType "application/json"
|
|
||||||
|
|
||||||
$token = $login.data.access_token
|
|
||||||
$tenantId = $login.data.user.tenant_id
|
|
||||||
|
|
||||||
$headers = @{
|
|
||||||
"Authorization" = "Bearer $token"
|
|
||||||
"X-Tenant-ID" = $tenantId
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Autenticacion exitosa" -ForegroundColor Green
|
|
||||||
|
|
||||||
# 2. Listar tickets
|
|
||||||
$tickets = Invoke-RestMethod -Uri "http://localhost:8000/v1/tickets" -Headers $headers
|
|
||||||
$ticketId = $tickets.data[0].id
|
|
||||||
|
|
||||||
Write-Host "Ticket ID obtenido: $ticketId" -ForegroundColor Green
|
|
||||||
|
|
||||||
# 3. Listar attachments del ticket
|
|
||||||
$attachments = Invoke-RestMethod -Uri "http://localhost:8000/v1/tickets/$ticketId/attachments" -Headers $headers
|
|
||||||
|
|
||||||
Write-Host "Attachments listados: $($attachments.Count) encontrados" -ForegroundColor Green
|
|
||||||
|
|
||||||
if ($attachments.Count -gt 0) {
|
|
||||||
$attachments | Format-Table id, original_filename, file_size, created_at
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host ""
|
|
||||||
Write-Host "TEST COMPLETADO" -ForegroundColor Cyan
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
# Test script para attachments endpoint
|
|
||||||
Write-Host "=== Testing Attachments Endpoint ===" -ForegroundColor Cyan
|
|
||||||
|
|
||||||
# 1. Login
|
|
||||||
$body = '{"email":"admin@aduanasoft.com","password":"admin123","tenant_slug":"aduanasoft"}'
|
|
||||||
try {
|
|
||||||
$login = Invoke-RestMethod -Uri "http://localhost:8000/v1/auth/login" -Method POST -Body $body -ContentType "application/json"
|
|
||||||
Write-Host "[OK] Login exitoso" -ForegroundColor Green
|
|
||||||
|
|
||||||
$token = $login.access_token
|
|
||||||
$tenantId = $login.user.tenant_id
|
|
||||||
|
|
||||||
Write-Host "Token: $($token.Substring(0,20))..." -ForegroundColor Gray
|
|
||||||
Write-Host "Tenant ID: $tenantId" -ForegroundColor Gray
|
|
||||||
|
|
||||||
# 2. Test attachments endpoint
|
|
||||||
$headers = @{
|
|
||||||
"Authorization" = "Bearer $token"
|
|
||||||
"X-Tenant-ID" = $tenantId
|
|
||||||
}
|
|
||||||
|
|
||||||
$url = "http://localhost:8000/v1/tickets/68eaf0fe-b5c3-4d42-9b36-895b439be583/attachments"
|
|
||||||
Write-Host "`nProbando GET $url" -ForegroundColor Yellow
|
|
||||||
|
|
||||||
try {
|
|
||||||
$response = Invoke-WebRequest -Uri $url -Headers $headers -Method GET
|
|
||||||
Write-Host "[OK] Status Code: $($response.StatusCode)" -ForegroundColor Green
|
|
||||||
|
|
||||||
$data = $response.Content | ConvertFrom-Json
|
|
||||||
Write-Host "[OK] Attachments encontrados: $($data.Count)" -ForegroundColor Green
|
|
||||||
|
|
||||||
if ($data.Count -gt 0) {
|
|
||||||
$data | Format-Table id, original_filename, file_size
|
|
||||||
} else {
|
|
||||||
Write-Host " (No hay attachments para este ticket)" -ForegroundColor Gray
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
Write-Host "[ERROR] En request: $($_.Exception.Message)" -ForegroundColor Red
|
|
||||||
Write-Host "Status Code: $($_.Exception.Response.StatusCode.value__)" -ForegroundColor Red
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
Write-Host "[ERROR] En login: $($_.Exception.Message)" -ForegroundColor Red
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user