- Added password management utilities for user administration - Added PowerShell scripts for testing attachment endpoints - Enhanced development and testing workflow capabilities - Completed v1.4.0 with all maintenance tools included"
35 lines
1.1 KiB
PowerShell
35 lines
1.1 KiB
PowerShell
# 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
|