Add backend functions for a basic dashboard
This commit is contained in:
parent
e097917633
commit
d8d20f4224
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user