Skip to content

Commit

Permalink
rename current_prices endpoint to current-prices
Browse files Browse the repository at this point in the history
  • Loading branch information
Floris272 committed Sep 27, 2024
1 parent 6db5b0e commit 41922b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def test_delete_price(self):
self.assertEqual(PriceOption.objects.count(), 0)

def test_get_current_prices_when_product_type_has_no_prices(self):
response = self.client.get("/api/v1/producttypes/current_prices/")
response = self.client.get("/api/v1/producttypes/current-prices/")
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.data,
Expand All @@ -364,7 +364,7 @@ def test_get_current_prices_when_product_type_only_has_price_in_future(self):
product_type=self.product_type, valid_from=datetime.date(2024, 2, 2)
)

response = self.client.get("/api/v1/producttypes/current_prices/")
response = self.client.get("/api/v1/producttypes/current-prices/")

self.assertEqual(response.status_code, 200)
self.assertEqual(
Expand All @@ -388,7 +388,7 @@ def test_get_current_prices_when_product_type_has_current_price(self):

option = PriceOptionFactory.create(price=price)

response = self.client.get("/api/v1/producttypes/current_prices/")
response = self.client.get("/api/v1/producttypes/current-prices/")

self.assertEqual(response.status_code, 200)
self.assertEqual(
Expand Down
6 changes: 5 additions & 1 deletion src/open_producten/producttypes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ class ProductTypeViewSet(ModelViewSet):
serializer_class = ProductTypeSerializer
lookup_url_kwarg = "id"

@action(detail=False, serializer_class=ProductTypeCurrentPriceSerializer)
@action(
detail=False,
serializer_class=ProductTypeCurrentPriceSerializer,
url_path="current-prices",
)
def current_prices(self, request):
product_types = ProductType.objects.all()
serializer = ProductTypeCurrentPriceSerializer(product_types, many=True)
Expand Down
2 changes: 1 addition & 1 deletion src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ paths:
responses:
'204':
description: No response body
/api/v1/producttypes/current_prices/:
/api/v1/producttypes/current-prices/:
get:
operationId: producttypes_current_prices_retrieve
tags:
Expand Down

0 comments on commit 41922b7

Please sign in to comment.