[WIP] front api exchanges
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
from sqlmodel import Session, select
|
||||
import src.models as models
|
||||
|
||||
def get_all(session: Session) -> list[models.FormPublic]:
|
||||
def get_all(
|
||||
session: Session,
|
||||
seasons: list[str],
|
||||
productors: list[str]
|
||||
) -> list[models.FormPublic]:
|
||||
statement = select(models.Form)
|
||||
if len(seasons) > 0:
|
||||
statement = statement.where(models.Form.season.in_(seasons))
|
||||
if len(productors) > 0:
|
||||
statement = statement.join(models.Productor).where(models.Productor.name.in_(productors))
|
||||
return session.exec(statement).all()
|
||||
|
||||
def get_one(session: Session, form_id: int) -> models.FormPublic:
|
||||
|
||||
Reference in New Issue
Block a user