Skip to content

Commit

Permalink
models.file:OriginalFile.original_name - rename to original_path and …
Browse files Browse the repository at this point in the history
…save the entire original relative_path
  • Loading branch information
MatteoCampinoti94 committed Nov 1, 2024
1 parent edac5f8 commit 5173f4e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions acacore/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,22 @@ class OriginalFile(BaseFile):
:ivar action_data: The data for the action for the file's PUID, if one exists.
:ivar processed: True if the file has been processed, false otherwise.
:ivar lock: True if the file is locked for edits, false otherwise.
:ivar original_name: The original name of the file.
:ivar original_path: The original relative path of the file.
"""

action: TActionType | None = None
action_data: ActionData = Field(default_factory=ActionData)
parent: UUID4 | None = None
processed: bool = False
lock: bool = False
original_name: str
original_path: Path

# noinspection PyNestedDecorators
@model_validator(mode="before")
@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", "") or data["relative_path"]
return data

@classmethod
Expand Down

0 comments on commit 5173f4e

Please sign in to comment.