2OCT3CR67KUGOPZ4ERIA22JSAV2PCT673W5QOMBGVESGGH7RAH4QC
defmodule Cake.Layers.Template do
use Ecto.Schema
import Ecto.Changeset
schema "layer_templates" do
field :definition, :map
field :id, Ecto.UUID
field :name, :string
field :version, :integer
field :role, :id
timestamps()
end
@doc false
def changeset(template, attrs) do
template
|> cast(attrs, [:id, :name, :version, :definition])
|> validate_required([:id, :name, :version, :definition])
end
end
defmodule Cake.Layers.Record do
use Ecto.Schema
import Ecto.Changeset
schema "layer_records" do
field :id, Ecto.UUID
field :status, :string
field :story, Ecto.UUID
field :values, :map
field :template, :id
field :owner, :id
timestamps()
end
@doc false
def changeset(record, attrs) do
record
|> cast(attrs, [:id, :story, :values, :status])
|> validate_required([:id, :story, :values, :status])
end
end