This repository was archived by the owner on Nov 8, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork20
refactor(reaction): fields test kit#343
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
4 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletioncover/excoveralls.json
Large diffs are not rendered by default.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
2 changes: 1 addition & 1 deletionlib/groupher_server/accounts/delegates/collect_folder.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/accounts/delegates/publish.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/accounts/delegates/upvoted_articles.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/accounts/utils/loader.ex → ...groupher_server/accounts/helper/loader.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defmodule GroupherServer.Accounts.Helper.Loader do | ||
@moduledoc """ | ||
dataloader for accounts | ||
""" | ||
2 changes: 1 addition & 1 deletionlib/groupher_server/accounts/user.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/abuse_report.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/article_comment.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/article_comment_action.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionslib/groupher_server/cms/delegates/article_curd.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionslib/groupher_server/cms/delegates/article_operation.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/article_reaction.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/comment_curd.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/community_curd.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/seeds.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/utils/loader.ex → lib/groupher_server/cms/helper/loader.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defmodule GroupherServer.CMS.Helper.Loader do | ||
@moduledoc """ | ||
dataloader for cms context | ||
""" | ||
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/utils/matcher.ex → lib/groupher_server/cms/helper/matcher.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/utils/matcher2.ex → lib/groupher_server/cms/helper/matcher2.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server_web/middleware/passport_loader.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server_web/resolvers/cms_resolver.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletionslib/groupher_server_web/schema.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
42 changes: 1 addition & 41 deletions...roupher_server_web/schema/utils/helper.ex → ...oupher_server_web/schema/Helper/fields.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions...r_server_web/schema/utils/common_types.ex → ...upher_server_web/schema/Helper/metrics.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletionslib/groupher_server_web/schema/Helper/mutations.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule GroupherServerWeb.Schema.Helper.Mutations do | ||
@moduledoc """ | ||
common fields | ||
""" | ||
alias GroupherServerWeb.Middleware, as: M | ||
alias GroupherServerWeb.Resolvers, as: R | ||
defmacro article_upvote_mutation(thread) do | ||
quote do | ||
@desc unquote("upvote to #{thread}") | ||
field unquote(:"upvote_#{thread}"), :article do | ||
arg(:id, non_null(:id)) | ||
arg(:thread, unquote(:"#{thread}_thread"), default_value: unquote(thread)) | ||
middleware(M.Authorize, :login) | ||
resolve(&R.CMS.upvote_article/3) | ||
end | ||
@desc unquote("undo upvote to #{thread}") | ||
field unquote(:"undo_upvote_#{thread}"), :article do | ||
arg(:id, non_null(:id)) | ||
arg(:thread, unquote(:"#{thread}_thread"), default_value: unquote(thread)) | ||
middleware(M.Authorize, :login) | ||
resolve(&R.CMS.undo_upvote_article/3) | ||
end | ||
end | ||
end | ||
end |
47 changes: 47 additions & 0 deletionslib/groupher_server_web/schema/Helper/queries.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
defmodule GroupherServerWeb.Schema.Helper.Queries do | ||
@moduledoc """ | ||
common fields | ||
""" | ||
alias GroupherServerWeb.Middleware, as: M | ||
alias GroupherServerWeb.Resolvers, as: R | ||
@doc """ | ||
query generator for threads, like: | ||
post, page_posts ... | ||
""" | ||
defmacro article_queries(thread) do | ||
quote do | ||
@desc unquote("get #{thread} by id") | ||
field unquote(thread), non_null(unquote(thread)) do | ||
arg(:id, non_null(:id)) | ||
arg(:thread, unquote(:"#{thread}_thread"), default_value: unquote(thread)) | ||
resolve(&R.CMS.read_article/3) | ||
end | ||
@desc unquote("get paged #{thread}s") | ||
field unquote(:"paged_#{thread}s"), unquote(:"paged_#{thread}s") do | ||
arg(:thread, unquote(:"#{thread}_thread"), default_value: unquote(thread)) | ||
arg(:filter, non_null(unquote(:"paged_#{thread}s_filter"))) | ||
middleware(M.PageSizeProof) | ||
resolve(&R.CMS.paged_articles/3) | ||
end | ||
end | ||
end | ||
defmacro article_reacted_users_query(action, resolver) do | ||
quote do | ||
@desc unquote("get paged #{action}ed users of an article") | ||
field unquote(:"#{action}ed_users"), :paged_users do | ||
arg(:id, non_null(:id)) | ||
arg(:thread, :cms_thread, default_value: :post) | ||
arg(:filter, non_null(:paged_filter)) | ||
middleware(M.PageSizeProof) | ||
resolve(unquote(resolver)) | ||
end | ||
end | ||
end | ||
end |
2 changes: 1 addition & 1 deletionlib/groupher_server_web/schema/account/account_misc.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server_web/schema/account/account_types.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server_web/schema/billing/billing_types.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletionlib/groupher_server_web/schema/cms/cms_misc.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server_web/schema/cms/cms_queries.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlib/groupher_server_web/schema/cms/cms_types.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.