Added missing bird

This commit is contained in:
Corey Blais
2026-04-17 17:11:11 -04:00
parent 328a9a704d
commit e06dae91a3
6 changed files with 366 additions and 4 deletions
@@ -250,6 +250,27 @@ export const listWorkspaceMembers = async (workspaceId: number) => {
return result.rows;
};
export const listWorkspaceNotificationEmails = async (workspaceId: number) => {
const result = await db.query<{ email: string }>(
`SELECT DISTINCT LOWER(TRIM(email)) AS email
FROM (
SELECT COALESCE(invite_email, email) AS email
FROM workspace_members
WHERE workspace_id = $1
UNION
SELECT billing_email AS email
FROM workspaces
WHERE id = $1
) contact_emails
WHERE email IS NOT NULL
AND TRIM(email) <> ''
ORDER BY email ASC`,
[workspaceId],
);
return result.rows.map((row) => row.email);
};
export const findAlternateWorkspaceForUser = async (userId: string, excludeWorkspaceId: number) => {
const result = await db.query<{ workspace_id: number }>(
`SELECT workspace_id