View Source Claper.Posts (Claper v1.4.0)
The Posts context.
Link to this section Summary
Functions
Creates a post.
Creates a reaction.
Deletes a post.
Deletes a reaction.
Gets a single post.
Gets a single reaction.
Get event posts
Updates a post.
Link to this section Functions
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{}}
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{}}
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)
Get event posts
Updates a post.
examples
Examples
iex> update_post(post, %{field: new_value})
{:ok, %Post{}}
iex> update_post(post, %{field: bad_value})
{:error, %Ecto.Changeset{}}