index.community/backend/lib/backend/crawl.ex

27 lines
628 B
Elixir
Raw Normal View History

2019-07-14 11:47:06 +00:00
defmodule Backend.Crawl do
2019-08-21 12:30:47 +00:00
@moduledoc """
Stores aggregate data about a single crawl (i.e. not individual statuses, but the number of statuses seen etc.)
"""
2019-07-14 11:47:06 +00:00
use Ecto.Schema
import Ecto.Changeset
schema "crawls" do
belongs_to :instance, Backend.Instance,
references: :domain,
type: :string,
foreign_key: :instance_domain
field :interactions_seen, :integer
field :statuses_seen, :integer
timestamps()
end
@doc false
def changeset(crawl, attrs) do
crawl
2019-08-07 19:41:19 +00:00
|> cast(attrs, [:instance, :statuses_seen, :interactions_seen])
2019-07-14 11:47:06 +00:00
|> validate_required([:instance])
end
end