MCPcopy Index your code
hub / github.com/simstudioai/sim / findPendingInvitationByOrgEmail

Function findPendingInvitationByOrgEmail

apps/sim/lib/invitations/send.ts:104–137  ·  view source on GitHub ↗
(params: {
  organizationId: string | null
  email: string
})

Source from the content-addressed store, hash-verified

102}
103
104async function findPendingInvitationByOrgEmail(params: {
105 organizationId: string | null
106 email: string
107}) {
108 const normalized = normalizeEmail(params.email)
109
110 if (params.organizationId) {
111 const [row] = await db
112 .select()
113 .from(invitation)
114 .where(
115 and(
116 eq(invitation.organizationId, params.organizationId),
117 eq(invitation.email, normalized),
118 eq(invitation.status, 'pending')
119 )
120 )
121 .limit(1)
122 return row ?? null
123 }
124
125 const [row] = await db
126 .select()
127 .from(invitation)
128 .where(
129 and(
130 sql`${invitation.organizationId} IS NULL`,
131 eq(invitation.email, normalized),
132 eq(invitation.status, 'pending')
133 )
134 )
135 .limit(1)
136 return row ?? null
137}
138
139export async function findPendingGrantForWorkspaceEmail(params: {
140 workspaceId: string

Callers

nothing calls this directly

Calls 2

normalizeEmailFunction · 0.90
eqFunction · 0.50

Tested by

no test coverage detected