add models, context and liveviews
This commit is contained in:
assets/js
lib
cannery
cannery_web.excannery_web
channels
gettext.exlive
ammo_group_live
ammo_type_live
component
container_live
live_helpers.exmodal_component.expage_live.extag_live
templates
layout
priv/repo/migrations
20210903015442_create_tags.exs20210903015537_create_ammo_types.exs20210903015553_create_containers.exs20210903015611_create_ammo_groups.exs
test
23
lib/cannery/containers/container.ex
Normal file
23
lib/cannery/containers/container.ex
Normal 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
|
Reference in New Issue
Block a user