export async function getAllProfileScans()

in src/app/(proper_react)/(redesign)/(authenticated)/admin/prod/actions.tsx [39:60]


export async function getAllProfileScans(onerepProfileId: number) {
  const session = await getServerSession();
  if (!session?.user?.email || !isAdmin(session.user.email)) {
    return notFound();
  }

  try {
    const subscriber = await getSubscriberByOnerepProfileId(onerepProfileId);
    if (
      // On production, only allow looking up Mozilla email addresses
      process.env.APP_ENV !== "stage" &&
      process.env.APP_ENV !== "local" &&
      !isMozMail(subscriber?.primary_email ?? "")
    ) {
      return notFound();
    }

    return await getAllScansForProfile(onerepProfileId);
  } catch (error) {
    console.error("Getting all profile scans failed:", error);
  }
}