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

export const GET = async () => {
    const session = await getServerSession(authOptions);
    const { user: { email } }: any = session;
    const { savedSearches } = await getUserMetadata(email);

    return NextResponse.json(savedSearches);
};
