mirror of
https://github.com/safishamsi/graphify.git
synced 2026-07-13 10:57:13 +00:00
f2ea6a6087
`alias Foo.{Bar, Baz}` (and the same import/require/use brace form) emitted
NO imports edges. tree-sitter-elixir represents it as a `dot` node holding the
base alias plus a trailing `tuple` of member aliases, but the import handler
only matched a bare `alias` child, so every multi-alias import was silently
dropped.
Add `_get_alias_modules`, which expands the brace form to `Foo.Bar`,
`Foo.Baz`, … while leaving the single form (`alias Foo.Bar`) unchanged. Adds a
fixture line + regression test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
499 B
Elixir
30 lines
499 B
Elixir
defmodule MyApp.Accounts.User do
|
|
@moduledoc """
|
|
Handles user accounts and authentication.
|
|
"""
|
|
|
|
alias MyApp.Repo
|
|
alias MyApp.Schemas.{Account, Token}
|
|
import Ecto.Query
|
|
|
|
defstruct [:id, :name, :email]
|
|
|
|
def create(attrs) do
|
|
%__MODULE__{}
|
|
|> validate(attrs)
|
|
|> Repo.insert()
|
|
end
|
|
|
|
def find(id) do
|
|
Repo.get(__MODULE__, id)
|
|
end
|
|
|
|
defp validate(user, attrs) do
|
|
if Map.has_key?(attrs, :email) do
|
|
user
|
|
else
|
|
{:error, :missing_email}
|
|
end
|
|
end
|
|
end
|