Move API under GraphQL context

This commit is contained in:
rustra
2020-01-26 21:11:16 +01:00
parent ba3ad713c0
commit b3f8d52bc9
25 changed files with 56 additions and 58 deletions

View File

@@ -0,0 +1,30 @@
defmodule Mobilizon.GraphQL.API.Comments do
@moduledoc """
API for Comments.
"""
alias Mobilizon.Events.Comment
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Activity
@doc """
Create a comment
Creates a comment from an actor
"""
@spec create_comment(map) :: {:ok, Activity.t(), Comment.t()} | any
def create_comment(args) do
ActivityPub.create(:comment, args, true)
end
@doc """
Deletes a comment
Deletes a comment from an actor
"""
@spec delete_comment(Comment.t()) :: {:ok, Activity.t(), Comment.t()} | any
def delete_comment(%Comment{} = comment) do
ActivityPub.delete(comment, true)
end
end