2018-01-13 23:33:03 +01:00
|
|
|
defmodule Eventos.Groups.Request do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
Represents a group request, when an user wants to be member of a group
|
|
|
|
"""
|
2017-12-08 09:58:14 +01:00
|
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
2018-01-13 23:33:03 +01:00
|
|
|
alias Eventos.Groups.Request
|
|
|
|
|
2017-12-08 09:58:14 +01:00
|
|
|
|
|
|
|
schema "group_requests" do
|
|
|
|
field :state, :integer
|
|
|
|
field :group_id, :integer
|
|
|
|
field :account_id, :integer
|
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
@doc false
|
2018-01-13 23:33:03 +01:00
|
|
|
def changeset(%Request{} = request, attrs) do
|
|
|
|
request
|
2017-12-08 09:58:14 +01:00
|
|
|
|> cast(attrs, [:state])
|
|
|
|
|> validate_required([:state])
|
|
|
|
end
|
|
|
|
end
|