From b6339aaf75231dee4e9a819d0689658272df1c99 Mon Sep 17 00:00:00 2001 From: Joel Abshier Date: Sun, 3 Oct 2021 18:20:09 -0500 Subject: [PATCH] Change Schema names to plural --- lib/gql_preferences_web/schema.ex | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/gql_preferences_web/schema.ex diff --git a/lib/gql_preferences_web/schema.ex b/lib/gql_preferences_web/schema.ex new file mode 100644 index 0000000..ff1701d --- /dev/null +++ b/lib/gql_preferences_web/schema.ex @@ -0,0 +1,31 @@ +defmodule UserPreferencesWeb.Schema do + use Absinthe.Schema + alias UserPreferences.{User, Preference, Repo} + + query do + field :user, list_of(:user) do + resolve fn _, _, _ -> + {:ok, Repo.all(User)} + end + end + + field :preference, list_of(:preference) do + resolve fn _, _, _ -> + {:ok, Repo.all(Preference)} + end + end + end + + mutation + + object :user do + field :id, :id + field :name, :string + field :email, :string + end + + object :preference do + field :likes_emails, :boolean + field :likes_phone_calls, :boolean + end +end