Skip to content

Commit

Permalink
✨ [#256] added klantcontact filters to retrieve klantcontact based on…
Browse files Browse the repository at this point in the history
… betrokkene -> partij uuid/url
  • Loading branch information
bart-maykin committed Nov 19, 2024
1 parent 992480b commit e6d0247
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class KlantcontactFilterSet(FilterSet):
help_text=_("Zoek klantcontact object op basis van het betrokkene uuid."),
field_name="betrokkene__uuid",
)
had_betrokkene__was_partij__url = filters.CharFilter(
help_text=_("Zoek klantcontact object op basis van de partij url."),
method="filter_partij_url",
)
had_betrokkene__was_partij__uuid = filters.UUIDFilter(
help_text=_("Zoek klantcontact object op basis van de partij uuid."),
field_name="betrokkene__partij__uuid",
)
onderwerpobject__url = filters.CharFilter(
help_text=_("Zoek klantcontact object op basis van het onderwerpobject url."),
method="filter_onderwerpobject_url",
Expand All @@ -54,6 +62,8 @@ class Meta:
fields = (
"had_betrokkene__url",
"had_betrokkene__uuid",
"had_betrokkene__was_partij__url",
"had_betrokkene__was_partij__uuid",
"onderwerpobject__uuid",
"onderwerpobject__url",
"onderwerpobject__onderwerpobjectidentificator_code_objecttype",
Expand Down Expand Up @@ -82,6 +92,13 @@ def filter_betrokkene_url(self, queryset, name, value):
except ValueError:
return queryset.none()

def filter_partij_url(self, queryset, name, value):
try:
url_uuid = uuid.UUID(value.rstrip("/").split("/")[-1])
return queryset.filter(betrokkene__partij__uuid=url_uuid)
except ValueError:
return queryset.none()

def filter_onderwerpobject_url(self, queryset, name, value):
try:
url_uuid = uuid.UUID(value.rstrip("/").split("/")[-1])
Expand Down
11 changes: 11 additions & 0 deletions src/openklant/components/klantinteracties/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,17 @@ paths:
type: string
format: uuid
description: Zoek klantcontact object op basis van het betrokkene uuid.
- in: query
name: hadBetrokkene__wasPartij__url
schema:
type: string
description: Zoek klantcontact object op basis van de partij url.
- in: query
name: hadBetrokkene__wasPartij__uuid
schema:
type: string
format: uuid
description: Zoek klantcontact object op basis van de partij uuid.
- in: query
name: indicatieContactGelukt
schema:
Expand Down

0 comments on commit e6d0247

Please sign in to comment.