add docs, delete unused functions

This commit is contained in:
2021-09-15 12:53:32 +02:00
parent 664913da7d
commit 68eb1c62ad
4 changed files with 12 additions and 14 deletions
+9
View File
@@ -21,6 +21,9 @@ defmodule PokemonCouture.Shops do
Repo.all(Clothes)
end
@doc """
Returns the list of clothes with owners preloaded.
"""
def list_clothes_with_owners do
Repo.all(from c in Clothes, preload: [:users])
end
@@ -105,6 +108,9 @@ defmodule PokemonCouture.Shops do
Clothes.changeset(clothes, attrs)
end
@doc """
Adds a new owner to a piece of clothing.
"""
def add_owner(clothes, user) do
clothes
|> Ecto.Changeset.change()
@@ -112,6 +118,9 @@ defmodule PokemonCouture.Shops do
|> Repo.update!()
end
@doc """
Removes an owner from a piece of clothing.
"""
def remove_owner(clothes, user) do
clothes
|> Ecto.Changeset.change()