First pass at uniformed types, specs and docs

- spec public functions (skipping controllers, views, live views and
components)
- use types instead of explanations in docs
- remove redundant docs
- fix typos
This commit is contained in:
Claudio Ortolina
2026-03-06 08:33:11 +00:00
parent 99e30d5fdf
commit 7cf9b4e7f8
81 changed files with 652 additions and 300 deletions
+11
View File
@@ -1,6 +1,14 @@
defmodule MusicLibrary.BarcodeScan.Result do
defstruct [:status, :number, :record_id, :release]
@type t :: %__MODULE__{
status: :new | :wishlisted | :collected | :not_found,
number: String.t(),
record_id: String.t() | nil,
release: map() | nil
}
@spec new(String.t(), map()) :: t()
def new(number, release) do
%__MODULE__{
number: number,
@@ -9,6 +17,7 @@ defmodule MusicLibrary.BarcodeScan.Result do
}
end
@spec wishlisted(String.t(), String.t(), map()) :: t()
def wishlisted(number, record_id, release) do
%__MODULE__{
number: number,
@@ -18,6 +27,7 @@ defmodule MusicLibrary.BarcodeScan.Result do
}
end
@spec collected(String.t(), String.t(), map()) :: t()
def collected(number, record_id, release) do
%__MODULE__{
number: number,
@@ -27,6 +37,7 @@ defmodule MusicLibrary.BarcodeScan.Result do
}
end
@spec not_found(String.t()) :: t()
def not_found(number) do
%__MODULE__{
number: number,