defmodule Outlook.Articles.Article do use Ecto.Schema import Ecto.Changeset alias Outlook.Authors.Author schema "articles" do field :content, :string field :date, :utc_datetime field :language, :string field :title, :string field :url, :string belongs_to :author, Author timestamps() end @doc false def changeset(article, attrs) do article |> cast(attrs, [:title, :content, :url, :language, :date]) |> validate_required([:title, :content, :url, :language, :date]) end end