Variables used in api/trashbox moved to service.py

This commit is contained in:
DmitryGantimurov 2023-08-11 15:06:05 +03:00
parent 07dfc1606c
commit b3215596f1

View File

@ -22,9 +22,8 @@ import shutil
import os
from .db import Base, engine, SessionLocal, database, Session
from .service import add_poems_to_db, generate_poem, check_obsolete, get_query_results
from .scheduler import app as app_rocketry
from . import schemas, models, utils
from . import schemas, models, utils, service
Base.metadata.create_all(bind=engine)
@ -112,7 +111,7 @@ def delete_from_db(announcement: schemas.DelAnnouncement, db: Annotated[Session,
# Забронировать объявление
@app.post("/api/book")
def change_book_status(data: schemas.Book, current_user: Annotated[schemas.User, Depends(utils.get_current_user)],
db: Annotated[Session, Depends(utils.get_db)], db: Annotated[Session, Depends(utils.get_db)]):
db: Annotated[Session, Depends(utils.get_db)]):
# Находим объявление по данному id
announcement_to_change = db.query(models.Announcement).filter(models.Announcement.id == data.id).first()
# Проверяем, что объявление с данным id существует