feat(elixir): complete storage location integration
This commit is contained in:
@@ -170,6 +170,14 @@ defmodule ComponentsElixir.Inventory do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Computes the path for a storage location (for display purposes).
|
||||
"""
|
||||
def compute_storage_location_path(nil), do: nil
|
||||
def compute_storage_location_path(%StorageLocation{} = location) do
|
||||
compute_path_for_single(location)
|
||||
end
|
||||
|
||||
# Convert string keys to atoms for consistency
|
||||
defp normalize_string_keys(attrs) when is_map(attrs) do
|
||||
Enum.reduce(attrs, %{}, fn
|
||||
|
||||
@@ -38,6 +38,7 @@ defmodule ComponentsElixir.Inventory.Component do
|
||||
|> validate_number(:count, greater_than_or_equal_to: 0)
|
||||
|> validate_url(:datasheet_url)
|
||||
|> foreign_key_constraint(:category_id)
|
||||
|> foreign_key_constraint(:storage_location_id)
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
Reference in New Issue
Block a user