2018-10-11 17:37:39 +02:00
|
|
|
defmodule Mobilizon.Actors.Bot do
|
2018-05-30 14:27:21 +02:00
|
|
|
@moduledoc """
|
|
|
|
Represents a local bot
|
|
|
|
"""
|
|
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
2018-11-12 23:30:47 +01:00
|
|
|
alias Mobilizon.Actors.{Actor, User}
|
2018-05-30 14:27:21 +02:00
|
|
|
|
|
|
|
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
|