- 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
24 lines
785 B
TypeScript
24 lines
785 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 searchParams = request.nextUrl.searchParams;
|
|
const email = searchParams.get('email');
|
|
|
|
if (email) {
|
|
const resource = await client.getResourceByEmail(email);
|
|
return NextResponse.json({ resource });
|
|
}
|
|
|
|
const resources = await client.getAllResources();
|
|
return NextResponse.json({ resources });
|
|
} catch (error) {
|
|
console.error('Error fetching resources:', error);
|
|
return NextResponse.json(
|
|
{ error: error instanceof Error ? error.message : 'Failed to fetch resources' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|