add board_id association to image

This commit is contained in:
maryhipp 2023-06-13 11:55:38 -07:00 committed by psychedelicious
parent 207602f425
commit a121e6b3a0
2 changed files with 16 additions and 0 deletions

View File

@ -260,6 +260,18 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
""",
(changes.is_intermediate, image_name),
)
# Change the image's `is_intermediate`` flag
if changes.board_id is not None:
self._cursor.execute(
f"""--sql
UPDATE images
SET board_id = ?
WHERE image_name = ?;
""",
(changes.board_id, image_name),
)
self._conn.commit()
except sqlite3.Error as e:
self._conn.rollback()

View File

@ -72,6 +72,10 @@ class ImageRecordChanges(BaseModel, extra=Extra.forbid):
default=None, description="The image's new `is_intermediate` flag."
)
"""The image's new `is_intermediate` flag."""
board_id: Optional[StrictStr] = Field(
default=None, description="The image's new board ID."
)
"""The image's new board ID."""
class ImageUrlsDTO(BaseModel):