wulf-pulse/app/api/companies/route.ts
Lorentz Hinrichsen 3c3124d8c9 Restructure: rename to Pulse and move app to root
- Renamed project from PSA-Utils to Pulse
- Moved all app files from autotask-app/ to root
- Updated package.json name to 'pulse'
- Updated Docker container names to pulse-app and pulse-redis
- Updated Docker network name to pulse-network
2025-10-28 23:08:54 -04:00

21 lines
808 B
TypeScript

import { NextRequest, NextResponse } from 'next/server';
import { getAutotaskClient } from '@/lib/services/autotask-factory';
export async function GET(request: NextRequest) {
try {
const client = getAutotaskClient();
const allCompanies = await client.getAllCompanies();
// Filter to only show customers (companyType = 1)
// companyType 1 = Customer, 2 = Lead, 3 = Prospect, 4 = Dead, 5 = Cancelation, 6 = Vendor, 7 = Partner
const companies = allCompanies.filter(company => company.companyType === 1);
return NextResponse.json({ companies });
} catch (error) {
console.error('Error fetching companies:', error);
return NextResponse.json(
{ error: error instanceof Error ? error.message : 'Failed to fetch companies' },
{ status: 500 }
);
}
}