trim whitespace (#55)

This commit is contained in:
Matthew Ryan Dillon 2020-11-21 18:08:29 -07:00 committed by GitHub
parent 5be55c7387
commit b2a0d688bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -18,6 +18,7 @@ defmodule Planner.Tasks.Plan do
plan plan
|> cast(attrs, [:description, :finished_at, :start, :end, :name]) |> cast(attrs, [:description, :finished_at, :start, :end, :name])
|> validate_required([:name]) |> validate_required([:name])
|> update_change(:name, &String.trim/1)
end end
def finish_plan(plan) do def finish_plan(plan) do

View file

@ -18,7 +18,7 @@ defmodule Planner.Tasks.Task do
task task
|> cast(attrs, [:value, :finished_at, :due_at]) |> cast(attrs, [:value, :finished_at, :due_at])
|> validate_required([:value]) |> validate_required([:value])
|> validate_length(:value, min: 3) |> update_change(:value, &String.trim/1)
end end
def finish_task(task) do def finish_task(task) do