feat(bulk_download): update response model, messages

This commit is contained in:
psychedelicious 2024-02-20 22:15:01 +11:00 committed by Brandon Rising
parent 6a6958f19b
commit f74e352f96
2 changed files with 7 additions and 11 deletions

View File

@ -375,9 +375,11 @@ async def unstar_images_in_list(
class ImagesDownloaded(BaseModel):
response: Optional[str] = Field(
description="If defined, the message to display to the user when images begin downloading"
default=None, description="The message to display to the user when images begin downloading"
)
bulk_download_item_name: Optional[str] = Field(
default=None, description="The name of the bulk download item for which events will be emitted"
)
bulk_download_item_name: str = Field(description="The bulk download item name of the bulk download item")
@images_router.post(
@ -389,7 +391,7 @@ async def download_images_from_list(
default=None, description="The list of names of images to download", embed=True
),
board_id: Optional[str] = Body(
default=None, description="The board from which image should be downloaded from", embed=True
default=None, description="The board from which image should be downloaded", embed=True
),
) -> ImagesDownloaded:
if (image_names is None or len(image_names) == 0) and board_id is None:
@ -402,10 +404,7 @@ async def download_images_from_list(
board_id,
bulk_download_item_id,
)
return ImagesDownloaded(
response="Your images are preparing to be downloaded",
bulk_download_item_name=bulk_download_item_id + ".zip",
)
return ImagesDownloaded(bulk_download_item_name=bulk_download_item_id + ".zip")
@images_router.api_route(

View File

@ -20,9 +20,6 @@ class BulkDownloadTargetException(BulkDownloadException):
class BulkDownloadParametersException(BulkDownloadException):
"""Exception raised when a bulk download parameter is invalid."""
def __init__(
self,
message="The bulk download parameters are invalid, either an array of image names or a board id must be provided",
):
def __init__(self, message="No image names or board ID provided"):
super().__init__(message)
self.message = message