forked from shibao/cannery
don't allow reassigning token
This commit is contained in:
parent
eb6bab0fd9
commit
bd964105b4
@ -50,7 +50,7 @@ defmodule Cannery.Invites.Invite do
|
|||||||
@spec update_changeset(t() | new_invite(), attrs :: map()) :: Changeset.t(t() | new_invite())
|
@spec update_changeset(t() | new_invite(), attrs :: map()) :: Changeset.t(t() | new_invite())
|
||||||
def update_changeset(invite, attrs) do
|
def update_changeset(invite, attrs) do
|
||||||
invite
|
invite
|
||||||
|> cast(attrs, [:name, :token, :uses_left, :disabled_at])
|
|> cast(attrs, [:name, :uses_left, :disabled_at])
|
||||||
|> validate_required([:name, :token, :user_id])
|
|> validate_required([:name, :token, :user_id])
|
||||||
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user