Nitpick: build
here is not building the type that you’ve declared for presences
- it produces a map with atom keys, but the type specifies Ecto.Uuid.t()
keys.
You’d write it as (not tested, apologies if it’s wrong):
def build() do
%__MODULE__{
id: Ecto.UUID.generate(),
name: "Some Guest",
presences: %{
Ecto.UUID.generate() => %Presence{