- Database: 7 Veeam tables + backup_type_udf column on configuration_items - API Client: VSPC REST API v3 client with pagination, rate limiting, Bearer auth - Sync Service: full/incremental sync for orgs, servers, repos, jobs, agent jobs, workloads - Scheduler: veeam-incremental (30min) and veeam-full (daily 2AM) schedules - Compliance Engine: cross-references Autotask config items vs Veeam workloads - API Endpoints: backup-status, companies, workloads, jobs, repos, compliance, sync - UI: Backup Status page with Overview + Contract Compliance tabs - Navigation: added Backup Status link with HardDrive icon - Docker: added VEEAM_VSPC_URL and VEEAM_VSPC_API_KEY env vars to compose
27 lines
789 B
TypeScript
27 lines
789 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import postgresClient from '@/lib/services/postgres-client';
|
|
|
|
export async function GET(
|
|
request: NextRequest,
|
|
{ params }: { params: Promise<{ companyId: string }> }
|
|
) {
|
|
try {
|
|
const { companyId } = await params;
|
|
const companyIdInt = parseInt(companyId);
|
|
|
|
const result = await postgresClient.query(`
|
|
SELECT
|
|
cr.*,
|
|
c.company_name
|
|
FROM veeam_compliance_results cr
|
|
LEFT JOIN companies c ON c.id = cr.company_id
|
|
WHERE cr.company_id = $1
|
|
ORDER BY cr.mismatch_type, cr.device_name
|
|
`, [companyIdInt]);
|
|
|
|
return NextResponse.json(result.rows);
|
|
} catch (error) {
|
|
console.error('[VEEAM-API] company compliance error:', error);
|
|
return NextResponse.json([]);
|
|
}
|
|
}
|