From de9ef14b2e8567413b9300bc3526260d4eb08278 Mon Sep 17 00:00:00 2001 From: James Harton Date: Tue, 2 Apr 2024 09:20:08 +1300 Subject: [PATCH] improvement: re-integrate ash_graphql and ash_json_api RCs. --- .formatter.exs | 3 +- dev/dev_server/api_router.ex | 24 ++++++++-------- dev/dev_server/gql_router.ex | 46 +++++++++++++++---------------- dev/dev_server/json_api_router.ex | 8 +++--- dev/dev_server/router.ex | 4 +-- mix.exs | 6 ++-- mix.lock | 9 ++++-- test/support/example.ex | 9 +++--- test/support/example/schema.ex | 14 +++++----- test/support/example/user.ex | 46 +++++++++++++++---------------- 10 files changed, 86 insertions(+), 83 deletions(-) diff --git a/.formatter.exs b/.formatter.exs index e11fe37..dc40b68 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -106,8 +106,7 @@ spark_locals_without_parens = [ ] [ - # , :ash_json_api, :ash_graphql], - import_deps: [:ash, :spark], + import_deps: [:ash, :ash_json_api, :ash_graphql, :spark], inputs: [ "*.{ex,exs}", "{dev,config,lib,test}/**/*.{ex,exs}" diff --git a/dev/dev_server/api_router.ex b/dev/dev_server/api_router.ex index 786f81d..eb2da81 100644 --- a/dev/dev_server/api_router.ex +++ b/dev/dev_server/api_router.ex @@ -1,14 +1,14 @@ -# defmodule DevServer.ApiRouter do -# @moduledoc """ -# Router for API Requests. -# """ -# use Plug.Router -# import Example.AuthPlug +defmodule DevServer.ApiRouter do + @moduledoc """ + Router for API Requests. + """ + use Plug.Router + import Example.AuthPlug -# plug(:load_from_bearer) -# plug(:set_actor, :user) -# plug(:match) -# plug(:dispatch) + plug(:load_from_bearer) + plug(:set_actor, :user) + plug(:match) + plug(:dispatch) -# forward("/", to: DevServer.JsonApiRouter) -# end + forward("/", to: DevServer.JsonApiRouter) +end diff --git a/dev/dev_server/gql_router.ex b/dev/dev_server/gql_router.ex index b3c29c9..1fe3c4a 100644 --- a/dev/dev_server/gql_router.ex +++ b/dev/dev_server/gql_router.ex @@ -1,26 +1,26 @@ -# defmodule DevServer.GqlRouter do -# @moduledoc """ -# Router for GraphQL requests. -# """ -# use Plug.Router -# import Example.AuthPlug +defmodule DevServer.GqlRouter do + @moduledoc """ + Router for GraphQL requests. + """ + use Plug.Router + import Example.AuthPlug -# plug(:load_from_bearer) -# plug(:set_actor, :user) -# plug(AshGraphql.Plug) -# plug(:match) -# plug(:dispatch) + plug(:load_from_bearer) + plug(:set_actor, :user) + plug(AshGraphql.Plug) + plug(:match) + plug(:dispatch) -# forward("/playground", -# to: Absinthe.Plug.GraphiQL, -# init_opts: [ -# schema: Example.Schema, -# interface: :playground -# ] -# ) + forward("/playground", + to: Absinthe.Plug.GraphiQL, + init_opts: [ + schema: Example.Schema, + interface: :playground + ] + ) -# forward("/", -# to: Absinthe.Plug, -# init_opts: [schema: Example.Schema] -# ) -# end + forward("/", + to: Absinthe.Plug, + init_opts: [schema: Example.Schema] + ) +end diff --git a/dev/dev_server/json_api_router.ex b/dev/dev_server/json_api_router.ex index 5ac39b6..6e92df6 100644 --- a/dev/dev_server/json_api_router.ex +++ b/dev/dev_server/json_api_router.ex @@ -1,4 +1,4 @@ -# defmodule DevServer.JsonApiRouter do -# @moduledoc false -# use AshJsonApi.Api.Router, api: Example -# end +defmodule DevServer.JsonApiRouter do + @moduledoc false + use AshJsonApi.Router, domain: Example +end diff --git a/dev/dev_server/router.ex b/dev/dev_server/router.ex index 4bea6a0..2a43c19 100644 --- a/dev/dev_server/router.ex +++ b/dev/dev_server/router.ex @@ -13,7 +13,7 @@ defmodule DevServer.Router do forward("/auth", to: Example.AuthPlug) get("/clear_session", to: DevServer.ClearSession) post("/token_check", to: DevServer.TokenCheck) - # forward("/api", to: DevServer.ApiRouter) - # forward("/gql", to: DevServer.GqlRouter) + forward("/api", to: DevServer.ApiRouter) + forward("/gql", to: DevServer.GqlRouter) forward("/", to: DevServer.WebRouter) end diff --git a/mix.exs b/mix.exs index 962e6b8..68fff94 100644 --- a/mix.exs +++ b/mix.exs @@ -184,9 +184,9 @@ defmodule AshAuthentication.MixProject do {:spark, "~> 2.0"}, {:splode, "~> 0.2"}, {:absinthe_plug, "~> 1.5", only: [:dev, :test]}, - # {:ash_graphql, "~> 0.21", only: [:dev, :test]}, - # {:ash_json_api, "~> 0.30", only: [:dev, :test]}, - {:ash_postgres, "== 2.0.0-rc.1", optional: true}, + {:ash_graphql, "== 1.0.0-rc.0", only: [:dev, :test]}, + {:ash_json_api, "== 1.0.0-rc.0", only: [:dev, :test]}, + {:ash_postgres, "== 2.0.0-rc.3", optional: true}, {:credo, "~> 1.6", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false}, {:doctor, "~> 0.18", only: [:dev, :test]}, diff --git a/mix.lock b/mix.lock index dac49cf..4fa55dc 100644 --- a/mix.lock +++ b/mix.lock @@ -2,13 +2,17 @@ "absinthe": {:hex, :absinthe, "1.7.6", "0b897365f98d068cfcb4533c0200a8e58825a4aeeae6ec33633ebed6de11773b", [:mix], [{:dataloader, "~> 1.0.0 or ~> 2.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e7626951ca5eec627da960615b51009f3a774765406ff02722b1d818f17e5778"}, "absinthe_plug": {:hex, :absinthe_plug, "1.5.8", "38d230641ba9dca8f72f1fed2dfc8abd53b3907d1996363da32434ab6ee5d6ab", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bbb04176647b735828861e7b2705465e53e2cf54ccf5a73ddd1ebd855f996e5a"}, "ash": {:hex, :ash, "3.0.0-rc.6", "78d9bc068a0c632e4fe2db8a8802f772c65329c8bc15877ceb6eb2ac83e1fa8b", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 0.8", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.1.7 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.2", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 0.6", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3e0ccc857572d10972868886aff46f9b1d11c90f8b357f85f2887e71f702e916"}, - "ash_postgres": {:hex, :ash_postgres, "2.0.0-rc.1", "c6f2284ab5c7271df63cf13af82655c8632d32665809d2120861c38bd9ee32b3", [:mix], [{:ash, "~> 3.0.0-rc.0", [hex: :ash, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}, {:simple_sat, "~> 0.1", [hex: :simple_sat, repo: "hexpm", optional: false]}], "hexpm", "840d95c9ac9e363620428568c22a0312aaa181c74f55289a8bc6588801f22e93"}, + "ash_graphql": {:hex, :ash_graphql, "1.0.0-rc.0", "52878a1ffc00244097ab4f1b5ed04afe0be6b31f116ac176d473852bc4e2d243", [:mix], [{:absinthe, "~> 1.7", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.4", [hex: :absinthe_plug, repo: "hexpm", optional: false]}, {:ash, "~> 3.0.0-rc.6", [hex: :ash, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "058d2a5d3c132862fdab695028f378d05fb2ae53219c13e936e52320bb5ee220"}, + "ash_json_api": {:hex, :ash_json_api, "1.0.0-rc.0", "addc4c51e54bbfc50a8025606529f30f66c50a9ccabade9e89ca6b868983459b", [:mix], [{:ash, "~> 3.0.0-rc.0", [hex: :ash, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:json_xema, "~> 0.4", [hex: :json_xema, repo: "hexpm", optional: false]}, {:open_api_spex, "~> 3.16", [hex: :open_api_spex, repo: "hexpm", optional: true]}, {:plug, "~> 1.11", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9643f4aa05b8c6feae51397033a358f18f03277eaf60c2ad98092155fc353bb8"}, + "ash_postgres": {:hex, :ash_postgres, "2.0.0-rc.3", "63f25bfd8ef79bdd6045ff8eab85d8fb42369c03225f685e49ab15ea97771be6", [:mix], [{:ash, "~> 3.0.0-rc.0", [hex: :ash, repo: "hexpm", optional: false]}, {:ash_sql, "~> 0.1.1-rc.3", [hex: :ash_sql, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "434713bc777e6f30a6cd5b11768b504c4624e7b62c48d185064b8d2e4fcfb837"}, + "ash_sql": {:hex, :ash_sql, "0.1.1-rc.3", "4d0043b6560a90da70f9d1950968113b2fcb3e0e036a2e4112168ea3786c8429", [:mix], [{:ash, "~> 3.0.0-rc.0", [hex: :ash, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}], "hexpm", "b6f32c1d3ec86983481708583be9d6b0959adbc1cb2de8987c816eb238b97762"}, "assent": {:hex, :assent, "0.2.9", "e3cdbc8f2e4f8d02c4c490ef8c2148bb1bc0d81aa0648f09addc5918d9a1cd5a", [:mix], [{:certifi, ">= 0.0.0", [hex: :certifi, repo: "hexpm", optional: true]}, {:finch, "~> 0.15", [hex: :finch, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: true]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:req, "~> 0.4", [hex: :req, repo: "hexpm", optional: true]}, {:ssl_verify_fun, ">= 0.0.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: true]}], "hexpm", "5f9562bda90bef7bd3f1b9a348520a5631b86c85145346bb7edb8a7ebbad8e86"}, "bcrypt_elixir": {:hex, :bcrypt_elixir, "3.1.0", "0b110a9a6c619b19a7f73fa3004aa11d6e719a67e672d1633dc36b6b2290a0f7", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "2ad2acb5a8bc049e8d5aa267802631912bb80d5f4110a178ae7999e69dca1bf7"}, "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "castore": {:hex, :castore, "1.0.6", "ffc42f110ebfdafab0ea159cd43d31365fa0af0ce4a02ecebf1707ae619ee727", [:mix], [], "hexpm", "374c6e7ca752296be3d6780a6d5b922854ffcc74123da90f2f328996b962d33a"}, "comeonin": {:hex, :comeonin, "5.4.0", "246a56ca3f41d404380fc6465650ddaa532c7f98be4bda1b4656b3a37cc13abe", [:mix], [], "hexpm", "796393a9e50d01999d56b7b8420ab0481a7538d0caf80919da493b4a6e51faf1"}, "comparable": {:hex, :comparable, "1.0.0", "bb669e91cedd14ae9937053e5bcbc3c52bb2f22422611f43b6e38367d94a495f", [:mix], [{:typable, "~> 0.1", [hex: :typable, repo: "hexpm", optional: false]}], "hexpm", "277c11eeb1cd726e7cd41c6c199e7e52fa16ee6830b45ad4cdc62e51f62eb60c"}, + "conv_case": {:hex, :conv_case, "0.2.3", "c1455c27d3c1ffcdd5f17f1e91f40b8a0bc0a337805a6e8302f441af17118ed8", [:mix], [], "hexpm", "88f29a3d97d1742f9865f7e394ed3da011abb7c5e8cc104e676fdef6270d4b4a"}, "cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, "cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"}, @@ -34,6 +38,7 @@ "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "joken": {:hex, :joken, "2.6.0", "b9dd9b6d52e3e6fcb6c65e151ad38bf4bc286382b5b6f97079c47ade6b1bcc6a", [:mix], [{:jose, "~> 1.11.5", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "5a95b05a71cd0b54abd35378aeb1d487a23a52c324fa7efdffc512b655b5aaa7"}, "jose": {:hex, :jose, "1.11.6", "613fda82552128aa6fb804682e3a616f4bc15565a048dabd05b1ebd5827ed965", [:mix, :rebar3], [], "hexpm", "6275cb75504f9c1e60eeacb771adfeee4905a9e182103aa59b53fed651ff9738"}, + "json_xema": {:hex, :json_xema, "0.6.2", "2af74c57f3f8dff8b74502d69d53f1ae7b6b236b477f30871c415ea8377a4c72", [:mix], [{:conv_case, "~> 0.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:xema, "~> 0.16", [hex: :xema, repo: "hexpm", optional: false]}], "hexpm", "50c84c537c95fcc76677f1f030af4aed188f538820fc488aeaa3f7dfe04d0edf"}, "libgraph": {:hex, :libgraph, "0.16.0", "3936f3eca6ef826e08880230f806bfea13193e49bf153f93edcf0239d4fd1d07", [:mix], [], "hexpm", "41ca92240e8a4138c30a7e06466acc709b0cbb795c643e9e17174a178982d6bf"}, "makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, @@ -51,7 +56,6 @@ "postgrex": {:hex, :postgrex, "0.17.5", "0483d054938a8dc069b21bdd636bf56c487404c241ce6c319c1f43588246b281", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "50b8b11afbb2c4095a3ba675b4f055c416d0f3d7de6633a595fc131a828a67eb"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, "reactor": {:hex, :reactor, "0.8.1", "1aec71d16083901277727c8162f6dd0f07e80f5ca98911b6ef4f2c95e6e62758", [:mix], [{:libgraph, "~> 0.16", [hex: :libgraph, repo: "hexpm", optional: false]}, {:spark, "~> 2.0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.2", [hex: :splode, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.2", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ae3936d97a3e4a316744f70c77b85345b08b70da334024c26e6b5eb8ede1246b"}, - "simple_sat": {:hex, :simple_sat, "0.1.1", "68a5ebe6f6d5956bd806e4881c495692c14580a2f1a4420488985abd0fba2119", [:mix], [], "hexpm", "63571218f92ff029838df7645eb8f0c38df8ed60d2d14578412a8d142a94471e"}, "sobelow": {:hex, :sobelow, "0.13.0", "218afe9075904793f5c64b8837cc356e493d88fddde126a463839351870b8d1e", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cd6e9026b85fc35d7529da14f95e85a078d9dd1907a9097b3ba6ac7ebbe34a0d"}, "sourceror": {:hex, :sourceror, "1.0.2", "c5e86fdc14881f797749d1fe5df017ca66727a8146e7ee3e736605a3df78f3e6", [:mix], [], "hexpm", "832335e87d0913658f129d58b2a7dc0490ddd4487b02de6d85bca0169ec2bd79"}, "spark": {:hex, :spark, "2.1.11", "8093149dfd583b5ce2c06e1fea1faaf4125b50e4703138b2cbefb78c8f4aa07f", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.0", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "1877d92ab993b860e9d828bfd72d50367c0d3a53dd84f4de5d221baf66ae8723"}, @@ -59,6 +63,7 @@ "stream_data": {:hex, :stream_data, "0.6.0", "e87a9a79d7ec23d10ff83eb025141ef4915eeb09d4491f79e52f2562b73e5f47", [:mix], [], "hexpm", "b92b5031b650ca480ced047578f1d57ea6dd563f5b57464ad274718c9c29501c"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, "typable": {:hex, :typable, "0.3.0", "0431e121d124cd26f312123e313d2689b9a5322b15add65d424c07779eaa3ca1", [:mix], [], "hexpm", "880a0797752da1a4c508ac48f94711e04c86156f498065a83d160eef945858f8"}, + "xema": {:hex, :xema, "0.17.1", "fa83ed90ec7d9a5e38a223ee1f0693cfb8cd3fa0d0c7f7967f828a0643811f10", [:mix], [{:conv_case, "~> 0.2.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "3dd7213309cc8e6d7770ee54de807a0d91cdbdd9dcb78a6f3eee9dbad43889af"}, "yamerl": {:hex, :yamerl, "0.10.0", "4ff81fee2f1f6a46f1700c0d880b24d193ddb74bd14ef42cb0bcf46e81ef2f8e", [:rebar3], [], "hexpm", "346adb2963f1051dc837a2364e4acf6eb7d80097c0f53cbdc3046ec8ec4b4e6e"}, "yaml_elixir": {:hex, :yaml_elixir, "2.9.0", "9a256da867b37b8d2c1ffd5d9de373a4fda77a32a45b452f1708508ba7bbcb53", [:mix], [{:yamerl, "~> 0.10", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "0cb0e7d4c56f5e99a6253ed1a670ed0e39c13fc45a6da054033928607ac08dfc"}, } diff --git a/test/support/example.ex b/test/support/example.ex index f55fa0f..58828be 100644 --- a/test/support/example.ex +++ b/test/support/example.ex @@ -1,7 +1,6 @@ defmodule Example do @moduledoc false - use Ash.Domain, otp_app: :ash_authentication - # , extensions: [AshGraphql.Api, AshJsonApi.Api] + use Ash.Domain, otp_app: :ash_authentication, extensions: [AshGraphql.Domain, AshJsonApi.Domain] resources do resource Example.User @@ -10,7 +9,7 @@ defmodule Example do resource Example.UserIdentity end - # json_api do - # prefix "/api" - # end + json_api do + prefix "/api" + end end diff --git a/test/support/example/schema.ex b/test/support/example/schema.ex index ac024b8..50f1ba5 100644 --- a/test/support/example/schema.ex +++ b/test/support/example/schema.ex @@ -1,9 +1,9 @@ -# defmodule Example.Schema do -# @moduledoc false -# use Absinthe.Schema +defmodule Example.Schema do + @moduledoc false + use Absinthe.Schema -# use AshGraphql, apis: [Example] + use AshGraphql, domains: [Example] -# query do -# end -# end + query do + end +end diff --git a/test/support/example/user.ex b/test/support/example/user.ex index 55aa92d..fcded96 100644 --- a/test/support/example/user.ex +++ b/test/support/example/user.ex @@ -4,8 +4,8 @@ defmodule Example.User do data_layer: AshPostgres.DataLayer, extensions: [ AshAuthentication, - # AshGraphql.Resource, - # AshJsonApi.Resource, + AshGraphql.Resource, + AshJsonApi.Resource, Example.OnlyMartiesAtTheParty ], domain: Example @@ -119,31 +119,31 @@ defmodule Example.User do define :update_user, action: :update end - # graphql do - # type :user + graphql do + type :user - # queries do - # get :get_user, :read - # list :list_users, :read - # read_one :current_user, :current_user - # end + queries do + get :get_user, :read + list :list_users, :read + read_one :current_user, :current_user + end - # mutations do - # create :register, :register_with_password - # end - # end + mutations do + create :register, :register_with_password + end + end - # json_api do - # type "user" + json_api do + type "user" - # routes do - # base "/users" - # get :read - # get :current_user, route: "/me" - # index :read - # post :register_with_password - # end - # end + routes do + base "/users" + get :read + get :current_user, route: "/me" + index :read + post :register_with_password + end + end postgres do table "user"