prompt to create first ammo type before trying to create first ammo
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-07-04 21:41:07 -04:00
parent 5836a82ff7
commit f246b9db93
26 changed files with 233 additions and 146 deletions

View File

@@ -30,6 +30,25 @@ defmodule Cannery.Containers do
)
end
@doc """
Returns a count of containers.
## Examples
iex> get_containers_count!(%User{id: 123})
3
"""
@spec get_containers_count!(User.t()) :: integer()
def get_containers_count!(%User{id: user_id}) do
Repo.one(
from c in Container,
where: c.user_id == ^user_id,
select: count(c.id),
distinct: true
)
end
@doc """
Gets a single container.