Retrieves a unique list of email addresses for project owners and administrators, falling back to organizational admins if necessary.
// Source: https://github.com/langfuse/langfuse | License: MIT | Copyright 2023-2026 ClickHouse, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { Role } from "@prisma/client";
import { prisma } from "../../db";
export async function getProjectAdminEmails(
projectId: string,
): Promise<string[]> {
const projectAdmins = await prisma.projectMembership.findMany({
where: {
projectId,
role: {
in: [Role.OWNER, Role.ADMIN],
},
},
include: {
user: {
select: {
email: true,
},
},
},
});
const projectAdminEmails = Array.from(
new Set(
projectAdmins
.map((membership) => membership.user.email)
.filter((email): email is string => Boolean(email)),
),
);
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key