diff --git a/CHANGELOG.md b/CHANGELOG.md index d2557d3..231ff0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [v1.2.1](https://github.com/SebRut/pygrocy/tree/v1.2.1) (2022-05-21) + +[Full Changelog](https://github.com/SebRut/pygrocy/compare/v1.2.0...v1.2.1) + +**Merged pull requests:** + +- Fix for optional task due\_date, category and user [\#237](https://github.com/SebRut/pygrocy/pull/237) ([marcelvriend](https://github.com/marcelvriend)) + ## [v1.2.0](https://github.com/SebRut/pygrocy/tree/v1.2.0) (2022-05-16) [Full Changelog](https://github.com/SebRut/pygrocy/compare/v1.1.0...v1.2.0) diff --git a/pygrocy/data_models/task.py b/pygrocy/data_models/task.py index 851d2a1..00aa0fe 100644 --- a/pygrocy/data_models/task.py +++ b/pygrocy/data_models/task.py @@ -40,9 +40,11 @@ def __init__(self, response: TaskResponse): self._done = response.done self._done_timestamp = response.done_timestamp self._category_id = response.category_id + self._category = None if response.category: self._category = TaskCategory(response.category) self._assigned_to_user_id = response.assigned_to_user_id + self._assigned_to_user = None if response.assigned_to_user: self._assigned_to_user = User(response.assigned_to_user) self._userfields = response.userfields diff --git a/pygrocy/grocy_api_client.py b/pygrocy/grocy_api_client.py index 30ba1a1..40c4333 100644 --- a/pygrocy/grocy_api_client.py +++ b/pygrocy/grocy_api_client.py @@ -202,7 +202,7 @@ class TaskResponse(BaseModel): id: int name: str description: Optional[str] = None - due_date: date = None + due_date: Optional[date] = None done: int done_timestamp: Optional[datetime] = None category_id: Optional[int] = None @@ -211,6 +211,7 @@ class TaskResponse(BaseModel): assigned_to_user: Optional[UserDto] = None userfields: Optional[Dict] = None + due_date_validator = _field_not_empty_validator("due_date") category_id_validator = _field_not_empty_validator("category_id") assigned_to_user_id_validator = _field_not_empty_validator("assigned_to_user_id") diff --git a/setup.py b/setup.py index b55379e..67b63b9 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="pygrocy", - version="1.2.0", + version="1.2.1", author="Sebastian Rutofski", author_email="kontakt@sebastian-rutofski.de", description="",