Spaces:
Runtime error
Runtime error
File size: 630 Bytes
4782147 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import { getSession } from "auth/server";
import { chatExportRepository } from "lib/db/repository";
import { NextResponse } from "next/server";
export async function GET() {
try {
const session = await getSession();
if (!session?.user?.id) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
const exports = await chatExportRepository.selectSummaryByExporterId(
session.user.id,
);
return NextResponse.json(exports);
} catch (error: any) {
return NextResponse.json(
{ error: error.message || "Failed to get exports" },
{ status: 500 },
);
}
}
|