VIBN Frontend for Coolify deployment
This commit is contained in:
41
app/api/debug/cursor-sample-dates/route.ts
Normal file
41
app/api/debug/cursor-sample-dates/route.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { adminDb } from '@/lib/firebase/admin';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const projectId = request.nextUrl.searchParams.get('projectId');
|
||||
|
||||
if (!projectId) {
|
||||
return NextResponse.json({ error: 'Missing projectId' }, { status: 400 });
|
||||
}
|
||||
|
||||
// Get 10 conversations with their dates
|
||||
const conversationsSnapshot = await adminDb
|
||||
.collection('projects')
|
||||
.doc(projectId)
|
||||
.collection('cursorConversations')
|
||||
.orderBy('createdAt', 'desc')
|
||||
.limit(10)
|
||||
.get();
|
||||
|
||||
const samples = conversationsSnapshot.docs.map(doc => {
|
||||
const data = doc.data();
|
||||
return {
|
||||
name: data.name,
|
||||
createdAt: data.createdAt,
|
||||
workspacePath: data.workspacePath
|
||||
};
|
||||
});
|
||||
|
||||
return NextResponse.json({ samples });
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error fetching samples:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to fetch samples', details: error instanceof Error ? error.message : String(error) },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user