From 1638be19a1a4187946d6dfce7681d77af550c787 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 3 Feb 2021 18:35:27 +0800 Subject: [PATCH 1/5] chore(deps): upgraade absinthe to 1.5 --- .../schema/delivery/delivery_types.ex | 17 ++++++++--------- .../schema/statistics/statistics_types.ex | 1 - .../schema/utils/common_types.ex | 1 - lib/helper/gql_schema_suite.ex | 1 - mix.exs | 7 +++---- mix.lock | 7 ++++--- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/lib/groupher_server_web/schema/delivery/delivery_types.ex b/lib/groupher_server_web/schema/delivery/delivery_types.ex index a5c8889a9..5ca84efac 100644 --- a/lib/groupher_server_web/schema/delivery/delivery_types.ex +++ b/lib/groupher_server_web/schema/delivery/delivery_types.ex @@ -1,6 +1,5 @@ defmodule GroupherServerWeb.Schema.Delivery.Types do use Absinthe.Schema.Notation - use Absinthe.Ecto, repo: GroupherServer.Repo import GroupherServerWeb.Schema.Utils.Helper import Helper.Utils, only: [get_config: 2] @@ -34,16 +33,16 @@ defmodule GroupherServerWeb.Schema.Delivery.Types do field(:read, :boolean) end - object :sys_notification do - field(:id, :id) + # object :sys_notification do + # field(:id, :id) - field(:source_id, :string) - field(:source_title, :string) - field(:source_preview, :string) - field(:source_type, :string) + # field(:source_id, :string) + # field(:source_title, :string) + # field(:source_preview, :string) + # field(:source_type, :string) - field(:read, :boolean) - end + # field(:read, :boolean) + # end object :notification do field(:id, :id) diff --git a/lib/groupher_server_web/schema/statistics/statistics_types.ex b/lib/groupher_server_web/schema/statistics/statistics_types.ex index 25babf7bb..2d8b45626 100644 --- a/lib/groupher_server_web/schema/statistics/statistics_types.ex +++ b/lib/groupher_server_web/schema/statistics/statistics_types.ex @@ -1,6 +1,5 @@ defmodule GroupherServerWeb.Schema.Statistics.Types do use Absinthe.Schema.Notation - use Absinthe.Ecto, repo: GroupherServer.Repo # import GroupherServerWeb.Schema.Utils.Helper diff --git a/lib/groupher_server_web/schema/utils/common_types.ex b/lib/groupher_server_web/schema/utils/common_types.ex index 63cc48e3b..e4d0c2838 100644 --- a/lib/groupher_server_web/schema/utils/common_types.ex +++ b/lib/groupher_server_web/schema/utils/common_types.ex @@ -5,7 +5,6 @@ defmodule GroupherServerWeb.Schema.Utils.CommonTypes do import GroupherServerWeb.Schema.Utils.Helper use Absinthe.Schema.Notation - use Absinthe.Ecto, repo: GroupherServer.Repo object :status do field(:done, :boolean) diff --git a/lib/helper/gql_schema_suite.ex b/lib/helper/gql_schema_suite.ex index c9c1ecb04..1546ecd4f 100644 --- a/lib/helper/gql_schema_suite.ex +++ b/lib/helper/gql_schema_suite.ex @@ -6,7 +6,6 @@ defmodule Helper.GqlSchemaSuite do defmacro __using__(_opts) do quote do use Absinthe.Schema.Notation - use Absinthe.Ecto, repo: GroupherServer.Repo alias GroupherServerWeb.Resolvers, as: R alias GroupherServerWeb.Middleware, as: M diff --git a/mix.exs b/mix.exs index 1d146577b..404f5c9a1 100644 --- a/mix.exs +++ b/mix.exs @@ -62,10 +62,9 @@ defmodule GroupherServer.Mixfile do {:plug_cowboy, "~> 2.4.1"}, {:plug, "~> 1.11.0"}, # GraphQl tool - {:absinthe, "~> 1.4.16"}, - {:absinthe_ecto, "~> 0.1.3"}, + {:absinthe, "~> 1.5.5"}, # Plug support for Absinthe - {:absinthe_plug, "~> 1.4.6"}, + {:absinthe_plug, "~> 1.5.4"}, # Password hashing lib {:comeonin, "~> 5.1.1"}, # CORS @@ -80,7 +79,7 @@ defmodule GroupherServer.Mixfile do # {:scrivener_ecto, "~> 2.0.0"}, {:guardian, "~> 2.0"}, {:timex, "~> 3.6.1"}, - {:dataloader, "~> 1.0.2"}, + {:dataloader, "~> 1.0.7"}, {:mix_test_watch, "~> 1.0.2", only: :dev, runtime: false}, {:ex_unit_notifier, "~> 0.1", only: :test}, {:apollo_tracing, "~> 0.4.3"}, diff --git a/mix.lock b/mix.lock index 0f3caf021..979731564 100644 --- a/mix.lock +++ b/mix.lock @@ -1,7 +1,7 @@ %{ - "absinthe": {:hex, :absinthe, "1.4.16", "0933e4d9f12652b12115d5709c0293a1bf78a22578032e9ad0dad4efee6b9eb1", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "076b8bd9552f4966ba1242f412f6c439b731169a36a0ddaaffcd3893828f5bf6"}, + "absinthe": {:hex, :absinthe, "1.5.5", "22b26228f56dc6a1074c52cea9c64e869a0cb2427403bcf9056c422d36c66292", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "41e79ed4bffbab4986493ff4120c948d59871fd08ad5e31195129ce3c01aad58"}, "absinthe_ecto": {:hex, :absinthe_ecto, "0.1.3", "420b68129e79fe4571a4838904ba03e282330d335da47729ad52ffd7b8c5fcb1", [:mix], [{:absinthe, "~> 1.3.0 or ~> 1.4.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:ecto, ">= 0.0.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "355b9db34abfab96ae1e025434b66e11002babcf4fe6b7144d26ff7548985f52"}, - "absinthe_plug": {:hex, :absinthe_plug, "1.4.7", "939b6b9e1c7abc6b399a5b49faa690a1fbb55b195c670aa35783b14b08ccec7a", [:mix], [{:absinthe, "~> 1.4.11", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.2 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "c6ecb0e56a963287ac252d0563e5b33b84b300ce8203d3d1410dddb5dc6d08e9"}, + "absinthe_plug": {:hex, :absinthe_plug, "1.5.4", "daff02d04be7c06d0114ef5b4361865a4dacbe8ddb325ce709b103253d4a014b", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "80360cd8ad541d87c75336f3abc59b894d474458f6a7f8e563781c01148860de"}, "apollo_tracing": {:hex, :apollo_tracing, "0.4.3", "6bc56132f4ab87223b10dc7ab91bf4374ba4033411ba80873f9f89caf15d7476", [:mix], [{:absinthe, "~> 1.4", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.4", [hex: :absinthe_plug, repo: "hexpm", optional: true]}, {:jason, "~> 1.1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "150077363f588fa6881b77f936d7e671cfcaf6f6b4783b7682f6705c898bfc53"}, "argon2_elixir": {:hex, :argon2_elixir, "1.2.14", "0fc4bfbc1b7e459954987d3d2f3836befd72d63f3a355e3978f5005dd6e80816", [], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"}, "bamboo": {:hex, :bamboo, "1.3.0", "9ab7c054f1c3435464efcba939396c29c5e1b28f73c34e1f169e0881297a3141", [:mix], [{:hackney, ">= 1.13.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "e1197188512d4a4458eaaad9a1659ce9eeb54a1b41574a9cd7507217b33e0f3e"}, @@ -19,7 +19,7 @@ "cowlib": {:hex, :cowlib, "2.9.1", "61a6c7c50cf07fdd24b2f45b89500bb93b6686579b069a89f88cb211e1125c78", [:rebar3], [], "hexpm", "e4175dc240a70d996156160891e1c62238ede1729e45740bdd38064dad476170"}, "credo": {:hex, :credo, "1.4.0", "92339d4cbadd1e88b5ee43d427b639b68a11071b6f73854e33638e30a0ea11f5", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1fd3b70dce216574ce3c18bdf510b57e7c4c85c2ec9cad4bff854abaf7e58658"}, "crontab": {:hex, :crontab, "1.1.7", "b9219f0bdc8678b94143655a8f229716c5810c0636a4489f98c0956137e53985", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "01685acedf41cbfcf3f6cc7389ac0a73f9edcc185e6ce9fa7a5f32dd0402305d"}, - "dataloader": {:hex, :dataloader, "1.0.6", "fb724d6d3fb6acb87d27e3b32dea3a307936ad2d245faf9cf5221d1323d6a4ba", [:mix], [{:ecto, ">= 0.0.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "d16b82bc004038243236c73b76bef39be634828a4f4f4f9d637fb498ff886a10"}, + "dataloader": {:hex, :dataloader, "1.0.8", "114294362db98a613f231589246aa5b0ce847412e8e75c4c94f31f204d272cbf", [:mix], [{:ecto, ">= 3.4.3 and < 4.0.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "eaf3c2aa2bc9dbd2f1e960561d616b7f593396c4754185b75904f6d66c82a667"}, "db_connection": {:hex, :db_connection, "2.3.1", "4c9f3ed1ef37471cbdd2762d6655be11e38193904d9c5c1c9389f1b891a3088e", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "abaab61780dde30301d840417890bd9f74131041afd02174cf4e10635b3a63f5"}, "decimal": {:hex, :decimal, "1.9.0", "83e8daf59631d632b171faabafb4a9f4242c514b0a06ba3df493951c08f64d07", [:mix], [], "hexpm", "b1f2343568eed6928f3e751cf2dffde95bfaa19dd95d09e8a9ea92ccfd6f7d85"}, "dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"}, @@ -54,6 +54,7 @@ "mix_test_watch": {:hex, :mix_test_watch, "1.0.2", "34900184cbbbc6b6ed616ed3a8ea9b791f9fd2088419352a6d3200525637f785", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "47ac558d8b06f684773972c6d04fcc15590abdb97aeb7666da19fcbfdc441a07"}, "mochiweb": {:hex, :mochiweb, "2.20.1", "e4dbd0ed716f076366ecf62ada5755a844e1d95c781e8c77df1d4114be868cdf", [:rebar3], [], "hexpm", "d1aeee7870470d2fa9eae0b3d5ab6c33801aa2d82b10e9dade885c5c921b36aa"}, "nanoid": {:hex, :nanoid, "2.0.2", "f3f7b4bf103ab6667f22beb00b6315825ee3f30100dd2c93d534e5c02164e857", [:mix], [], "hexpm", "3095cb1fac7bbc78843a8ccd99f1af375d0da1d3ebaa8552e846b73438c0c44f"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, "open_graph": {:hex, :open_graph, "0.0.4", "0790882d5735286abc8391b37d2707613ecd74ebdc5340be664d3df345cd8cae", [:mix], [{:httpoison, "~> 1.5", [hex: :httpoison, repo: "hexpm", optional: false]}], "hexpm", "a22a8ddaf9f881af38d519ced463627c37a8dea49a35cc27efdb9f2b839b9049"}, "pangu": {:hex, :pangu, "0.1.0", "9f9e06418212017bb076034865462e92effed4e5b18c063d4448c186f12a6f0a", [:mix], [], "hexpm", "2634cc2463421757aca0a76665de83940d4fda12f8ed316ae929bb29f64d06c5"}, "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, From 4b0c296971c43092b60aa5bcd66730a403a0ba61 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 3 Feb 2021 18:36:10 +0800 Subject: [PATCH 2/5] fix(test): errors by upgrade to absinthe 1.5 --- .../mutation/accounts/customization_test.exs | 8 ++++---- .../mutation/cms/cheatsheet_test.exs | 2 +- test/groupher_server_web/mutation/cms/cms_test.exs | 2 +- .../mutation/cms/job_reaction_test.exs | 4 ++-- test/groupher_server_web/mutation/cms/job_test.exs | 2 +- .../mutation/cms/post_reaction_test.exs | 4 ++-- .../mutation/cms/video_reaction_test.exs | 4 ++-- test/groupher_server_web/mutation/cms/video_test.exs | 6 +++--- test/groupher_server_web/mutation/cms/wiki_test.exs | 2 +- .../mutation/statistics/statistics_test.exs | 2 +- .../query/accounts/account_test.exs | 2 +- .../groupher_server_web/query/cms/job_comment_test.exs | 2 +- .../groupher_server_web/query/cms/paged_posts_test.exs | 10 +++++----- .../query/cms/post_comment_test.exs | 10 +++++----- .../groupher_server_web/query/cms/post_viewer_test.exs | 2 +- .../groupher_server_web/query/cms/posts_flags_test.exs | 2 +- .../query/cms/repo_comment_test.exs | 2 +- .../query/cms/video_comment_test.exs | 2 +- test/support/assert_helper.ex | 2 +- 19 files changed, 35 insertions(+), 35 deletions(-) diff --git a/test/groupher_server_web/mutation/accounts/customization_test.exs b/test/groupher_server_web/mutation/accounts/customization_test.exs index 937076753..04353cc33 100644 --- a/test/groupher_server_web/mutation/accounts/customization_test.exs +++ b/test/groupher_server_web/mutation/accounts/customization_test.exs @@ -58,10 +58,10 @@ defmodule GroupherServer.Test.Mutation.Account.Customization do assert result["customization"]["displayDensity"] == "25" end - @paged_post_query """ - query($filter: PagedArticleFilter!) { + @paged_posts_query """ + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { - entries { + entries { commentsCount commentsParticipators(filter: { first: 5 }) { id @@ -85,7 +85,7 @@ defmodule GroupherServer.Test.Mutation.Account.Customization do user_conn |> mutation_result(@query, variables, "setCustomization") variables = %{filter: %{page: 1}} - results = user_conn |> query_result(@paged_post_query, variables, "pagedPosts") + results = user_conn |> query_result(@paged_posts_query, variables, "pagedPosts") assert results["pageSize"] == @max_page_size end diff --git a/test/groupher_server_web/mutation/cms/cheatsheet_test.exs b/test/groupher_server_web/mutation/cms/cheatsheet_test.exs index 91cdae05f..61a6ea19e 100644 --- a/test/groupher_server_web/mutation/cms/cheatsheet_test.exs +++ b/test/groupher_server_web/mutation/cms/cheatsheet_test.exs @@ -18,7 +18,7 @@ defmodule GroupherServer.Test.Mutation.CMS.Cheatsheet do end @sync_cheatsheet_query """ - mutation($communityId: ID!, $readme: String!, $lastSync: String!){ + mutation($communityId: ID!, $readme: String!, $lastSync: DateTime!){ syncCheatsheet(communityId: $communityId, readme: $readme, lastSync: $lastSync) { id readme diff --git a/test/groupher_server_web/mutation/cms/cms_test.exs b/test/groupher_server_web/mutation/cms/cms_test.exs index c7000108c..7485d0b5a 100644 --- a/test/groupher_server_web/mutation/cms/cms_test.exs +++ b/test/groupher_server_web/mutation/cms/cms_test.exs @@ -744,7 +744,7 @@ defmodule GroupherServer.Test.Mutation.CMS.Basic do describe "[passport]" do @query """ - mutation($userId: ID!, $rules: String!) { + mutation($userId: ID!, $rules: Json!) { stampCmsPassport(userId: $userId, rules: $rules) { id } diff --git a/test/groupher_server_web/mutation/cms/job_reaction_test.exs b/test/groupher_server_web/mutation/cms/job_reaction_test.exs index 8d5a23a5a..9412e069b 100644 --- a/test/groupher_server_web/mutation/cms/job_reaction_test.exs +++ b/test/groupher_server_web/mutation/cms/job_reaction_test.exs @@ -15,7 +15,7 @@ defmodule GroupherServer.Test.Mutation.JobReaction do describe "[job star]" do @query """ - mutation($id: ID!, $action: String!, $thread: CmsThread!) { + mutation($id: ID!, $action: ReactableAction!, $thread: ReactThread!) { reaction(id: $id, action: $action, thread: $thread) { id } @@ -36,7 +36,7 @@ defmodule GroupherServer.Test.Mutation.JobReaction do end @query """ - mutation($id: ID!, $action: String!, $thread: CmsThread!) { + mutation($id: ID!, $action: ReactableAction!, $thread: ReactThread!) { undoReaction(id: $id, action: $action, thread: $thread) { id } diff --git a/test/groupher_server_web/mutation/cms/job_test.exs b/test/groupher_server_web/mutation/cms/job_test.exs index a96d9e585..054ef0621 100644 --- a/test/groupher_server_web/mutation/cms/job_test.exs +++ b/test/groupher_server_web/mutation/cms/job_test.exs @@ -302,7 +302,7 @@ defmodule GroupherServer.Test.Mutation.Job do describe "[mutation job tag]" do @set_tag_query """ - mutation($thread: String!, $id: ID!, $tagId: ID! $communityId: ID!) { + mutation($thread: CmsThread!, $id: ID!, $tagId: ID! $communityId: ID!) { setTag(thread: $thread, id: $id, tagId: $tagId, communityId: $communityId) { id title diff --git a/test/groupher_server_web/mutation/cms/post_reaction_test.exs b/test/groupher_server_web/mutation/cms/post_reaction_test.exs index 9e8dd7b23..e484f0b00 100644 --- a/test/groupher_server_web/mutation/cms/post_reaction_test.exs +++ b/test/groupher_server_web/mutation/cms/post_reaction_test.exs @@ -15,7 +15,7 @@ defmodule GroupherServer.Test.Mutation.PostReaction do describe "[post star]" do @query """ - mutation($id: ID!, $action: String!, $thread: CmsThread!) { + mutation($id: ID!, $action: ReactableAction!, $thread: ReactThread!) { reaction(id: $id, action: $action, thread: $thread) { id } @@ -36,7 +36,7 @@ defmodule GroupherServer.Test.Mutation.PostReaction do end @query """ - mutation($id: ID!, $action: String!, $thread: CmsThread!) { + mutation($id: ID!, $action: ReactableAction!, $thread: ReactThread!) { undoReaction(id: $id, action: $action, thread: $thread) { id } diff --git a/test/groupher_server_web/mutation/cms/video_reaction_test.exs b/test/groupher_server_web/mutation/cms/video_reaction_test.exs index 6faafd616..dd35ed3a9 100644 --- a/test/groupher_server_web/mutation/cms/video_reaction_test.exs +++ b/test/groupher_server_web/mutation/cms/video_reaction_test.exs @@ -15,7 +15,7 @@ defmodule GroupherServer.Test.Mutation.VideoReaction do describe "[video star]" do @query """ - mutation($id: ID!, $action: String!, $thread: CmsThread!) { + mutation($id: ID!, $action: ReactableAction!, $thread: ReactThread!) { reaction(id: $id, action: $action, thread: $thread) { id } @@ -36,7 +36,7 @@ defmodule GroupherServer.Test.Mutation.VideoReaction do end @query """ - mutation($id: ID!, $action: String!, $thread: CmsThread!) { + mutation($id: ID!, $action: ReactableAction!, $thread: ReactThread!) { undoReaction(id: $id, action: $action, thread: $thread) { id } diff --git a/test/groupher_server_web/mutation/cms/video_test.exs b/test/groupher_server_web/mutation/cms/video_test.exs index 9e35e48e5..fefe0d645 100644 --- a/test/groupher_server_web/mutation/cms/video_test.exs +++ b/test/groupher_server_web/mutation/cms/video_test.exs @@ -27,7 +27,7 @@ defmodule GroupherServer.Test.Mutation.Video do $link: String!, $originalAuthor: String!, $originalAuthorLink: String!, - $publishAt: String!, + $publishAt: DateTime!, $communityId: ID!, $tags: [Ids] ) { @@ -86,7 +86,7 @@ defmodule GroupherServer.Test.Mutation.Video do $link: String $originalAuthor: String $originalAuthorLink: String - $publishAt: String + $publishAt: DateTime, $tags: [Ids] ) { updateVideo( @@ -195,7 +195,7 @@ defmodule GroupherServer.Test.Mutation.Video do describe "[mutation video tag]" do @set_tag_query """ - mutation($thread: String!, $id: ID!, $tagId: ID! $communityId: ID!) { + mutation($thread: CmsThread!, $id: ID!, $tagId: ID! $communityId: ID!) { setTag(thread: $thread, id: $id, tagId: $tagId, communityId: $communityId) { id title diff --git a/test/groupher_server_web/mutation/cms/wiki_test.exs b/test/groupher_server_web/mutation/cms/wiki_test.exs index 65b760818..387d12d98 100644 --- a/test/groupher_server_web/mutation/cms/wiki_test.exs +++ b/test/groupher_server_web/mutation/cms/wiki_test.exs @@ -18,7 +18,7 @@ defmodule GroupherServer.Test.Mutation.CMS.Wiki do end @sync_wiki_query """ - mutation($communityId: ID!, $readme: String!, $lastSync: String!){ + mutation($communityId: ID!, $readme: String!, $lastSync: DateTime!){ syncWiki(communityId: $communityId, readme: $readme, lastSync: $lastSync) { id readme diff --git a/test/groupher_server_web/mutation/statistics/statistics_test.exs b/test/groupher_server_web/mutation/statistics/statistics_test.exs index 70c580171..ff289dfb4 100644 --- a/test/groupher_server_web/mutation/statistics/statistics_test.exs +++ b/test/groupher_server_web/mutation/statistics/statistics_test.exs @@ -131,7 +131,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do $link: String!, $originalAuthor: String!, $originalAuthorLink: String!, - $publishAt: String!, + $publishAt: DateTime!, $communityId: ID!, $tags: [Ids] ) { diff --git a/test/groupher_server_web/query/accounts/account_test.exs b/test/groupher_server_web/query/accounts/account_test.exs index ac1159fb1..435031829 100644 --- a/test/groupher_server_web/query/accounts/account_test.exs +++ b/test/groupher_server_web/query/accounts/account_test.exs @@ -296,7 +296,7 @@ defmodule GroupherServer.Test.Query.Account.Basic do end @query """ - query($userId: String, $filter: PagedFilter!) { + query($userId: ID, $filter: PagedFilter!) { subscribedCommunities(userId: $userId, filter: $filter) { entries { title diff --git a/test/groupher_server_web/query/cms/job_comment_test.exs b/test/groupher_server_web/query/cms/job_comment_test.exs index debf4378e..a187b38c3 100644 --- a/test/groupher_server_web/query/cms/job_comment_test.exs +++ b/test/groupher_server_web/query/cms/job_comment_test.exs @@ -329,7 +329,7 @@ defmodule GroupherServer.Test.Query.JobComment do end @query """ - query($thread: CmsThread, $id: ID!, $filter: PagedFilter!) { + query($thread: CmsThread, $id: ID!, $filter: CommentsFilter!) { pagedComments(thread: $thread, id: $id, filter: $filter) { entries { id diff --git a/test/groupher_server_web/query/cms/paged_posts_test.exs b/test/groupher_server_web/query/cms/paged_posts_test.exs index 6faa4ef9b..a9ab25893 100644 --- a/test/groupher_server_web/query/cms/paged_posts_test.exs +++ b/test/groupher_server_web/query/cms/paged_posts_test.exs @@ -39,7 +39,7 @@ defmodule GroupherServer.Test.Query.PagedPosts do describe "[query paged_posts filter pagination]" do @query """ - query($filter: PagedArticleFilter!) { + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { entries { id @@ -87,7 +87,7 @@ defmodule GroupherServer.Test.Query.PagedPosts do describe "[query paged_posts filter sort]" do @query """ - query($filter: PagedArticleFilter!) { + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { entries { id @@ -133,7 +133,7 @@ defmodule GroupherServer.Test.Query.PagedPosts do end @query """ - query($filter: PagedArticleFilter!) { + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { entries { id @@ -156,7 +156,7 @@ defmodule GroupherServer.Test.Query.PagedPosts do describe "[query paged_posts filter read]" do @query """ - query($filter: PagedArticleFilter!) { + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { entries { id @@ -233,7 +233,7 @@ defmodule GroupherServer.Test.Query.PagedPosts do """ describe "[query paged_posts filter when]" do @query """ - query($filter: PagedArticleFilter!) { + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { entries { id diff --git a/test/groupher_server_web/query/cms/post_comment_test.exs b/test/groupher_server_web/query/cms/post_comment_test.exs index e5f4321ac..2ebaf8b82 100644 --- a/test/groupher_server_web/query/cms/post_comment_test.exs +++ b/test/groupher_server_web/query/cms/post_comment_test.exs @@ -16,7 +16,7 @@ defmodule GroupherServer.Test.Query.PostComment do describe "[post dataloader comment]" do @query """ - query($filter: PagedArticleFilter) { + query($filter: PagedPostsFilter) { pagedPosts(filter: $filter) { entries { id @@ -131,7 +131,7 @@ defmodule GroupherServer.Test.Query.PostComment do end @query """ - query($filter: PagedArticleFilter) { + query($filter: PagedPostsFilter) { pagedPosts(filter: $filter) { entries { id @@ -358,7 +358,7 @@ defmodule GroupherServer.Test.Query.PostComment do end @query """ - query($id: ID!, $filter: PagedFilter!) { + query($id: ID!, $filter: CommentsFilter!) { pagedComments(id: $id, filter: $filter) { entries { id @@ -399,7 +399,7 @@ defmodule GroupherServer.Test.Query.PostComment do end @query """ - query($id: ID!, $filter: PagedFilter!) { + query($id: ID!, $filter: CommentsFilter!) { pagedComments(id: $id, filter: $filter) { entries { id @@ -440,7 +440,7 @@ defmodule GroupherServer.Test.Query.PostComment do end @query """ - query($id: ID!, $filter: PagedFilter!) { + query($id: ID!, $filter: CommentsFilter!) { pagedComments(id: $id, filter: $filter) { entries { id diff --git a/test/groupher_server_web/query/cms/post_viewer_test.exs b/test/groupher_server_web/query/cms/post_viewer_test.exs index 1ceb61321..78bc8bf6a 100644 --- a/test/groupher_server_web/query/cms/post_viewer_test.exs +++ b/test/groupher_server_web/query/cms/post_viewer_test.exs @@ -62,7 +62,7 @@ defmodule GroupherServer.Test.Query.PostViewer do end @paged_query """ - query($filter: PagedArticleFilter!) { + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { entries { id diff --git a/test/groupher_server_web/query/cms/posts_flags_test.exs b/test/groupher_server_web/query/cms/posts_flags_test.exs index 99a75cbe4..ae453dc32 100644 --- a/test/groupher_server_web/query/cms/posts_flags_test.exs +++ b/test/groupher_server_web/query/cms/posts_flags_test.exs @@ -35,7 +35,7 @@ defmodule GroupherServer.Test.Query.PostsFlags do describe "[query posts flags]" do @query """ - query($filter: PagedArticleFilter!) { + query($filter: PagedPostsFilter!) { pagedPosts(filter: $filter) { entries { id diff --git a/test/groupher_server_web/query/cms/repo_comment_test.exs b/test/groupher_server_web/query/cms/repo_comment_test.exs index 74f19557e..94f004283 100644 --- a/test/groupher_server_web/query/cms/repo_comment_test.exs +++ b/test/groupher_server_web/query/cms/repo_comment_test.exs @@ -333,7 +333,7 @@ defmodule GroupherServer.Test.Query.RepoComment do end @query """ - query($thread: CmsThread, $id: ID!, $filter: PagedFilter!) { + query($thread: CmsThread, $id: ID!, $filter: CommentsFilter!) { pagedComments(thread: $thread, id: $id, filter: $filter) { entries { id diff --git a/test/groupher_server_web/query/cms/video_comment_test.exs b/test/groupher_server_web/query/cms/video_comment_test.exs index 824996124..bd33d6b9e 100644 --- a/test/groupher_server_web/query/cms/video_comment_test.exs +++ b/test/groupher_server_web/query/cms/video_comment_test.exs @@ -333,7 +333,7 @@ defmodule GroupherServer.Test.Query.VideoComment do end @query """ - query($thread: CmsThread, $id: ID!, $filter: PagedFilter!) { + query($thread: CmsThread, $id: ID!, $filter: CommentsFilter!) { pagedComments(thread: $thread, id: $id, filter: $filter) { entries { id diff --git a/test/support/assert_helper.ex b/test/support/assert_helper.ex index bde2f0a10..6026bb1c5 100644 --- a/test/support/assert_helper.ex +++ b/test/support/assert_helper.ex @@ -120,7 +120,7 @@ defmodule GroupherServer.Test.AssertHelper do |> post("/graphiql", query: query, variables: variables) |> json_response(200) - # |> IO.inspect(label: "debug") + # IO.inspect(resp, label: "debug") case resp |> Map.has_key?("errors") do true -> From a4345ee02860fb9dda37461d91ade8694e4c01e5 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 3 Feb 2021 18:40:40 +0800 Subject: [PATCH 3/5] chore(deps): upgrade absinthe to 1.6 :tada: --- mix.exs | 2 +- mix.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 404f5c9a1..e3b752cdf 100644 --- a/mix.exs +++ b/mix.exs @@ -62,7 +62,7 @@ defmodule GroupherServer.Mixfile do {:plug_cowboy, "~> 2.4.1"}, {:plug, "~> 1.11.0"}, # GraphQl tool - {:absinthe, "~> 1.5.5"}, + {:absinthe, "~> 1.6.1"}, # Plug support for Absinthe {:absinthe_plug, "~> 1.5.4"}, # Password hashing lib diff --git a/mix.lock b/mix.lock index 979731564..5aad3aba5 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,5 @@ %{ - "absinthe": {:hex, :absinthe, "1.5.5", "22b26228f56dc6a1074c52cea9c64e869a0cb2427403bcf9056c422d36c66292", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "41e79ed4bffbab4986493ff4120c948d59871fd08ad5e31195129ce3c01aad58"}, + "absinthe": {:hex, :absinthe, "1.6.1", "07bd1636027595c8d00d250a5878e617c24ccb25c84a08e807d8d00cf124696c", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f0105f1de6176ca50789081f2465389cb7afa438d54bf5133aeb3549f8f629f6"}, "absinthe_ecto": {:hex, :absinthe_ecto, "0.1.3", "420b68129e79fe4571a4838904ba03e282330d335da47729ad52ffd7b8c5fcb1", [:mix], [{:absinthe, "~> 1.3.0 or ~> 1.4.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:ecto, ">= 0.0.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "355b9db34abfab96ae1e025434b66e11002babcf4fe6b7144d26ff7548985f52"}, "absinthe_plug": {:hex, :absinthe_plug, "1.5.4", "daff02d04be7c06d0114ef5b4361865a4dacbe8ddb325ce709b103253d4a014b", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "80360cd8ad541d87c75336f3abc59b894d474458f6a7f8e563781c01148860de"}, "apollo_tracing": {:hex, :apollo_tracing, "0.4.3", "6bc56132f4ab87223b10dc7ab91bf4374ba4033411ba80873f9f89caf15d7476", [:mix], [{:absinthe, "~> 1.4", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.4", [hex: :absinthe_plug, repo: "hexpm", optional: true]}, {:jason, "~> 1.1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "150077363f588fa6881b77f936d7e671cfcaf6f6b4783b7682f6705c898bfc53"}, From cfe19ea6282054f87f21de3c9e18eed1dddc398d Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 3 Feb 2021 18:45:43 +0800 Subject: [PATCH 4/5] chore(clean up): unused variables --- lib/groupher_server/mailer/email.ex | 3 +-- lib/groupher_server_web/controller/og_controller.ex | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/groupher_server/mailer/email.ex b/lib/groupher_server/mailer/email.ex index 83e945529..b3bc3b2ca 100644 --- a/lib/groupher_server/mailer/email.ex +++ b/lib/groupher_server/mailer/email.ex @@ -7,11 +7,10 @@ defmodule GroupherServer.Email do import Bamboo.Email import Helper.Utils, only: [get_config: 2] - alias GroupherServer.{Accounts, Billing, CMS, Email, Mailer} + alias GroupherServer.{Accounts, Billing, Email, Mailer} alias Accounts.User alias Billing.BillRecord - # alias CMS.{Post, Job, Repo, Video} alias Email.Templates alias Mailer diff --git a/lib/groupher_server_web/controller/og_controller.ex b/lib/groupher_server_web/controller/og_controller.ex index 06e46615a..97569577a 100644 --- a/lib/groupher_server_web/controller/og_controller.ex +++ b/lib/groupher_server_web/controller/og_controller.ex @@ -26,7 +26,7 @@ defmodule GroupherServerWeb.Controller.OG do error_response(conn, url) end - defp ok_response(conn, url, %OpenGraph{title: nil, description: description} = info) + defp ok_response(conn, _url, %OpenGraph{title: nil, description: description} = info) when not is_nil(description) do json(conn, %{ success: 1, @@ -40,7 +40,7 @@ defmodule GroupherServerWeb.Controller.OG do }) end - defp ok_response(conn, url, info) do + defp ok_response(conn, _url, info) do json(conn, %{ success: 1, meta: %{ From d70888f8b3e9923210c85281f71e6a18d6dade9e Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 3 Feb 2021 18:46:23 +0800 Subject: [PATCH 5/5] fix(absinthe): schema desc helper typo --- .../schema/account/account_queries.ex | 6 ++-- .../schema/account/account_types.ex | 34 +++++++++---------- .../schema/cms/cms_types.ex | 8 ++--- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/groupher_server_web/schema/account/account_queries.ex b/lib/groupher_server_web/schema/account/account_queries.ex index 4cabcf16e..480c153d0 100644 --- a/lib/groupher_server_web/schema/account/account_queries.ex +++ b/lib/groupher_server_web/schema/account/account_queries.ex @@ -71,7 +71,7 @@ defmodule GroupherServerWeb.Schema.Account.Queries do resolve(&R.Accounts.list_favorite_categories/3) end - @doc "paged stared posts" + @desc "paged stared posts" field :stared_posts, :paged_posts do arg(:user_id, non_null(:id)) arg(:filter, non_null(:paged_filter)) @@ -81,7 +81,7 @@ defmodule GroupherServerWeb.Schema.Account.Queries do resolve(&R.Accounts.stared_contents/3) end - @doc "paged stared jobs" + @desc "paged stared jobs" field :stared_jobs, :paged_jobs do arg(:user_id, non_null(:id)) arg(:filter, non_null(:paged_filter)) @@ -91,7 +91,7 @@ defmodule GroupherServerWeb.Schema.Account.Queries do resolve(&R.Accounts.stared_contents/3) end - @doc "paged stared videos" + @desc "paged stared videos" field :stared_videos, :paged_videos do arg(:user_id, non_null(:id)) arg(:filter, non_null(:paged_filter)) diff --git a/lib/groupher_server_web/schema/account/account_types.ex b/lib/groupher_server_web/schema/account/account_types.ex index 1cc34187e..3ade0185f 100644 --- a/lib/groupher_server_web/schema/account/account_types.ex +++ b/lib/groupher_server_web/schema/account/account_types.ex @@ -100,7 +100,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.editable_communities/3) end - @doc "get follower users count" + @desc "get follower users count" field :followers_count, :integer do arg(:count, :count_type, default_value: :count) @@ -108,7 +108,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "get following users count" + @desc "get following users count" field :followings_count, :integer do arg(:count, :count_type, default_value: :count) @@ -116,7 +116,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "wether viewer has followed" + @desc "wether viewer has followed" field :viewer_has_followed, :boolean do arg(:viewer_did, :viewer_did_type, default_value: :viewer_did) @@ -126,7 +126,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ViewerDidConvert) end - @doc "paged stared posts" + @desc "paged stared posts" field :stared_posts, :paged_posts do arg(:filter, non_null(:paged_filter)) arg(:thread, :post_thread, default_value: :post) @@ -135,7 +135,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.stared_contents/3) end - @doc "paged stared jobs" + @desc "paged stared jobs" field :stared_jobs, :paged_jobs do arg(:filter, non_null(:paged_filter)) arg(:thread, :job_thread, default_value: :job) @@ -144,7 +144,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.stared_contents/3) end - @doc "paged stared videos" + @desc "paged stared videos" field :stared_videos, :paged_videos do arg(:filter, non_null(:paged_filter)) arg(:thread, :video_thread, default_value: :video) @@ -153,7 +153,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.stared_contents/3) end - @doc "paged favorited posts" + @desc "paged favorited posts" field :favorited_posts, :paged_posts do arg(:filter, non_null(:paged_filter)) arg(:thread, :post_thread, default_value: :post) @@ -162,7 +162,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.favorited_contents/3) end - @doc "paged favorited jobs" + @desc "paged favorited jobs" field :favorited_jobs, :paged_jobs do arg(:filter, non_null(:paged_filter)) arg(:thread, :job_thread, default_value: :job) @@ -171,7 +171,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.favorited_contents/3) end - @doc "paged favorited videos" + @desc "paged favorited videos" field :favorited_videos, :paged_videos do arg(:filter, non_null(:paged_filter)) arg(:thread, :video_thread, default_value: :video) @@ -180,7 +180,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.favorited_contents/3) end - @doc "paged favorited repos" + @desc "paged favorited repos" field :favorited_repos, :paged_repos do arg(:filter, non_null(:paged_filter)) arg(:thread, :repo_thread, default_value: :repo) @@ -189,7 +189,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do resolve(&R.Accounts.favorited_contents/3) end - @doc "total count of stared posts count" + @desc "total count of stared posts count" field :stared_posts_count, :integer do arg(:count, :count_type, default_value: :count) @@ -197,7 +197,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "total count of stared jobs count" + @desc "total count of stared jobs count" field :stared_jobs_count, :integer do arg(:count, :count_type, default_value: :count) @@ -205,7 +205,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "total count of stared videos count" + @desc "total count of stared videos count" field :stared_videos_count, :integer do arg(:count, :count_type, default_value: :count) @@ -213,7 +213,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "total count of favorited posts count" + @desc "total count of favorited posts count" field :favorited_posts_count, :integer do arg(:count, :count_type, default_value: :count) @@ -221,7 +221,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "total count of favorited jobs count" + @desc "total count of favorited jobs count" field :favorited_jobs_count, :integer do arg(:count, :count_type, default_value: :count) @@ -229,7 +229,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "total count of favorited videos count" + @desc "total count of favorited videos count" field :favorited_videos_count, :integer do arg(:count, :count_type, default_value: :count) @@ -237,7 +237,7 @@ defmodule GroupherServerWeb.Schema.Account.Types do middleware(M.ConvertToInt) end - @doc "total count of favorited videos count" + @desc "total count of favorited videos count" field :favorited_repos_count, :integer do arg(:count, :count_type, default_value: :count) diff --git a/lib/groupher_server_web/schema/cms/cms_types.ex b/lib/groupher_server_web/schema/cms/cms_types.ex index 7647fd59b..3a1e64ef6 100644 --- a/lib/groupher_server_web/schema/cms/cms_types.ex +++ b/lib/groupher_server_web/schema/cms/cms_types.ex @@ -267,16 +267,16 @@ defmodule GroupherServerWeb.Schema.CMS.Types do field(:threads, list_of(:thread), resolve: dataloader(CMS, :threads)) field(:categories, list_of(:category), resolve: dataloader(CMS, :categories)) - @doc "total count of post contents" + @desc "total count of post contents" content_counts_field(:post, CMS.Post) - @doc "total count of job contents" + @desc "total count of job contents" content_counts_field(:job, CMS.Job) - @doc "total count of video contents" + @desc "total count of video contents" content_counts_field(:video, CMS.Video) - @doc "total count of repo contents" + @desc "total count of repo contents" content_counts_field(:repo, CMS.Repo) field :subscribers, list_of(:user) do