Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 1df4ba4

Browse files
committed
chore(radar): use article_react_mutations
1 parent 744a481 commit 1df4ba4

File tree

7 files changed

+47
-53
lines changed

7 files changed

+47
-53
lines changed

lib/groupher_server_web/schema/Helper/mutations.ex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
5151
upvote_[thread]
5252
unto_emotion_[thread]
5353
"""
54-
defmacro article_upvote_mutation(thread) do
54+
defmacrop article_upvote_mutation(thread) do
5555
quote do
5656
@desc unquote("upvote to #{thread}")
5757
field unquote(:"upvote_#{thread}"), :article do
@@ -81,7 +81,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
8181
pin_[thread]
8282
unto_pin_[thread]
8383
"""
84-
defmacro article_pin_mutation(thread) do
84+
defmacrop article_pin_mutation(thread) do
8585
quote do
8686
@desc unquote("pin to #{thread}")
8787
field unquote(:"pin_#{thread}"), unquote(thread) do
@@ -117,7 +117,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
117117
mark_delete_[thread]
118118
unto_mark_delete_[thread]
119119
"""
120-
defmacro article_mark_delete_mutation(thread) do
120+
defmacrop article_mark_delete_mutation(thread) do
121121
quote do
122122
@desc unquote("mark delete a #{thread} type article, aka soft-delete")
123123
field unquote(:"mark_delete_#{thread}"), unquote(thread) do
@@ -152,7 +152,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
152152
mark_delete_[thread]
153153
"""
154154
# TODO: if post belongs to multi communities, unset instead delete
155-
defmacro article_delete_mutation(thread) do
155+
defmacrop article_delete_mutation(thread) do
156156
quote do
157157
@desc unquote("delete a #{thread}, not delete")
158158
field unquote(:"delete_#{thread}"), unquote(thread) do
@@ -175,7 +175,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
175175
emotion_to_[thread]
176176
unto_emotion_to_[thread]
177177
"""
178-
defmacro article_emotion_mutation(thread) do
178+
defmacrop article_emotion_mutation(thread) do
179179
quote do
180180
@desc unquote("emotion to #{thread}")
181181
field unquote(:"emotion_to_#{thread}"), unquote(thread) do
@@ -207,7 +207,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
207207
report_[thread]
208208
undo_report_[thread]
209209
"""
210-
defmacro article_report_mutation(thread) do
210+
defmacrop article_report_mutation(thread) do
211211
quote do
212212
@desc unquote("report a #{thread}")
213213
field unquote(:"report_#{thread}"), unquote(thread) do
@@ -239,7 +239,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
239239
sink_[thread]
240240
undo_sink_[thread]
241241
"""
242-
defmacro article_sink_mutation(thread) do
242+
defmacrop article_sink_mutation(thread) do
243243
quote do
244244
@desc unquote("sink a #{thread}")
245245
field unquote(:"sink_#{thread}"), :article do
@@ -275,7 +275,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
275275
lock_[thread]_comment
276276
undo_lock_[thread]_comment
277277
"""
278-
defmacro article_lock_comment_mutation(thread) do
278+
defmacrop article_lock_comment_mutation(thread) do
279279
quote do
280280
@desc unquote("lock comment of a #{thread}")
281281
field unquote(:"lock_#{thread}_comment"), :article do

lib/groupher_server_web/schema/cms/mutations/blog.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Blog do
4343
resolve(&R.CMS.update_article/3)
4444
end
4545

46-
#############
47-
article_upvote_mutation(:blog)
48-
article_pin_mutation(:blog)
49-
article_mark_delete_mutation(:blog)
50-
article_delete_mutation(:blog)
51-
article_emotion_mutation(:blog)
52-
article_report_mutation(:blog)
53-
article_sink_mutation(:blog)
54-
article_lock_comment_mutation(:blog)
55-
#############
46+
article_react_mutations(:blog, [
47+
:upvote,
48+
:pin,
49+
:mark_delete,
50+
:delete,
51+
:emotion,
52+
:report,
53+
:sink,
54+
:lock_comment
55+
])
5656
end
5757
end

lib/groupher_server_web/schema/cms/mutations/job.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Job do
5353
resolve(&R.CMS.update_article/3)
5454
end
5555

56-
#############
57-
article_upvote_mutation(:job)
58-
article_pin_mutation(:job)
59-
article_mark_delete_mutation(:job)
60-
article_delete_mutation(:job)
61-
article_emotion_mutation(:job)
62-
article_report_mutation(:job)
63-
article_sink_mutation(:job)
64-
article_lock_comment_mutation(:job)
65-
#############
56+
article_react_mutations(:job, [
57+
:upvote,
58+
:pin,
59+
:mark_delete,
60+
:delete,
61+
:emotion,
62+
:report,
63+
:sink,
64+
:lock_comment
65+
])
6666
end
6767
end

lib/groupher_server_web/schema/cms/mutations/post.ex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Post do
4343
resolve(&R.CMS.update_article/3)
4444
end
4545

46-
#############
47-
article_upvote_mutation(:post)
48-
article_pin_mutation(:post)
49-
article_mark_delete_mutation(:post)
50-
article_delete_mutation(:post)
51-
article_emotion_mutation(:post)
52-
article_report_mutation(:post)
53-
article_sink_mutation(:post)
54-
article_lock_comment_mutation(:post)
55-
#############
46+
article_react_mutations(:post, [
47+
:upvote,
48+
:pin,
49+
:mark_delete,
50+
:delete,
51+
:emotion,
52+
:report,
53+
:sink,
54+
:lock_comment
55+
])
5656
end
5757
end

lib/groupher_server_web/schema/cms/mutations/radar.ex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Radar do
3838
resolve(&R.CMS.update_article/3)
3939
end
4040

41-
#############
4241
article_react_mutations(:radar, [
4342
:upvote,
4443
:pin,
@@ -49,7 +48,5 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Radar do
4948
:sink,
5049
:lock_comment
5150
])
52-
53-
#############
5451
end
5552
end

lib/groupher_server_web/schema/cms/mutations/repo.ex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Repo do
7070
resolve(&R.CMS.update_article/3)
7171
end
7272

73-
#############
74-
article_pin_mutation(:repo)
75-
article_mark_delete_mutation(:repo)
76-
article_delete_mutation(:repo)
77-
article_emotion_mutation(:repo)
78-
article_report_mutation(:repo)
79-
article_sink_mutation(:repo)
80-
article_lock_comment_mutation(:repo)
81-
#############
73+
article_react_mutations(:repo, [
74+
:pin,
75+
:mark_delete,
76+
:delete,
77+
:emotion,
78+
:report,
79+
:sink,
80+
:lock_comment
81+
])
8282
end
8383
end

lib/groupher_server_web/schema/cms/mutations/works.ex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Works do
3838
resolve(&R.CMS.update_article/3)
3939
end
4040

41-
#############
4241
article_react_mutations(:works, [
4342
:upvote,
4443
:pin,
@@ -49,7 +48,5 @@ defmodule GroupherServerWeb.Schema.CMS.Mutations.Works do
4948
:sink,
5049
:lock_comment
5150
])
52-
53-
#############
5451
end
5552
end

0 commit comments

Comments
 (0)