feat: unify source libraries, generation plans and terminal bindings
This commit is contained in:
@@ -170,6 +170,10 @@ class ErrorResponse(BaseModel):
|
||||
|
||||
|
||||
class OperationResult(BaseModel):
|
||||
source_image_id: str | None = None
|
||||
outputs: list[dict[str, Any]] = Field(default_factory=list)
|
||||
errors: list[dict[str, Any]] = Field(default_factory=list)
|
||||
wrist_thumbnail: dict[str, Any] | None = None
|
||||
image_name: str | None = None
|
||||
preview_url: str | None = None
|
||||
cover_id: int | None = None
|
||||
@@ -283,6 +287,7 @@ class RestoreContent(StrictModel):
|
||||
|
||||
|
||||
class JobInput(StrictModel):
|
||||
library_pipeline: bool = False
|
||||
generate_thumbnail: bool = False
|
||||
thumbnail_plan_id: str | None = Field(default=None, pattern=r"^[a-f0-9]{32}$")
|
||||
cleanup_unstarred: bool = False
|
||||
@@ -297,6 +302,14 @@ class JobInput(StrictModel):
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_options(self):
|
||||
if self.library_pipeline and (
|
||||
not isinstance(self.source, PhotoSourceContent)
|
||||
or self.generate_thumbnail
|
||||
or self.cleanup_unstarred
|
||||
):
|
||||
raise ValueError(
|
||||
"Source-library tasks require a photo source and use terminal-bound generation plans"
|
||||
)
|
||||
if self.generate_thumbnail and (
|
||||
not self.thumbnail_plan_id
|
||||
or not isinstance(self.source, PhotoSourceContent)
|
||||
|
||||
Reference in New Issue
Block a user