diff --git a/invokeai/app/api/routers/boards.py b/invokeai/app/api/routers/boards.py index 9ef416e396..eb2f5956ab 100644 --- a/invokeai/app/api/routers/boards.py +++ b/invokeai/app/api/routers/boards.py @@ -19,7 +19,8 @@ async def create_board( ): """Creates a board""" try: - ApiDependencies.invoker.services.boards.save(board_name=board_name) + result = ApiDependencies.invoker.services.boards.save(board_name=board_name) + return result except Exception as e: raise HTTPException(status_code=500, detail="Failed to create board") diff --git a/invokeai/app/services/boards.py b/invokeai/app/services/boards.py index 69b1afa048..00d90637fe 100644 --- a/invokeai/app/services/boards.py +++ b/invokeai/app/services/boards.py @@ -54,11 +54,6 @@ class BoardRecordDeleteException(Exception): class BoardStorageBase(ABC): """Low-level service responsible for interfacing with the board record store.""" - @abstractmethod - def get(self, board_id: str) -> BoardRecord: - """Gets an board record.""" - pass - @abstractmethod def delete(self, board_id: str) -> None: """Deletes a board record.""" @@ -165,6 +160,18 @@ class SqliteBoardStorage(BoardStorageBase): (board_id, board_name), ) self._conn.commit() + + self._cursor.execute( + """--sql + SELECT * + FROM boards + WHERE id = ?; + """, + (board_id,), + ) + + result = self._cursor.fetchone() + return result except sqlite3.Error as e: self._conn.rollback() raise BoardRecordSaveException from e diff --git a/invokeai/app/services/models/image_record.py b/invokeai/app/services/models/image_record.py index a4699f74c8..98f370f337 100644 --- a/invokeai/app/services/models/image_record.py +++ b/invokeai/app/services/models/image_record.py @@ -48,6 +48,11 @@ class ImageRecord(BaseModel): description="A limited subset of the image's generation metadata. Retrieve the image's session for full metadata.", ) """A limited subset of the image's generation metadata. Retrieve the image's session for full metadata.""" + board_id: Optional[str] = Field( + default=None, + description="The board ID that this image belongs to.", + ) + """The board ID that this image belongs to.""" class ImageRecordChanges(BaseModel, extra=Extra.forbid): @@ -126,6 +131,7 @@ def deserialize_image_record(image_dict: dict) -> ImageRecord: updated_at = image_dict.get("updated_at", get_iso_timestamp()) deleted_at = image_dict.get("deleted_at", get_iso_timestamp()) is_intermediate = image_dict.get("is_intermediate", False) + board_id = image_dict.get("board_id", None) raw_metadata = image_dict.get("metadata") @@ -147,4 +153,5 @@ def deserialize_image_record(image_dict: dict) -> ImageRecord: updated_at=updated_at, deleted_at=deleted_at, is_intermediate=is_intermediate, + board_id=board_id, )