Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit733170e

Browse files
committed
chore(radar): use article_react_mutations
1 parent1df4ba4 commit733170e

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

‎lib/groupher_server_web/schema/Helper/mutations.ex‎

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,16 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
22
@moduledoc"""
33
general mutations used for articles
44
5+
can not dedefine private macros, see:
6+
https://github.com/elixir-lang/elixir/issues/3887
7+
58
e.g:
69
in schema/cms/mutation/post.ex
710
811
add following:
9-
article_upvote_mutation(:post)
10-
11-
post will have two mutation endpoint:
12-
13-
upvote_post
14-
unto_emotion_post
15-
16-
same for the job/repo .. article thread
17-
"""
18-
aliasGroupherServerWeb.Middleware,as:M
19-
aliasGroupherServerWeb.Resolvers,as:R
12+
article_react_mutations(:post, [:upvote, :pin, :mark_delete, :delete, :emotion, :report, :sink, :lock_comment])
2013
21-
@doc"""
22-
e.g:
23-
24-
turn:
25-
article_react_mutations(:radar, [:upvote, :pin, :mark_delete, :delete, :emotion, :report, :sink, :lock_comment])
26-
27-
into:
14+
it will expand as
2815
article_upvote_mutation(:radar)
2916
article_pin_mutation(:radar)
3017
article_mark_delete_mutation(:radar)
@@ -33,6 +20,14 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
3320
article_report_mutation(:radar)
3421
article_sink_mutation(:radar)
3522
article_lock_comment_mutation(:radar)
23+
24+
same for the job/repo .. article thread
25+
"""
26+
aliasGroupherServerWeb.Middleware,as:M
27+
aliasGroupherServerWeb.Resolvers,as:R
28+
29+
@doc"""
30+
add basic mutation reactions to article
3631
"""
3732
defmacroarticle_react_mutations(thread,reactions)do
3833
reactions
@@ -51,7 +46,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
5146
upvote_[thread]
5247
unto_emotion_[thread]
5348
"""
54-
defmacroparticle_upvote_mutation(thread)do
49+
defmacroarticle_upvote_mutation(thread)do
5550
quotedo
5651
@descunquote("upvote to#{thread}")
5752
fieldunquote(:"upvote_#{thread}"),:articledo
@@ -81,7 +76,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
8176
pin_[thread]
8277
unto_pin_[thread]
8378
"""
84-
defmacroparticle_pin_mutation(thread)do
79+
defmacroarticle_pin_mutation(thread)do
8580
quotedo
8681
@descunquote("pin to#{thread}")
8782
fieldunquote(:"pin_#{thread}"),unquote(thread)do
@@ -117,7 +112,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
117112
mark_delete_[thread]
118113
unto_mark_delete_[thread]
119114
"""
120-
defmacroparticle_mark_delete_mutation(thread)do
115+
defmacroarticle_mark_delete_mutation(thread)do
121116
quotedo
122117
@descunquote("mark delete a#{thread} type article, aka soft-delete")
123118
fieldunquote(:"mark_delete_#{thread}"),unquote(thread)do
@@ -152,7 +147,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
152147
mark_delete_[thread]
153148
"""
154149
# TODO: if post belongs to multi communities, unset instead delete
155-
defmacroparticle_delete_mutation(thread)do
150+
defmacroarticle_delete_mutation(thread)do
156151
quotedo
157152
@descunquote("delete a#{thread}, not delete")
158153
fieldunquote(:"delete_#{thread}"),unquote(thread)do
@@ -175,7 +170,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
175170
emotion_to_[thread]
176171
unto_emotion_to_[thread]
177172
"""
178-
defmacroparticle_emotion_mutation(thread)do
173+
defmacroarticle_emotion_mutation(thread)do
179174
quotedo
180175
@descunquote("emotion to#{thread}")
181176
fieldunquote(:"emotion_to_#{thread}"),unquote(thread)do
@@ -207,7 +202,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
207202
report_[thread]
208203
undo_report_[thread]
209204
"""
210-
defmacroparticle_report_mutation(thread)do
205+
defmacroarticle_report_mutation(thread)do
211206
quotedo
212207
@descunquote("report a#{thread}")
213208
fieldunquote(:"report_#{thread}"),unquote(thread)do
@@ -239,7 +234,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
239234
sink_[thread]
240235
undo_sink_[thread]
241236
"""
242-
defmacroparticle_sink_mutation(thread)do
237+
defmacroarticle_sink_mutation(thread)do
243238
quotedo
244239
@descunquote("sink a#{thread}")
245240
fieldunquote(:"sink_#{thread}"),:articledo
@@ -275,7 +270,7 @@ defmodule GroupherServerWeb.Schema.Helper.Mutations do
275270
lock_[thread]_comment
276271
undo_lock_[thread]_comment
277272
"""
278-
defmacroparticle_lock_comment_mutation(thread)do
273+
defmacroarticle_lock_comment_mutation(thread)do
279274
quotedo
280275
@descunquote("lock comment of a#{thread}")
281276
fieldunquote(:"lock_#{thread}_comment"),:articledo

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp