Add state and fix casting
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
a1f60cf386
commit
9df9a795c7
@ -44,6 +44,7 @@ defmodule Eventos.Events.Event do
|
||||
field :geom, Geo.Geometry
|
||||
field :slug, TitleSlug.Type
|
||||
field :state, :integer, default: 0
|
||||
field :status, :integer, default: 0
|
||||
field :public, :boolean, default: true
|
||||
field :thumbnail, :string
|
||||
field :large_image, :string
|
||||
@ -61,7 +62,7 @@ defmodule Eventos.Events.Event do
|
||||
@doc false
|
||||
def changeset(%Event{} = event, attrs) do
|
||||
event
|
||||
|> cast(attrs, [:title, :description, :begins_on, :ends_on, :organizer_id])
|
||||
|> cast(attrs, [:title, :description, :begins_on, :ends_on, :organizer_id, :state, :geom, :status, :public, :thumbnail, :large_image, :publish_at])
|
||||
|> validate_required([:title, :description, :begins_on, :ends_on, :organizer_id])
|
||||
|> TitleSlug.maybe_generate_slug()
|
||||
|> TitleSlug.unique_constraint()
|
||||
|
@ -11,6 +11,7 @@ defmodule Eventos.Repo.Migrations.CreateEvents do
|
||||
add :geom, :geometry
|
||||
add :state, :integer, null: false
|
||||
add :public, :boolean, null: false
|
||||
add :status, :integer, null: false
|
||||
add :large_image, :string
|
||||
add :thumbnail, :string
|
||||
add :publish_at, :datetimetz
|
||||
|
Loading…
Reference in New Issue
Block a user