Skip to content

Commit

Permalink
✨ [#207] Add experimental PUT and PATCH for Kanaal
Browse files Browse the repository at this point in the history
this is required to support new kenmerken on the zaken kanaal, because the Kanaal has to be updated in Open Notificaties for it to work
  • Loading branch information
stevenbal committed Dec 17, 2024
1 parent fa08b63 commit c7324e5
Show file tree
Hide file tree
Showing 3 changed files with 380 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/nrc/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from djangorestframework_camel_case.util import camelize, underscoreize
from notifications_api_common.api.serializers import NotificatieSerializer
from rest_framework import fields, serializers
from vng_api_common.validators import URLValidator
from rest_framework.validators import UniqueValidator
from vng_api_common.validators import IsImmutableValidator, URLValidator

from nrc.api.tasks import deliver_message
from nrc.datamodel.models import Abonnement, Filter, FilterGroup, Kanaal, Notificatie
Expand Down Expand Up @@ -39,6 +40,12 @@ class Meta:
fields = ("url", "naam", "documentatie_link", "filters")
extra_kwargs = {
"url": {"lookup_field": "uuid"},
"naam": {
"validators": [
UniqueValidator(queryset=Kanaal.objects.all()),
IsImmutableValidator(),
]
},
"documentatie_link": {"required": False, "validators": [URLValidator()]},
"filters": {"required": False},
}
Expand Down
5 changes: 4 additions & 1 deletion src/nrc/api/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ class KanaalViewSet(
CheckQueryParamsMixin,
mixins.CreateModelMixin,
mixins.ListModelMixin,
mixins.UpdateModelMixin,
mixins.RetrieveModelMixin,
viewsets.GenericViewSet,
):
"""
Opvragen en aanmaken van KANAALen.
Opvragen, aanmaken en bewerken van KANAALen.
Op een KANAAL publiceren componenten (bronnen) hun NOTIFICATIEs. Alleen
componenten die NOTIFICATIEs willen publiceren dienen een KANAAL aan te
Expand All @@ -80,6 +81,8 @@ class KanaalViewSet(
"list": SCOPE_NOTIFICATIES_PUBLICEREN | SCOPE_NOTIFICATIES_CONSUMEREN,
"retrieve": SCOPE_NOTIFICATIES_PUBLICEREN | SCOPE_NOTIFICATIES_CONSUMEREN,
"create": SCOPE_NOTIFICATIES_PUBLICEREN,
"update": SCOPE_NOTIFICATIES_PUBLICEREN,
"partial_update": SCOPE_NOTIFICATIES_PUBLICEREN,
}


Expand Down
Loading

0 comments on commit c7324e5

Please sign in to comment.