Haytni.InvitablePlugin.QueryHelpers (Haytni v0.7.0) View Source

This module provides some basic helpers to query invitations to be independant and not have to know the internals of the Invitable plugin.

Link to this section Summary

Functions

Composes query to filter on accepted invitations

Composes query for token invitation to match code

Composes query for email to match the address it was sent to only if email_matching_invitation is true (else returns the query as it was)

Composes query for invitation id (primary key) to worth id

Composes query to filter on non-accepted invitations

Composes query to filter on non-expired invitations

Returns a queryable for all invitations

Returns a queryable for all invitations sent by user

Link to this section Functions

Link to this function

and_where_accepted(query)

View Source

Specs

and_where_accepted(query :: Ecto.Queryable.t()) :: Ecto.Query.t()

Composes query to filter on accepted invitations

Link to this function

and_where_code_equals(query, code)

View Source

Specs

and_where_code_equals(query :: Ecto.Queryable.t(), code :: String.t()) ::
  Ecto.Query.t()

Composes query for token invitation to match code

Link to this function

and_where_email_equals(query, email, config)

View Source

Specs

and_where_email_equals(
  query :: Ecto.Queryable.t(),
  email :: String.t(),
  config :: Haytni.InvitablePlugin.Config.t()
) :: Ecto.Queryable.t()

Composes query for email to match the address it was sent to only if email_matching_invitation is true (else returns the query as it was)

Link to this function

and_where_id_equals(query, id)

View Source

Specs

and_where_id_equals(
  query :: Ecto.Queryable.t(),
  id :: pos_integer() | String.t()
) :: Ecto.Query.t()

Composes query for invitation id (primary key) to worth id

Link to this function

and_where_not_accepted(query)

View Source

Specs

and_where_not_accepted(query :: Ecto.Queryable.t()) :: Ecto.Query.t()

Composes query to filter on non-accepted invitations

Link to this function

and_where_not_expired(query, config)

View Source

Specs

and_where_not_expired(
  query :: Ecto.Queryable.t(),
  config :: Haytni.InvitablePlugin.Config.t()
) :: Ecto.Query.t()

Composes query to filter on non-expired invitations

Link to this function

invitations_from_all(user)

View Source

Specs

invitations_from_all(user :: Haytni.user()) :: Ecto.Query.t()

Returns a queryable for all invitations

Note: user is not used for the query, just to find the scope/table/association

Link to this function

invitations_from_user(user)

View Source

Specs

invitations_from_user(user :: Haytni.user()) :: Ecto.Query.t()

Returns a queryable for all invitations sent by user