defmodule CMS.Posts.Post do @moduledoc false use Ecto.Schema import Ecto.Changeset, warn: false @primary_key {:id, :binary_id, autogenerate: true} schema "posts" do field :title, :string field :body, :string timestamps() end def changeset(%__MODULE__{} = post, attrs \\ %{}) do post |> cast(attrs, [:title, :body]) |> validate_required([:body]) end end