MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / matchExpectationToUser

Function matchExpectationToUser

server/src/db/certification-db.ts:951–966  ·  view source on GitHub ↗
(
  orgId: string,
  email: string,
  workosUserId: string
)

Source from the content-addressed store, hash-verified

949 * Match a newly-joined org member to a pending expectation by email.
950 */
951export async function matchExpectationToUser(
952 orgId: string,
953 email: string,
954 workosUserId: string
955): Promise<CertExpectation | null> {
956 const result = await query<CertExpectation>(
957 `UPDATE certification_expectations
958 SET workos_user_id = $3, status = 'joined', joined_at = NOW()
959 WHERE workos_organization_id = $1
960 AND LOWER(email) = LOWER($2)
961 AND status = 'invited'
962 RETURNING *`,
963 [orgId, email, workosUserId]
964 );
965 return result.rows[0] || null;
966}
967
968/**
969 * Get a user's expectation for an org (by workos_user_id).

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected