Skip to content

Commit

Permalink
Update api: Return gone for old entities endpoint. Use v2 for new app
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoMoreta committed Mar 13, 2024
1 parent 4f27760 commit f559d8c
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/client/Auth/Login User.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{URL}}/api/v1/login/
url: {{URL}}/api/v2/login/
body: formUrlEncoded
auth: none
}
Expand Down
2 changes: 1 addition & 1 deletion api/client/Auth/Logout User.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{URL}}/api/v1/logout/
url: {{URL}}/api/v2/logout/
body: none
auth: none
}
Expand Down
2 changes: 1 addition & 1 deletion api/client/Benefits/List Benefits.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{URL}}/api/v1/nodes/1/benefits/
url: {{URL}}/api/v2/nodes/1/benefits/
body: none
auth: none
}
2 changes: 1 addition & 1 deletion api/client/Core/List Nodes.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{URL}}/api/v1/nodes/
url: {{URL}}/api/v2/nodes/
body: none
auth: none
}
2 changes: 1 addition & 1 deletion api/client/Market/List Categories.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{URL}}/api/v1/nodes/1/categories/
url: {{URL}}/api/v2/nodes/1/categories/
body: none
auth: none
}
2 changes: 1 addition & 1 deletion api/client/Market/List News.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{URL}}/api/v1/nodes/1/news/
url: {{URL}}/api/v2/nodes/1/news/
body: none
auth: none
}
2 changes: 1 addition & 1 deletion api/client/Market/List Providers.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{URL}}/api/v1/nodes/1/providers/
url: {{URL}}/api/v2/nodes/1/providers/
body: none
auth: none
}
2 changes: 1 addition & 1 deletion api/client/Offers/List Offers.bru
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{URL}}/api/v1/nodes/1/offers/
url: {{URL}}/api/v2/nodes/1/offers/
body: none
auth: none
}
9 changes: 6 additions & 3 deletions api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from api.views.benefits import BenefitsViewSet
from api.views.news import NewsViewSet
from api.views.offers import OffersViewSet
from api.views.provider import EntitiesView

router = DefaultRouter()
router.register("devices", FCMDeviceAuthorizedViewSet)
Expand All @@ -18,9 +19,11 @@
router.register(r"nodes/(?P<node>\d+)/benefits", BenefitsViewSet)

urlpatterns = [
path("v1/", include(router.urls)),
path("v1/login/", LoginView.as_view()),
path("v1/logout/", LogoutView.as_view()),
path("v2/", include(router.urls)),
path("v2/login/", LoginView.as_view()),
path("v2/logout/", LogoutView.as_view()),

path("v1/entities/", EntitiesView.as_view())
]


10 changes: 10 additions & 0 deletions api/views/provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.http import HttpResponseGone
from rest_framework import viewsets
from rest_framework.views import APIView

from api.mixins.FilterByNodeMixin import FilterByNodeMixin
from api.serializers.provider import ProviderSerializer
Expand All @@ -8,3 +10,11 @@
class ProviderViewSet(FilterByNodeMixin, viewsets.ReadOnlyModelViewSet):
queryset = Provider.objects.all()
serializer_class = ProviderSerializer


class EntitiesView(APIView):
permission_classes = []

def get(self, request, format=None):
return HttpResponseGone()

0 comments on commit f559d8c

Please sign in to comment.