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 :geom, Geo.Geometry
|
||||||
field :slug, TitleSlug.Type
|
field :slug, TitleSlug.Type
|
||||||
field :state, :integer, default: 0
|
field :state, :integer, default: 0
|
||||||
|
field :status, :integer, default: 0
|
||||||
field :public, :boolean, default: true
|
field :public, :boolean, default: true
|
||||||
field :thumbnail, :string
|
field :thumbnail, :string
|
||||||
field :large_image, :string
|
field :large_image, :string
|
||||||
@ -61,7 +62,7 @@ defmodule Eventos.Events.Event do
|
|||||||
@doc false
|
@doc false
|
||||||
def changeset(%Event{} = event, attrs) do
|
def changeset(%Event{} = event, attrs) do
|
||||||
event
|
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])
|
|> validate_required([:title, :description, :begins_on, :ends_on, :organizer_id])
|
||||||
|> TitleSlug.maybe_generate_slug()
|
|> TitleSlug.maybe_generate_slug()
|
||||||
|> TitleSlug.unique_constraint()
|
|> TitleSlug.unique_constraint()
|
||||||
|
@ -11,6 +11,7 @@ defmodule Eventos.Repo.Migrations.CreateEvents do
|
|||||||
add :geom, :geometry
|
add :geom, :geometry
|
||||||
add :state, :integer, null: false
|
add :state, :integer, null: false
|
||||||
add :public, :boolean, null: false
|
add :public, :boolean, null: false
|
||||||
|
add :status, :integer, null: false
|
||||||
add :large_image, :string
|
add :large_image, :string
|
||||||
add :thumbnail, :string
|
add :thumbnail, :string
|
||||||
add :publish_at, :datetimetz
|
add :publish_at, :datetimetz
|
||||||
|
Loading…
Reference in New Issue
Block a user