mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
add actions to board and image DTO
This commit is contained in:
parent
db58efbe65
commit
a2d8af0024
@ -12,12 +12,18 @@ class BoardDTO(BoardRecord):
|
|||||||
"""The URL of the thumbnail of the most recent image in the board."""
|
"""The URL of the thumbnail of the most recent image in the board."""
|
||||||
image_count: int = Field(description="The number of images in the board.")
|
image_count: int = Field(description="The number of images in the board.")
|
||||||
"""The number of images in the board."""
|
"""The number of images in the board."""
|
||||||
|
actions: Optional[dict[str, bool]] = Field(
|
||||||
|
default=None,
|
||||||
|
description="Allowed actions on board."
|
||||||
|
)
|
||||||
|
"""Allowed actions on board."""
|
||||||
|
|
||||||
|
|
||||||
def board_record_to_dto(board_record: BoardRecord, cover_image_name: Optional[str], image_count: int) -> BoardDTO:
|
def board_record_to_dto(board_record: BoardRecord, cover_image_name: Optional[str], image_count: int, actions: Optional[dict[str, bool]]) -> BoardDTO:
|
||||||
"""Converts a board record to a board DTO."""
|
"""Converts a board record to a board DTO."""
|
||||||
return BoardDTO(
|
return BoardDTO(
|
||||||
**board_record.model_dump(exclude={"cover_image_name"}),
|
**board_record.model_dump(exclude={"cover_image_name"}),
|
||||||
cover_image_name=cover_image_name,
|
cover_image_name=cover_image_name,
|
||||||
image_count=image_count,
|
image_count=image_count,
|
||||||
|
actions=actions
|
||||||
)
|
)
|
||||||
|
@ -29,6 +29,11 @@ class ImageDTO(ImageRecord, ImageUrlsDTO):
|
|||||||
description="The workflow that generated this image.",
|
description="The workflow that generated this image.",
|
||||||
)
|
)
|
||||||
"""The workflow that generated this image."""
|
"""The workflow that generated this image."""
|
||||||
|
actions: Optional[dict[str, bool]] = Field(
|
||||||
|
default=None,
|
||||||
|
description="Allowed actions on image."
|
||||||
|
)
|
||||||
|
"""Allowed actions on image."""
|
||||||
|
|
||||||
|
|
||||||
def image_record_to_dto(
|
def image_record_to_dto(
|
||||||
@ -37,6 +42,7 @@ def image_record_to_dto(
|
|||||||
thumbnail_url: str,
|
thumbnail_url: str,
|
||||||
board_id: Optional[str],
|
board_id: Optional[str],
|
||||||
workflow_id: Optional[str],
|
workflow_id: Optional[str],
|
||||||
|
actions: Optional[dict[str, bool]]
|
||||||
) -> ImageDTO:
|
) -> ImageDTO:
|
||||||
"""Converts an image record to an image DTO."""
|
"""Converts an image record to an image DTO."""
|
||||||
return ImageDTO(
|
return ImageDTO(
|
||||||
@ -45,4 +51,5 @@ def image_record_to_dto(
|
|||||||
thumbnail_url=thumbnail_url,
|
thumbnail_url=thumbnail_url,
|
||||||
board_id=board_id,
|
board_id=board_id,
|
||||||
workflow_id=workflow_id,
|
workflow_id=workflow_id,
|
||||||
|
actions=actions
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user