add models, context and liveviews

This commit is contained in:
2021-09-02 23:31:14 -04:00
committed by oliviasculley
parent feba4e1d14
commit d6ddf2a9bb
52 changed files with 2325 additions and 13 deletions

View File

@ -0,0 +1,23 @@
defmodule Cannery.Containers.Container do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "containers" do
field :desc, :string
field :location, :string
field :name, :string
field :type, :string
field :user_id, :binary_id
timestamps()
end
@doc false
def changeset(container, attrs) do
container
|> cast(attrs, [:name, :desc, :type, :location])
|> validate_required([:name, :desc, :type, :location])
end
end