forward db session dependency

This commit is contained in:
Colin Goutte 2021-11-14 21:21:57 +01:00
parent 148e6416c9
commit 094803cc8d
1 changed files with 4 additions and 2 deletions

View File

@ -173,7 +173,9 @@ def list_notification(idsonde: str):
@app.get("/notifications/{idsonde}/text")
def last_notif_text(request: Request, idsonde: str):
def last_notif_text(request: Request, idsonde: str, db: Session = Depends(get_db)):
db_sonde = crud.get_sonde(db, identifiant=idsonde)
notifs = notifications[idsonde]
try:
content = notifs[-1]
@ -272,7 +274,7 @@ def post_sonde_data(
)
if content:
Notifier(db, idsonde, content)
res = last_notif_text(request, idsonde)
res = last_notif_text(request, idsonde, db)
html = res.body.decode("utf-8")
from papi.mail_sendermodel import sendmail