import { NextRequest, NextResponse } from "next/server";
import { getServerSession } from "next-auth";
import { authOptions } from "app/_lib/auth";
import { getUserVisualizations } from "app/_lib/opensearch";

export const GET = async () => {
  const session = await getServerSession(authOptions);
  const { user: { email } }: any = session;
  const visualizations = await getUserVisualizations(email, 20);

  return NextResponse.json(visualizations);
};

