about summary refs log tree commit diff
path: root/gn3/db/wiki.py
diff options
context:
space:
mode:
authorMunyoki Kilyungi2025-01-20 19:58:44 +0300
committerBonfaceKilz2025-01-21 08:46:02 +0300
commita5095460a2ea2c2d9ec9e26930acd79edbea3679 (patch)
treee966c94278fc5e0f9f07a75f208000708ae4f1e1 /gn3/db/wiki.py
parent5d2aebb8c1e3af7751a7b23d3467c63006395c58 (diff)
downloadgenenetwork3-a5095460a2ea2c2d9ec9e26930acd79edbea3679.tar.gz
Enable new inserts of new wiki entries.
* gn3/api/metadata_api/wiki.py: Import Optional
(edit_wiki): Add "/edit" route.  Add new comment id.
* gn3/db/wiki.py (get_next_comment_id): New function for fetching the
getting the next comment_id.

Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/db/wiki.py')
-rw-r--r--gn3/db/wiki.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gn3/db/wiki.py b/gn3/db/wiki.py
index 0f46855..2e12230 100644
--- a/gn3/db/wiki.py
+++ b/gn3/db/wiki.py
@@ -70,6 +70,14 @@ def get_next_comment_version(cursor, comment_id: int) -> int:
     return latest_version + 1
 
 
+def get_next_comment_id(cursor) -> int:
+    """Get the next GeneRIF.Id"""
+    cursor.execute(
+        "SELECT MAX(Id) from GeneRIF"
+    )
+    return cursor.fetchone()[0] + 1
+
+
 def get_categories_ids(cursor, categories: List[str]) -> List[int]:
     """Get the categories_ids from a list of category strings"""
     dict_cats = get_categories(cursor)