fix query

This commit is contained in:
maryhipp 2023-06-27 13:05:32 -07:00 committed by psychedelicious
parent 73f2092ec5
commit 45935caf1d
2 changed files with 6 additions and 5 deletions

View File

@ -5,6 +5,7 @@ from invokeai.app.services.board_record_storage import BoardChanges
from invokeai.app.services.image_record_storage import OffsetPaginatedResults from invokeai.app.services.image_record_storage import OffsetPaginatedResults
from invokeai.app.services.models.board_record import BoardDTO from invokeai.app.services.models.board_record import BoardDTO
from ..dependencies import ApiDependencies from ..dependencies import ApiDependencies
boards_router = APIRouter(prefix="/v1/boards", tags=["boards"]) boards_router = APIRouter(prefix="/v1/boards", tags=["boards"])
@ -71,17 +72,17 @@ async def update_board(
@boards_router.delete("/{board_id}", operation_id="delete_board") @boards_router.delete("/{board_id}", operation_id="delete_board")
async def delete_board( async def delete_board(
board_id: str = Path(description="The id of board to delete"), board_id: str = Path(description="The id of board to delete"),
include_images: bool = Path( include_images: Optional[bool] = Query(
description="Permanently delete all images on the board", default=False description="Permanently delete all images on the board", default=False
), ),
) -> None: ) -> None:
"""Deletes a board""" """Deletes a board"""
try: try:
if include_images: if include_images is True:
ApiDependencies.invoker.services.images.delete_images_on_board( ApiDependencies.invoker.services.images.delete_images_on_board(
board_id=board_id board_id=board_id
) )
ApiDependencies.invoker.services.boards.delete(board_id=board_id)
else: else:
ApiDependencies.invoker.services.boards.delete(board_id=board_id) ApiDependencies.invoker.services.boards.delete(board_id=board_id)
except Exception as e: except Exception as e:

View File

@ -397,10 +397,10 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
self._lock.acquire() self._lock.acquire()
# Construct the SQLite query with the placeholders # Construct the SQLite query with the placeholders
query = f"DELETE FROM images WHERE id_column IN ({placeholders})" query = f"DELETE FROM images WHERE image_name IN ({placeholders})"
# Execute the query with the list of IDs as parameters # Execute the query with the list of IDs as parameters
self._cursor.execute(query, placeholders) self._cursor.execute(query, image_names)
self._conn.commit() self._conn.commit()
except sqlite3.Error as e: except sqlite3.Error as e: