Validate request
- Validate request using JSON schema
- In case validation fails - generate 422 error
- Validate request using JSON schema
Search user using requested email
Search user record in authdb.users using requested { $.email }
- lower ( authdb.users.email ) == lower { $.email }
If record found - return USER_EXISTS error (including authdb.users.id)
Search active invite
Search pending invite in authdb.invites using requested {$.email}
- lower ( authdb.invites.email ) == lower { $.email }
- authdb.invites.expires_at > now ()
If invite found - return authdb.invites.id
Create invite
Using configuration parameter INVITE_EXPIRATION_PERIOD determine expires_at value
- authdb.invites.expires_at = now () + INVITE_EXPIRATION_PERIOD (seconds)
Add invite record into authdb.invites and return generated authdb.invites.id