acceptInvitation
@nmi-agro/fdm-source / fdm-core/src / acceptInvitation
Function: acceptInvitation()
acceptInvitation(
fdm,invitation_id,user_id):Promise<void>
Defined in: fdm-core/src/invitation.ts:251
Accepts a pending invitation on behalf of the acting user.
Uses an atomic conditional UPDATE to prevent TOCTOU races. For user-targeted invitations: verifies email is verified and matches the invitation target. For organization-targeted invitations: verifies the acting user is an admin or owner.
Parameters
fdm
any
The FDM instance providing the connection to the database.
invitation_id
string
The unique identifier of the invitation to accept.
user_id
string
The ID of the user accepting the invitation.
Returns
Promise<void>
Throws
If the invitation is not found, already processed, expired, or the user is not authorized.