diff options
author | Munyoki Kilyungi | 2024-09-17 15:21:57 +0300 |
---|---|---|
committer | John Nduli Kilyungi | 2024-09-18 08:32:34 +0300 |
commit | 92b4f53505d53da2e5a163d5bb94dc7ef75b27ae (patch) | |
tree | b22d310a9a27bd21c79003b12b266d7dbb7bd33c /gn3/api/metadata_api | |
parent | 32feb9075573c96736c1e8db3fb1307373e63dcf (diff) | |
download | genenetwork3-92b4f53505d53da2e5a163d5bb94dc7ef75b27ae.tar.gz |
Update "POST /wiki/comment_id/edit" to have RDF edits.
* gn3/api/metadata_api/wiki.py: Import update_wiki_comment.
(edit_wiki): Update wiki in RDF.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/api/metadata_api')
-rw-r--r-- | gn3/api/metadata_api/wiki.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gn3/api/metadata_api/wiki.py b/gn3/api/metadata_api/wiki.py index 0b91ce0..7595993 100644 --- a/gn3/api/metadata_api/wiki.py +++ b/gn3/api/metadata_api/wiki.py @@ -8,8 +8,11 @@ from flask import Blueprint, request, jsonify, current_app, make_response from gn3 import db_utils from gn3.auth.authorisation.oauth2.resource_server import require_oauth from gn3.db import wiki -from gn3.db.rdf.wiki import (get_wiki_entries_by_symbol, - get_comment_history) +from gn3.db.rdf.wiki import ( + get_wiki_entries_by_symbol, + get_comment_history, + update_wiki_comment, +) wiki_blueprint = Blueprint("wiki", __name__, url_prefix="wiki") @@ -68,6 +71,18 @@ def edit_wiki(comment_id: int): category_addition_query, (comment_id, insert_dict["versionId"], cat_id) ) + + # Editing RDF: + update_wiki_comment( + comment_id=comment_id, + payload=payload, + sparql_conf={ + "sparql_uri": current_app.config["SPARQL_ENDPOINT"], + "sparql_user": current_app.config["SPARQL_USER"], + "sparql_password": current_app.config["SPARQL_PASSWORD"], + "sparql_auth_uri": current_app.config["SPARQL_AUTH_URI"], + }, + ) return jsonify({"success": "ok"}) return jsonify(error="Error editing wiki entry, most likely due to DB error!"), 500 |