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
|
2019-03-05 17:23:05 +01:00
|
|
|
alias Mobilizon.Actors.Actor
|
|
|
|
alias Mobilizon.Users.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
|