Update GraphQL Absinthe schema

Remove unneeded things
Update descriptions

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-11-14 16:51:47 +01:00
parent 3a66111ad7
commit 06709ee46b

View file

@ -14,51 +14,51 @@ defmodule MobilizonWeb.Schema do
@desc "An ActivityPub actor" @desc "An ActivityPub actor"
object :actor do object :actor do
field(:url, :string) field(:url, :string, description: "The ActivityPub actor's URL")
field(:outbox_url, :string) # We probably don't need all of that
field(:inbox_url, :string) # field(:outbox_url, :string, description: "The ActivityPub actor outbox_url")
field(:following_url, :string) # field(:inbox_url, :string)
field(:followers_url, :string) # field(:following_url, :string)
field(:shared_inbox_url, :string) # field(:followers_url, :string)
field(:type, :actor_type) # field(:shared_inbox_url, :string)
field(:name, :string) field(:type, :actor_type, description: "The type of Actor (Person, Group,…)")
field(:domain, :string) field(:name, :string, description: "The actor's displayed name")
field(:summary, :string) field(:domain, :string, description: "The actor's domain if (null if it's this instance)")
field(:preferred_username, :string) field(:summary, :string, description: "The actor's summary")
field(:keys, :string) field(:preferred_username, :string, description: "The actor's preferred username")
field(:manually_approves_followers, :boolean) field(:keys, :string, description: "The actors RSA Keys")
field(:suspended, :boolean) field(:manually_approves_followers, :boolean, description: "Whether the actors manually approves followers")
field(:avatar_url, :string) field(:suspended, :boolean, description: "If the actor is suspended")
field(:banner_url, :string) field(:avatar_url, :string, description: "The actor's avatar url")
field(:banner_url, :string, description: "The actor's banner url")
# field(:followers, list_of(:follower)) # field(:followers, list_of(:follower))
field :organized_events, list_of(:event) do field(:organized_events, list_of(:event), resolve: dataloader(Events), description: "A list of the events this actor has organized")
resolve(dataloader(Events))
end
# field(:memberships, list_of(:member)) # field(:memberships, list_of(:member))
field(:user, :user) field(:user, :user, description: "The user this actor is associated to")
end end
@desc "The list of types an actor can be"
enum :actor_type do enum :actor_type do
value(:Person) value(:Person, description: "An ActivityPub Person")
value(:Application) value(:Application, description: "An ActivityPub Application")
value(:Group) value(:Group, description: "An ActivityPub Group")
value(:Organization) value(:Organization, description: "An ActivityPub Organization")
value(:Service) value(:Service, description: "An ActivityPub Service")
end end
@desc "A local user of Mobilizon" @desc "A local user of Mobilizon"
object :user do object :user do
field(:id, non_null(:id)) field(:id, non_null(:id), description: "The user's ID")
field(:email, non_null(:string)) field(:email, non_null(:string), description: "The user's email")
# , resolve: dataloader(:actors)) # , resolve: dataloader(:actors))
field(:actors, non_null(list_of(:actor))) field(:actors, non_null(list_of(:actor)), description: "The user's list of actors (identities)")
field(:default_actor_id, non_null(:integer)) field(:default_actor_id, non_null(:integer), description: "The user's default actor")
field(:confirmed_at, :datetime) field(:confirmed_at, :datetime, description: "The datetime when the user was confirmed/activated")
field(:confirmation_sent_at, :datetime) field(:confirmation_sent_at, :datetime, description: "The datetime the last activation/confirmation token was sent")
field(:confirmation_token, :string) field(:confirmation_token, :string, description: "The account activation/confirmation token")
field(:reset_password_sent_at, :datetime) field(:reset_password_sent_at, :datetime, description: "The datetime last reset password email was sent")
field(:reset_password_token, :string) field(:reset_password_token, :string, description: "The token sent when requesting password token")
end end
@desc "A JWT and the associated user ID" @desc "A JWT and the associated user ID"
@ -115,6 +115,7 @@ defmodule MobilizonWeb.Schema do
field(:role, :integer) field(:role, :integer)
end end
@desc "The list of types an address can be"
enum :address_type do enum :address_type do
value(:physical) value(:physical)
value(:url) value(:url)
@ -212,9 +213,7 @@ defmodule MobilizonWeb.Schema do
resolve(&Resolvers.Actor.find_actor/3) resolve(&Resolvers.Actor.find_actor/3)
end end
@doc """ @desc "Get the list of categories"
Get the list of categories
"""
field :categories, list_of(:category) do field :categories, list_of(:category) do
resolve(&Resolvers.Category.list_categories/3) resolve(&Resolvers.Category.list_categories/3)
end end
@ -242,9 +241,7 @@ defmodule MobilizonWeb.Schema do
resolve(&Resolvers.Event.create_event/3) resolve(&Resolvers.Event.create_event/3)
end end
@doc """ @desc "Create a category with a title, description and picture"
Create a category with a title, description and picture
"""
field :create_category, type: :category do field :create_category, type: :category do
arg(:title, non_null(:string)) arg(:title, non_null(:string))
arg(:description, non_null(:string)) arg(:description, non_null(:string))
@ -274,18 +271,14 @@ defmodule MobilizonWeb.Schema do
resolve(&Resolvers.User.resend_confirmation_email/3) resolve(&Resolvers.User.resend_confirmation_email/3)
end end
@doc """ @desc "Send a link through email to reset user password"
Send a link through email to reset user password
"""
field :send_reset_password, type: :string do field :send_reset_password, type: :string do
arg(:email, non_null(:string)) arg(:email, non_null(:string))
arg(:locale, :string, default_value: "en") arg(:locale, :string, default_value: "en")
resolve(&Resolvers.User.send_reset_password/3) resolve(&Resolvers.User.send_reset_password/3)
end end
@doc """ @desc "Reset user password"
Reset user password
"""
field :reset_password, type: :login do field :reset_password, type: :login do
arg(:token, non_null(:string)) arg(:token, non_null(:string))
arg(:password, non_null(:string)) arg(:password, non_null(:string))