import { jsonResponse } from "../../common.js";

export async function onRequestGet(context: RequestContext) {
  return jsonResponse(
    JSON.stringify(
      await context.data.prisma.shortLink.findMany({
        select: {
          created_at: true,
          destination: true,
          path: true,
        },
        where: {
          user: context.data.current_user.id,
        },
      }),
    ),
  );
}
