View Source Claper.Events (Claper v1.7.0)

The Events context.

An activity leader is a facilitator, a user invited to manage an event.

Link to this section Summary

Functions

Returns an %Ecto.Changeset{} for tracking facilitator changes.

Returns an %Ecto.Changeset{} for tracking event changes.

Creates a event.

Deletes a event.

Gets a single facilitator.

Gets all facilitators for a given event.

Get a single event with the same code excluding a specific event.

Gets a single event.

Gets a single event by code.

Gets a single user's event.

Import interactions from another event

Check if a user is a facilitator of a specific event.

Returns the list of events of a given user.

Returns the list of events managed by a given user email.

Updates a event.

Link to this section Functions

Link to this function

change_activity_leader(activity_leader, attrs \\ %{})

View Source

Returns an %Ecto.Changeset{} for tracking facilitator changes.

examples

Examples

iex> change_activity_leader(activity_leader)
%Ecto.Changeset{data: %ActivityLeader{}}
Link to this function

change_event(event, attrs \\ %{})

View Source

Returns an %Ecto.Changeset{} for tracking event changes.

examples

Examples

iex> change_event(event)
%Ecto.Changeset{data: %Event{}}
Link to this function

count_events_month(user_id)

View Source

Creates a event.

examples

Examples

iex> create_event(%{field: value})
{:ok, %Event{}}

iex> create_event(%{field: bad_value})
{:error, %Ecto.Changeset{}}

Deletes a event.

examples

Examples

iex> delete_event(event)
{:ok, %Event{}}

iex> delete_event(event)
{:error, %Ecto.Changeset{}}
Link to this function

get_activity_leader!(id)

View Source

Gets a single facilitator.

Raises Ecto.NoResultsError if the Activity leader does not exist.

examples

Examples

iex> get_activity_leader!(123)
%ActivityLeader{}

iex> get_activity_leader!(456)
** (Ecto.NoResultsError)
Link to this function

get_activity_leaders_for_event(event_id)

View Source

Gets all facilitators for a given event.

examples

Examples

iex> get_activity_leaders_for_event!(event)
[%ActivityLeader{}, ...]
Link to this function

get_different_event_with_code(code, event_id)

View Source

Get a single event with the same code excluding a specific event.

examples

Examples

iex> get_different_event_with_code("Hello", 123)
%Event{}
Link to this function

get_event!(id, preload \\ [])

View Source

Gets a single event.

Raises Ecto.NoResultsError if the Event does not exist.

examples

Examples

iex> get_event!("123e4567-e89b-12d3-a456-426614174000")
%Event{}

iex> get_event!("123e4567-e89b-12d3-a456-4266141740111")
** (Ecto.NoResultsError)
Link to this function

get_event_with_code(code, preload \\ [])

View Source
Link to this function

get_event_with_code!(code, preload \\ [])

View Source

Gets a single event by code.

Raises Ecto.NoResultsError if the Event does not exist.

examples

Examples

iex> get_event_with_code!("Hello")
%Event{}

iex> get_event_with_code!("Old event")
** (Ecto.NoResultsError)
Link to this function

get_managed_event!(current_user, id, preload \\ [])

View Source

Gets a single managed event.

Raises Ecto.NoResultsError if the Event does not exist.

examples

Examples

iex> get_managed_event!(user, "123e4567-e89b-12d3-a456-426614174000")
%Event{}

iex> get_managed_event!(another_user, "123e4567-e89b-12d3-a456-426614174000")
** (Ecto.NoResultsError)
Link to this function

get_user_event!(user_id, id, preload \\ [])

View Source

Gets a single user's event.

Raises Ecto.NoResultsError if the Event does not exist.

examples

Examples

iex> get_user_event!(user, "123e4567-e89b-12d3-a456-426614174000")
%Event{}

iex> get_user_event!(another_user, "123e4567-e89b-12d3-a456-426614174000")
** (Ecto.NoResultsError)
Link to this function

import(user_id, from_event_uuid, to_event_uuid)

View Source

Import interactions from another event

examples

Examples

iex> import(user_id, from_event_uuid, to_event_uuid)
{:ok, %Event{}}

iex> import(user_id, from_event_uuid, to_event_uuid)
{:error, %Ecto.Changeset{}}
Link to this function

is_leaded_by(email, event)

View Source

Check if a user is a facilitator of a specific event.

examples

Examples

iex> is_leaded_by("email@example.com", 123)
true
Link to this function

list_events(user_id, preload \\ [])

View Source

Returns the list of events of a given user.

examples

Examples

iex> list_events(123)
[%Event{}, ...]
Link to this function

list_managed_events_by(email, preload \\ [])

View Source

Returns the list of events managed by a given user email.

examples

Examples

iex> list_managed_events_by("email@example.com")
[%Event{}, ...]
Link to this function

update_event(event, attrs)

View Source

Updates a event.

examples

Examples

iex> update_event(event, %{field: new_value})
{:ok, %Event{}}

iex> update_event(event, %{field: bad_value})
{:error, %Ecto.Changeset{}}