candidate data

This commit is contained in:
Suvodip
2025-03-25 10:43:04 +05:30
commit f98b9f9036
83 changed files with 19007 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { NextRequest, NextResponse } from 'next/server';
import { connectToDatabase } from '@/lib/db';
import { Candidate } from '@/models/Candidate';
export async function GET(request: NextRequest) {
try {
await connectToDatabase();
const { searchParams } = new URL(request.url);
const reportType = searchParams.get('type') || 'interviews';
const limit = Number(searchParams.get('limit') || '50');
const page = Number(searchParams.get('page') || '1');
const skip = (page - 1) * limit;
// Simplified response for the demo version
// In a real application, we would implement the MongoDB aggregation pipeline
const results: any[] = [];
const total = 0;
return NextResponse.json({
results,
pagination: {
total,
page,
limit,
totalPages: Math.ceil(total / limit)
}
});
} catch (error) {
console.error('Error fetching reports:', error);
return NextResponse.json(
{ error: 'Failed to fetch reports' },
{ status: 500 }
);
}
}