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

Commit 61fdc89

Browse files
committed
refactor(schema): wip
1 parent 0552741 commit 61fdc89

File tree

1 file changed

+6
-9
lines changed
  • lib/groupher_server_web/schema/Helper

1 file changed

+6
-9
lines changed

lib/groupher_server_web/schema/Helper/fields.ex

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,14 @@ defmodule GroupherServerWeb.Schema.Helper.Fields do
8181
general emotion enum for articles
8282
#NOTE: xxx_user_logins field is not support for gq-endpoint
8383
"""
84-
defmacro emotion_values() do
85-
@emotions
86-
|> Enum.map(
87-
&quote do
88-
value(unquote(:"#{&1}"))
84+
defmacro emotion_values(metric \\ :article) do
85+
emotions =
86+
case metric do
87+
:comment -> @comment_emotions
88+
_ -> @emotions
8989
end
90-
)
91-
end
9290

93-
defmacro emotion_values(:comment) do
94-
@emotions
91+
emotions
9592
|> Enum.map(
9693
&quote do
9794
value(unquote(:"#{&1}"))

0 commit comments

Comments
 (0)