🔍 Implement basic event visibility

See https://framagit.org/framasoft/mobilizon/wikis/spec/Event#visibility

Also brings support for event status (tentative/confirmed/cancelled)

Closes #56

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-01-14 15:56:07 +01:00
parent 3723eed1fe
commit ab56d3e607
7 changed files with 157 additions and 41 deletions

View File

@@ -2,7 +2,7 @@ defmodule Mobilizon.Repo.Migrations.AddAddressType do
use Ecto.Migration
def up do
AddressTypeEnum.create_type
Mobilizon.Events.AddressTypeEnum.create_type
alter table(:events) do
add :address_type, :address_type
add :online_address, :string
@@ -21,7 +21,7 @@ defmodule Mobilizon.Repo.Migrations.AddAddressType do
remove :online_address
remove :phone
end
AddressTypeEnum.drop_type
Mobilizon.Events.AddressTypeEnum.drop_type
drop constraint(:events, "events_physical_address_id_fkey")
rename table(:events), :physical_address_id, to: :address_id
alter table(:events) do

View File

@@ -0,0 +1,27 @@
defmodule Mobilizon.Repo.Migrations.FixEventVisibility do
use Ecto.Migration
def up do
Mobilizon.Events.EventVisibilityEnum.create_type
Mobilizon.Events.EventStatusEnum.create_type
alter table(:events) do
remove(:public)
remove(:status)
remove(:state)
add(:visibility, Mobilizon.Events.EventVisibilityEnum.type())
add(:status, Mobilizon.Events.EventStatusEnum.type())
end
end
def down do
alter table(:events) do
remove(:visibility)
remove(:status)
add(:state, :integer, null: false, default: 0)
add(:public, :boolean, null: false, default: false)
add(:status, :integer, null: false, default: 0)
end
Mobilizon.Events.EventVisibilityEnum.drop_type
Mobilizon.Events.EventStatusEnum.drop_type
end
end