mobilizon/lib/eventos/groups/member.ex

23 lines
428 B
Elixir
Raw Normal View History

defmodule Eventos.Groups.Member do
use Ecto.Schema
import Ecto.Changeset
alias Eventos.Groups.{Member, Group}
alias Eventos.Accounts.Account
schema "members" do
field :role, :integer
belongs_to :group, Group
belongs_to :account, Account
timestamps()
end
@doc false
def changeset(%Member{} = member, attrs) do
member
|> cast(attrs, [:role])
|> validate_required([:role])
end
end