debianize-mobilizon/lib/mobilizon/media/file.ex
Thomas Citharel 87bc5f8352
Add filesize to file entity, expose it to GraphQL API
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-06-03 17:13:47 +02:00

24 lines
451 B
Elixir

defmodule Mobilizon.Media.File do
@moduledoc """
Represents a file entity
"""
use Ecto.Schema
import Ecto.Changeset
embedded_schema do
field(:name, :string)
field(:url, :string)
field(:content_type, :string)
field(:size, :integer)
timestamps()
end
@doc false
def changeset(picture, attrs) do
picture
|> cast(attrs, [:name, :url, :content_type, :size])
|> validate_required([:name, :url])
end
end