mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-23 00:14:48 +00:00
1217361b6c
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
25 lines
504 B
Elixir
25 lines
504 B
Elixir
defmodule Eventos.Groups.Member do
|
|
@moduledoc """
|
|
Represents the membership of an account to a group
|
|
"""
|
|
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
|