Files
phoenix-ausblick/lib/outlook/articles/article.ex
Thelonius Kort f66521dba8 Add Translations
mix phx.gen.live Translations Translation translations \
  lang:string title:string teaser:text content:map \
  date:utc_datetime user_id:references:users \
  public:boolean unauthorized:boolean article_id:references:articles
2022-12-26 18:45:40 +01:00

26 lines
572 B
Elixir

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
has_many :translations, Translation
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