forked from shibao/cannery
remove unchangeable requirements
This commit is contained in:
parent
5fd46c326f
commit
67010640f0
@ -63,7 +63,7 @@ defmodule Cannery.Ammo.AmmoGroup do
|
|||||||
ammo_group
|
ammo_group
|
||||||
|> cast(attrs, [:count, :price_paid, :notes, :staged, :ammo_type_id, :container_id])
|
|> cast(attrs, [:count, :price_paid, :notes, :staged, :ammo_type_id, :container_id])
|
||||||
|> validate_number(:count, greater_than_or_equal_to: 0)
|
|> validate_number(:count, greater_than_or_equal_to: 0)
|
||||||
|> validate_required([:count, :staged, :ammo_type_id, :container_id, :user_id])
|
|> validate_required([:count, :staged, :ammo_type_id, :container_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@ -75,6 +75,6 @@ defmodule Cannery.Ammo.AmmoGroup do
|
|||||||
def range_changeset(ammo_group, attrs) do
|
def range_changeset(ammo_group, attrs) do
|
||||||
ammo_group
|
ammo_group
|
||||||
|> cast(attrs, [:count, :staged])
|
|> cast(attrs, [:count, :staged])
|
||||||
|> validate_required([:count, :staged, :ammo_type_id, :container_id, :user_id])
|
|> validate_required([:count, :staged])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -118,6 +118,6 @@ defmodule Cannery.Ammo.AmmoType do
|
|||||||
def update_changeset(ammo_type, attrs) do
|
def update_changeset(ammo_type, attrs) do
|
||||||
ammo_type
|
ammo_type
|
||||||
|> cast(attrs, changeset_fields())
|
|> cast(attrs, changeset_fields())
|
||||||
|> validate_required([:name, :user_id])
|
|> validate_required(:name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -55,6 +55,6 @@ defmodule Cannery.Containers.Container do
|
|||||||
def update_changeset(container, attrs) do
|
def update_changeset(container, attrs) do
|
||||||
container
|
container
|
||||||
|> cast(attrs, [:name, :desc, :type, :location])
|
|> cast(attrs, [:name, :desc, :type, :location])
|
||||||
|> validate_required([:name, :type, :user_id])
|
|> validate_required([:name, :type])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,7 @@ defmodule Cannery.Invites.Invite do
|
|||||||
def update_changeset(invite, attrs) do
|
def update_changeset(invite, attrs) do
|
||||||
invite
|
invite
|
||||||
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
||||||
|> validate_required([:name, :token, :user_id])
|
|> validate_required([:name])
|
||||||
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -47,6 +47,6 @@ defmodule Cannery.Tags.Tag do
|
|||||||
def update_changeset(tag, attrs) do
|
def update_changeset(tag, attrs) do
|
||||||
tag
|
tag
|
||||||
|> cast(attrs, [:name, :bg_color, :text_color])
|
|> cast(attrs, [:name, :bg_color, :text_color])
|
||||||
|> validate_required([:name, :bg_color, :text_color, :user_id])
|
|> validate_required([:name, :bg_color, :text_color])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user