feat(elixir): category managing w/ filtering &CRUD
This commit is contained in:
@@ -81,6 +81,15 @@ defmodule ComponentsElixir.Inventory do
|
||||
Category.changeset(category, attrs)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the count of components in a specific category.
|
||||
"""
|
||||
def count_components_in_category(category_id) do
|
||||
Component
|
||||
|> where([c], c.category_id == ^category_id)
|
||||
|> Repo.aggregate(:count, :id)
|
||||
end
|
||||
|
||||
## Components
|
||||
|
||||
@doc """
|
||||
|
||||
Reference in New Issue
Block a user