2018-05-30 14:27:21 +02:00
|
|
|
defmodule Eventos.Actors.Bot do
|
|
|
|
@moduledoc """
|
|
|
|
Represents a local bot
|
|
|
|
"""
|
|
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
|
|
|
alias Eventos.Actors.{Actor, User, Bot}
|
|
|
|
|
|
|
|
schema "bots" do
|
2018-07-27 10:45:35 +02:00
|
|
|
field(:source, :string)
|
|
|
|
field(:type, :string, default: :ics)
|
|
|
|
belongs_to(:actor, Actor)
|
|
|
|
belongs_to(:user, User)
|
2018-05-30 14:27:21 +02:00
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
@doc false
|
|
|
|
def changeset(bot, attrs) do
|
|
|
|
bot
|
|
|
|
|> cast(attrs, [:source, :type, :actor_id, :user_id])
|
|
|
|
|> validate_required([:source])
|
|
|
|
end
|
|
|
|
end
|