Browse Source

Add followers field to actors

master
Shadowfacts 2 years ago
parent
commit
8dddb42fd8
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
2 changed files with 11 additions and 1 deletions
  1. +2
    -1
      lib/clacks/actor.ex
  2. +9
    -0
      priv/repo/migrations/20190930231654_actors_add_followers.exs

+ 2
- 1
lib/clacks/actor.ex View File

@ -14,6 +14,7 @@ defmodule Clacks.Actor do
field :nickname, :string
field :local, :boolean
field :data, :map
field :followers, {:array, :string}, default: []
belongs_to :user, Clacks.User
@ -22,7 +23,7 @@ defmodule Clacks.Actor do
def changeset(%__MODULE__{} = schema, attrs) do
schema
|> cast(attrs, [:ap_id, :nickname, :local, :data])
|> cast(attrs, [:ap_id, :nickname, :local, :data, :followers])
|> validate_required([:ap_id, :nickname, :local, :data])
end


+ 9
- 0
priv/repo/migrations/20190930231654_actors_add_followers.exs View File

@ -0,0 +1,9 @@
defmodule Clacks.Repo.Migrations.ActorsAddFollowers do
use Ecto.Migration
def change do
alter table(:actors) do
add :followers, {:array, :string}, default: []
end
end
end

Loading…
Cancel
Save