Skip to content

Instantly share code, notes, and snippets.

@marinho10
Created April 27, 2020 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marinho10/d0806466096583ffac76fb7ca2257ce1 to your computer and use it in GitHub Desktop.
Save marinho10/d0806466096583ffac76fb7ca2257ce1 to your computer and use it in GitHub Desktop.
object :accounts_subscriptions do
field :accounts_user_count, :integer do
config(fn
_args, %{context: %{current_user: %{id: user_id}}} ->
{:ok, topic: "user_count:#{user_id}"}
_args, _context ->
{:error, Responses.get(:user_unauthorized)}
end)
resolve(fn value, _, _res ->
{:ok, value}
end)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment