feat: port contexts layer and MCP parity

This commit is contained in:
“BeeRad”
2026-04-10 19:41:26 +10:00
parent a8c5506fb7
commit 35f9ecf89c
62 changed files with 4206 additions and 1224 deletions
+26
View File
@@ -0,0 +1,26 @@
import { NextRequest, NextResponse } from 'next/server';
import { contextService } from '@/services/database';
export const runtime = 'nodejs';
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const { id } = await params;
const contextId = parseInt(id, 10);
if (Number.isNaN(contextId)) {
return NextResponse.json({ success: false, error: 'Invalid context ID' }, { status: 400 });
}
const context = await contextService.getContextById(contextId);
if (!context) {
return NextResponse.json({ success: false, error: 'Context not found' }, { status: 404 });
}
return NextResponse.json({ success: true, data: context });
} catch (error) {
return NextResponse.json({ success: false, error: error instanceof Error ? error.message : 'Failed to fetch context' }, { status: 500 });
}
}