[WIP] Library REST API

This commit is contained in:
2026-02-15 11:32:33 +01:00
parent c468f51672
commit c701a4ab9b
8 changed files with 131 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
from .create import create
from .read import read
from .read import read, read_all
from .update import update
from .delete import delete
from .delete import delete

View File

@@ -5,4 +5,8 @@ from ....schema.library.base import Base
def read(session:Session, _id:int, obj:Base):
stmt = select(obj).where(obj.id == _id)
return session.scalars(stmt).one()
return session.scalars(stmt).one()
def read_all(session:Session, obj:Base):
stmt = select(obj)
return session.scalars(stmt).fetchall() #TODO: Pagination