feat(elixir): category managing w/ filtering &CRUD

This commit is contained in:
Schuwi
2025-09-14 12:32:46 +02:00
parent 48c9103058
commit ece9850713
5 changed files with 483 additions and 7 deletions

View File

@@ -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 """