Skip to content

Commit

Permalink
Fix ID fields to accept integer values
Browse files Browse the repository at this point in the history
  • Loading branch information
ABizzinotto committed Sep 17, 2023
1 parent 4ee2205 commit 96f8d32
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion noko_client/schemas/invoice_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class GetNokoInvoicesParameters(BaseModel):
total_amount_from: int | float | None = None
total_amount_to: int | float | None = None
recipient_details: str | None = None
project_ids: str | list | None = None
project_ids: str | int | list | None = None
company_name: str | None = None
company_details: str | None = None
description: str | None = None
Expand Down
4 changes: 2 additions & 2 deletions noko_client/schemas/project_groups_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CreateNokoProjectGroupsParameters(BaseModel):
"""Process and validate parameters to make POST requests to the `project_groups` endpoint."""

name: str
project_ids: str | list
project_ids: str | int | list

_format_id_lists = field_validator("project_ids")(format_id_lists)

Expand All @@ -30,7 +30,7 @@ class GetNokoProjectGroupsParameters(BaseModel):
"""Process and validate parameters to make GET requests to the `project_groups` endpoint."""

name: str | None = None
project_ids: str | list | None = None
project_ids: str | int | list | None = None

_format_id_lists = field_validator("project_ids")(format_id_lists)

Expand Down
4 changes: 2 additions & 2 deletions noko_client/schemas/teams_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BaseTeam(BaseModel):
"""Base model for the actions related to the `team` endpoint."""

name: str | None = None
user_ids: str | list | None = None
user_ids: str | int | list | None = None

_format_user_ids = field_validator("user_ids")(format_id_lists)

Expand All @@ -29,7 +29,7 @@ class CreateNokoTeamParameters(BaseTeam):
"""Process and validate parameters to make POST requests to the `teams` endpoint."""

name: str
user_ids: str | list
user_ids: str | int | list


class GetNokoTeamsParameters(BaseTeam):
Expand Down
4 changes: 2 additions & 2 deletions noko_client/schemas/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def format_date(value: str | datetime) -> str:
return date_to_string(value) if isinstance(value, datetime) else value


def format_id_lists(value: str | list | None) -> str | None:
def format_id_lists(value: str | int | list | None) -> str | None:
"""If IDs provided as lists, convert to a comma separated string."""
return list_to_string(value) if isinstance(value, list) else value
return list_to_string(value) if isinstance(value, list) else str(value)


def format_list_of_integers(value: list | None) -> list | None:
Expand Down

0 comments on commit 96f8d32

Please sign in to comment.