Skip to content

Commit

Permalink
tasotarkistus: api endpoint (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
NC-jsAhonen authored Dec 17, 2024
1 parent 7da645c commit 4a747c3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
13 changes: 12 additions & 1 deletion leasing/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
from django_filters.rest_framework import FilterSet, filters
from rest_framework.filters import OrderingFilter

from leasing.models import CollectionCourtDecision, CollectionLetter, CollectionNote
from leasing.models import (
CollectionCourtDecision,
CollectionLetter,
CollectionNote,
OldDwellingsInHousingCompaniesPriceIndex,
)
from leasing.models.invoice import InvoiceNote, InvoiceRow, InvoiceSet
from leasing.models.land_use_agreement import (
LandUseAgreementInvoice,
Expand Down Expand Up @@ -235,6 +240,12 @@ class Meta:
fields = ["invoice"]


class OldDwellingsInHousingCompaniesPriceIndexFilter(FilterSet):
class Meta:
model = OldDwellingsInHousingCompaniesPriceIndex
fields = "__all__"


class ReceivableTypeFilter(FilterSet):
service_unit = NumberInFilter(field_name="service_unit_id")

Expand Down
11 changes: 11 additions & 0 deletions leasing/viewsets/old_dwellings_in_housing_companies_price_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from rest_framework import viewsets

from leasing.filters import OldDwellingsInHousingCompaniesPriceIndexFilter
from leasing.models import OldDwellingsInHousingCompaniesPriceIndex
from leasing.serializers.rent import OldDwellingsInHousingCompaniesPriceIndexSerializer


class OldDwellingsInHousingCompaniesPriceIndexViewSet(viewsets.ReadOnlyModelViewSet):
queryset = OldDwellingsInHousingCompaniesPriceIndex.objects.all()
serializer_class = OldDwellingsInHousingCompaniesPriceIndexSerializer
filterset_class = OldDwellingsInHousingCompaniesPriceIndexFilter
7 changes: 7 additions & 0 deletions mvj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
LeaseSetRentInfoCompletionStateView,
)
from leasing.viewsets.leasehold_transfer import LeaseholdTransferViewSet
from leasing.viewsets.old_dwellings_in_housing_companies_price_index import (
OldDwellingsInHousingCompaniesPriceIndexViewSet,
)
from leasing.viewsets.rent import IndexViewSet
from leasing.viewsets.service_unit import ServiceUnitViewSet
from leasing.viewsets.ui_data import UiDataViewSet
Expand Down Expand Up @@ -200,6 +203,10 @@
router.register(r"meeting_memo", MeetingMemoViewset)
router.register(r"municipality", MunicipalityViewSet)
router.register(r"notice_period", NoticePeriodViewSet)
router.register(
r"old_dwellings_in_housing_companies_price_index",
OldDwellingsInHousingCompaniesPriceIndexViewSet,
)
router.register(r"plan_unit", PlanUnitViewSet)
router.register(
r"plan_unit_list_with_identifiers",
Expand Down

0 comments on commit 4a747c3

Please sign in to comment.