mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
some more
This commit is contained in:
parent
6ca5ad9075
commit
499a174832
@ -19,7 +19,8 @@ async def create_board(
|
|||||||
):
|
):
|
||||||
"""Creates a board"""
|
"""Creates a board"""
|
||||||
try:
|
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:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=500, detail="Failed to create board")
|
raise HTTPException(status_code=500, detail="Failed to create board")
|
||||||
|
|
||||||
|
@ -54,11 +54,6 @@ class BoardRecordDeleteException(Exception):
|
|||||||
class BoardStorageBase(ABC):
|
class BoardStorageBase(ABC):
|
||||||
"""Low-level service responsible for interfacing with the board record store."""
|
"""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
|
@abstractmethod
|
||||||
def delete(self, board_id: str) -> None:
|
def delete(self, board_id: str) -> None:
|
||||||
"""Deletes a board record."""
|
"""Deletes a board record."""
|
||||||
@ -165,6 +160,18 @@ class SqliteBoardStorage(BoardStorageBase):
|
|||||||
(board_id, board_name),
|
(board_id, board_name),
|
||||||
)
|
)
|
||||||
self._conn.commit()
|
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:
|
except sqlite3.Error as e:
|
||||||
self._conn.rollback()
|
self._conn.rollback()
|
||||||
raise BoardRecordSaveException from e
|
raise BoardRecordSaveException from e
|
||||||
|
@ -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.",
|
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."""
|
"""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):
|
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())
|
updated_at = image_dict.get("updated_at", get_iso_timestamp())
|
||||||
deleted_at = image_dict.get("deleted_at", get_iso_timestamp())
|
deleted_at = image_dict.get("deleted_at", get_iso_timestamp())
|
||||||
is_intermediate = image_dict.get("is_intermediate", False)
|
is_intermediate = image_dict.get("is_intermediate", False)
|
||||||
|
board_id = image_dict.get("board_id", None)
|
||||||
|
|
||||||
raw_metadata = image_dict.get("metadata")
|
raw_metadata = image_dict.get("metadata")
|
||||||
|
|
||||||
@ -147,4 +153,5 @@ def deserialize_image_record(image_dict: dict) -> ImageRecord:
|
|||||||
updated_at=updated_at,
|
updated_at=updated_at,
|
||||||
deleted_at=deleted_at,
|
deleted_at=deleted_at,
|
||||||
is_intermediate=is_intermediate,
|
is_intermediate=is_intermediate,
|
||||||
|
board_id=board_id,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user