Skip to content

Commit

Permalink
models.file:file.original_name - rename to original_path and save the…
Browse files Browse the repository at this point in the history
… entire original relative_path
  • Loading branch information
MatteoCampinoti94 committed Nov 1, 2024
1 parent 5ba4638 commit 4fe5931
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions acacore/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class File(BaseModel):
parent: UUID4 | None = None
processed: bool = False
lock: bool = False
original_name: str
original_path: Path
processed_names: list[str] = Field(default_factory=list)
root: Path | None = DBField(None, ignore=True)

Expand All @@ -99,7 +99,7 @@ class File(BaseModel):
@classmethod
def _model_validator(cls, data: dict):
if isinstance(data, dict):
data["original_name"] = data.get("original_name", "").strip() or Path(data["relative_path"]).name
data["original_path"] = data.get("original_path", "").strip() or data["relative_path"]
return data

# noinspection PyNestedDecorators
Expand Down

0 comments on commit 4fe5931

Please sign in to comment.