Add backend functions for a basic dashboard

This commit is contained in:
Tim Van Baak 2021-06-15 20:31:51 -07:00
parent e097917633
commit d8d20f4224
2 changed files with 12 additions and 1 deletions

View File

@ -3,6 +3,7 @@ Lexicon query interface
"""
import re
from typing import Sequence
from sqlalchemy import select, func
@ -52,3 +53,8 @@ def create(
db.session.add(new_lexicon)
db.session.commit()
return new_lexicon
def get_all_lexicons(db: DbContext) -> Sequence[Lexicon]:
"""Get all lexicons."""
return db(select(Lexicon)).scalars()

View File

@ -3,7 +3,7 @@ User query interface
"""
import re
import uuid
from typing import Sequence
from sqlalchemy import select, func
@ -67,3 +67,8 @@ def create(
db.session.add(new_user)
db.session.commit()
return new_user
def get_all_users(db: DbContext) -> Sequence[User]:
"""Get all users."""
return db(select(User)).scalars()