debianize-mobilizon/lib/mobilizon/actors/bot.ex
Thomas Citharel c689406114
Extract User from Actors context
Mobilizon.Actors.User -> Mobilizon.Users.User
Also Mobilizon.Actors.Service now become Mobilizon.User.Service
And Mobilizon.Users and Mobilizon.UsersTest is introduced.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-03-05 17:23:05 +01:00

26 lines
512 B
Elixir

defmodule Mobilizon.Actors.Bot do
@moduledoc """
Represents a local bot
"""
use Ecto.Schema
import Ecto.Changeset
alias Mobilizon.Actors.Actor
alias Mobilizon.Users.User
schema "bots" do
field(:source, :string)
field(:type, :string, default: :ics)
belongs_to(:actor, Actor)
belongs_to(:user, User)
timestamps()
end
@doc false
def changeset(bot, attrs) do
bot
|> cast(attrs, [:source, :type, :actor_id, :user_id])
|> validate_required([:source])
end
end