diff --git a/config/config.exs b/config/config.exs index 9d8f05c2..298af5a7 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,11 +1,11 @@ # This file is responsible for configuring your application -# and its dependencies with the aid of the Mix.Config module. +# and its dependencies with the aid of the Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. # General application configuration -use Mix.Config +import Config config :philomena, ecto_repos: [Philomena.Repo], diff --git a/config/dev.exs b/config/dev.exs index a789e097..277afa4e 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1,4 +1,4 @@ -use Mix.Config +import Config # Configure your database config :philomena, Philomena.Repo, diff --git a/config/prod.exs b/config/prod.exs index db769e5c..2d537e10 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,4 +1,4 @@ -use Mix.Config +import Config # For production, don't forget to configure the url host # to something meaningful, Phoenix uses this information diff --git a/config/prod.secret.exs b/config/prod.secret.exs index 704848b0..4ff5a41a 100644 --- a/config/prod.secret.exs +++ b/config/prod.secret.exs @@ -2,7 +2,7 @@ # from environment variables. You can also hardcode secrets, # although such is generally not recommended and you have to # remember to add this file to your .gitignore. -use Mix.Config +import Config database_url = System.get_env("DATABASE_URL") || diff --git a/config/test.exs b/config/test.exs index a5dcea01..2ebfcb31 100644 --- a/config/test.exs +++ b/config/test.exs @@ -1,4 +1,4 @@ -use Mix.Config +import Config # Configure your database config :philomena, Philomena.Repo, diff --git a/lib/philomena/commissions/commission.ex b/lib/philomena/commissions/commission.ex index 2df2e800..1e89257a 100644 --- a/lib/philomena/commissions/commission.ex +++ b/lib/philomena/commissions/commission.ex @@ -25,7 +25,9 @@ defmodule Philomena.Commissions.Commission do @doc false def changeset(commission, attrs) do commission - |> cast(attrs, []) - |> validate_required([]) + |> cast(attrs, [:information, :contact, :will_create, :will_not_create, :open, :sheet_image_id, :categories]) + |> validate_required([:user, :information, :contact, :open]) + |> validate_length(:information, max: 700, count: :bytes) + |> validate_length(:contact, max: 700, count: :bytes) end end diff --git a/priv/repo/seeds.exs b/priv/repo/seeds.exs index 334e072f..41e38625 100644 --- a/priv/repo/seeds.exs +++ b/priv/repo/seeds.exs @@ -15,7 +15,7 @@ alias Philomena.Tags import Ecto.Query IO.puts "---- Creating Elasticsearch indices" -for model <- [Image, Comment, Gallery, Tag, Post, Report] do # Report +for model <- [Image, Comment, Gallery, Tag, Post, Report] do model.delete_index! model.create_index! end