From ae5a28fadc120662faa227fc4eaa4c8d7c9bb0c7 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Wed, 2 Jun 2021 18:08:56 -0700 Subject: [PATCH] tmp --- amanuensis/backend/index.py | 30 ++++++++++++++++++++++++++++++ tests/test_index.py | 0 2 files changed, 30 insertions(+) create mode 100644 amanuensis/backend/index.py create mode 100644 tests/test_index.py diff --git a/amanuensis/backend/index.py b/amanuensis/backend/index.py new file mode 100644 index 0000000..bdd8ac5 --- /dev/null +++ b/amanuensis/backend/index.py @@ -0,0 +1,30 @@ +""" +Membership query interface +""" + +from amanuensis.db import DbContext, ArticleIndex, IndexType +from amanuensis.errors import ArgumentError + + +def create( + db: DbContext, + lexicon_id: int, + index_type: IndexType, + pattern: str, + logical_order: int, + display_order: int, + capacity: int) -> ArticleIndex: + """ + """ + + new_index = ArticleIndex( + lexicon_id=lexicon_id, + index_type=index_type, + pattern=pattern, + logical_order=logical_order, + display_order=display_order, + capacity=capacity, + ) + db.session.add(new_index) + db.session.commit() + return new_index diff --git a/tests/test_index.py b/tests/test_index.py new file mode 100644 index 0000000..e69de29