View Source Claper.Posts (Claper v1.4.0)

The Posts context.

Link to this section Summary

Link to this section Functions

Link to this function

create_post(event, attrs)

View Source

Creates a post.

examples

Examples

iex> create_post(event, %{field: value})
{:ok, %Post{}}

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

Creates a reaction.

examples

Examples

iex> create_reaction(%{field: value})
{:ok, %Reaction{}}

iex> create_reaction(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Link to this function

delete_all_posts(atom, attendee_identifier, event)

View Source

Deletes a post.

examples

Examples

iex> delete_post(post)
{:ok, %Post{}}

iex> delete_post(post)
{:error, %Ecto.Changeset{}}

Deletes a reaction.

examples

Examples

iex> delete_reaction(reaction)
{:ok, %Reaction{}}

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

get_post!(id, preload \\ [])

View Source

Gets a single post.

Raises Ecto.NoResultsError if the Post does not exist.

examples

Examples

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

iex> get_post!("123e4567-e89b-12d3-a456-426614174123")
** (Ecto.NoResultsError)

Gets a single reaction.

Raises Ecto.NoResultsError if the Reaction does not exist.

examples

Examples

iex> get_reaction!(123)
%Reaction{}

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

list_posts(event_id, preload \\ [])

View Source

Get event posts

Link to this function

reacted_posts(event_id, user_id, icon)

View Source
Link to this function

update_post(post, attrs)

View Source

Updates a post.

examples

Examples

iex> update_post(post, %{field: new_value})
{:ok, %Post{}}

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