Remove address_type and rename phone to phone_address

An event can indeed have several address types

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-01-14 17:48:08 +01:00
parent b0bc8dfa5d
commit 289ba03960
17 changed files with 93 additions and 24 deletions

View File

@@ -4,7 +4,6 @@ defmodule MobilizonWeb.Schema do
"""
use Absinthe.Schema
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
alias Mobilizon.{Actors, Events}
alias Mobilizon.Actors.{Actor, Follower, Member}
alias Mobilizon.Events.{Event, Comment, Participant}
@@ -200,9 +199,8 @@ defmodule MobilizonWeb.Schema do
arg(:thumbnail, :string)
arg(:large_image, :string)
arg(:publish_at, :datetime)
arg(:address_type, non_null(:address_type))
arg(:online_address, :string)
arg(:phone, :string)
arg(:phone_address, :string)
arg(:organizer_actor_username, non_null(:string))
arg(:category, non_null(:string))

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.ActorInterface do
@moduledoc """
Schema representation for Actor
"""
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
alias Mobilizon.Actors.Actor

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.Actors.FollowerType do
@moduledoc """
Schema representation for Follower
"""
use Absinthe.Schema.Notation
@desc """

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.Actors.GroupType do
@moduledoc """
Schema representation for Group
"""
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
import_types(MobilizonWeb.Schema.Actors.MemberType)

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.Actors.MemberType do
@moduledoc """
Schema representation for Member
"""
use Absinthe.Schema.Notation
@desc """

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.Actors.PersonType do
@moduledoc """
Schema representation for Person
"""
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
import_types(MobilizonWeb.Schema.UserType)

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.AddressType do
@moduledoc """
Schema representation for Address
"""
use Absinthe.Schema.Notation
object :physical_address do

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.CommentType do
@moduledoc """
Schema representation for Comment
"""
use Absinthe.Schema.Notation
@desc "A comment"
@@ -6,9 +9,23 @@ defmodule MobilizonWeb.Schema.CommentType do
field(:uuid, :uuid)
field(:url, :string)
field(:local, :boolean)
field(:visibility, :comment_visibility)
field(:text, :string)
field(:primaryLanguage, :string)
field(:replies, list_of(:comment))
field(:threadLanguages, non_null(list_of(:string)))
end
@desc "The list of visibility options for a comment"
enum :comment_visibility do
value(:public, description: "Publically listed and federated. Can be shared.")
value(:unlisted, description: "Visible only to people with the link - or invited")
value(:private,
description: "Visible only to people members of the group or followers of the person"
)
value(:moderated, description: "Visible only after a moderator accepted")
value(:invite, description: "visible only to people invited")
end
end

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.EventType do
@moduledoc """
Schema representation for Event
"""
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
import_types(MobilizonWeb.Schema.AddressType)
@@ -14,9 +17,8 @@ defmodule MobilizonWeb.Schema.EventType do
field(:description, :string, description: "The event's description")
field(:begins_on, :datetime, description: "Datetime for when the event begins")
field(:ends_on, :datetime, description: "Datetime for when the event ends")
field(:state, :integer, description: "State of the event")
field(:status, :integer, description: "Status of the event")
field(:public, :boolean, description: "Whether the event is public or not")
field(:status, :event_status, description: "Status of the event")
field(:visibility, :event_visibility, description: "The event's visibility")
# TODO replace me with picture object
field(:thumbnail, :string, description: "A thumbnail picture for the event")
# TODO replace me with banner
@@ -36,7 +38,7 @@ defmodule MobilizonWeb.Schema.EventType do
field(:category, :category, description: "The event's category")
field(:participants, list_of(:participant),
resolve: &Resolvers.Event.list_participants_for_event/3,
resolve: &MobilizonWeb.Resolvers.Event.list_participants_for_event/3,
description: "The event's participants"
)
@@ -46,4 +48,24 @@ defmodule MobilizonWeb.Schema.EventType do
field(:updated_at, :datetime, description: "When the event was last updated")
field(:created_at, :datetime, description: "When the event was created")
end
@desc "The list of visibility options for an event"
enum :event_visibility do
value(:public, description: "Publically listed and federated. Can be shared.")
value(:unlisted, description: "Visible only to people with the link - or invited")
value(:private,
description: "Visible only to people members of the group or followers of the person"
)
value(:moderated, description: "Visible only after a moderator accepted")
value(:invite, description: "visible only to people invited")
end
@desc "The list of possible options for the event's status"
enum :event_status do
value(:tentative, description: "The event is tentative")
value(:confirmed, description: "The event is confirmed")
value(:cancelled, description: "The event is cancelled")
end
end

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.Events.CategoryType do
@moduledoc """
Schema representation for Category
"""
use Absinthe.Schema.Notation
@desc "A category"

View File

@@ -1,5 +1,9 @@
defmodule MobilizonWeb.Schema.Events.ParticipantType do
@moduledoc """
Schema representation for Participant
"""
use Absinthe.Schema.Notation
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
@desc "Represents a participant to an event"
object :participant do

View File

@@ -1,4 +1,7 @@
defmodule MobilizonWeb.Schema.UserType do
@moduledoc """
Schema representation for User
"""
use Absinthe.Schema.Notation
@desc "A local user of Mobilizon"