Skip to content

Commit

Permalink
Allow deleting comments
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Jan 24, 2025
1 parent 985cd9c commit 18f6d92
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions validation_service_api/validation_service/resources/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,19 @@ async def update_comment(
)

return Comment.from_kg_object(original_comment, kg_user_client)


@router.delete("/comments/{comment_id}")
async def delete_comment(
comment_id: UUID = Path(
..., title="Comment ID", description="ID of the comment to be deleted"
),
token: HTTPAuthorizationCredentials = Depends(auth),
):
"""Delete a specific comment identified by a UUID"""
kg_user_client = get_kg_client_for_user_account(token)
response = kg_user_client.delete_instance(comment_id, ignore_not_found=True, ignore_errors=True)
if response: # error
logger.error(str(response))
# todo: better error handling
return None

0 comments on commit 18f6d92

Please sign in to comment.