From 46aef4fa437ff528b5f0d7590cc106b7754de9da Mon Sep 17 00:00:00 2001 From: Vinicius Date: Tue, 26 Mar 2024 23:36:51 -0300 Subject: [PATCH] chore: update urls --- bd_api/apps/account_auth/urls.py | 6 +++--- bd_api/apps/account_payment/urls.py | 2 +- bd_api/apps/api/v1/urls.py | 24 ++++++++++++++---------- bd_api/urls.py | 25 ++++--------------------- 4 files changed, 22 insertions(+), 35 deletions(-) diff --git a/bd_api/apps/account_auth/urls.py b/bd_api/apps/account_auth/urls.py index 5d525e6c..dccc6ef5 100644 --- a/bd_api/apps/account_auth/urls.py +++ b/bd_api/apps/account_auth/urls.py @@ -4,7 +4,7 @@ from . import views urlpatterns = [ - path("", views.auth, name="auth"), - path("login/", views.signin, name="login"), - path("logout/", views.signout, name="logout"), + path("auth/", views.auth, name="auth"), + path("auth/login/", views.signin, name="login"), + path("auth/logout/", views.signout, name="logout"), ] diff --git a/bd_api/apps/account_payment/urls.py b/bd_api/apps/account_payment/urls.py index 70ade363..b1e5d7de 100644 --- a/bd_api/apps/account_payment/urls.py +++ b/bd_api/apps/account_payment/urls.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- from django.urls import include, path -urlpatterns = [path("", include("djstripe.urls", namespace="payment"))] +urlpatterns = [path("payment/", include("djstripe.urls", namespace="payment"))] diff --git a/bd_api/apps/api/v1/urls.py b/bd_api/apps/api/v1/urls.py index bec38a9a..4c980b0a 100644 --- a/bd_api/apps/api/v1/urls.py +++ b/bd_api/apps/api/v1/urls.py @@ -1,23 +1,27 @@ # -*- coding: utf-8 -*- from django.http import HttpResponseRedirect -from django.urls import path +from django.urls import include, path from django.views.decorators.csrf import csrf_exempt from graphene_file_upload.django import FileUploadGraphQLView +from bd_api.apps.api.v1.search_views import DatasetSearchView +from bd_api.apps.api.v1.views import DatasetRedirectView + def redirect_to_v1(request): - return HttpResponseRedirect("/api/v1/") + return HttpResponseRedirect("/api/v1/graphql") -def redirect_to_v1_graphql(request): - return HttpResponseRedirect("/api/v1/graphql") +def graphql_view(): + return csrf_exempt(FileUploadGraphQLView.as_view(graphiql=True)) urlpatterns = [ - path("", redirect_to_v1), - path("v1/", redirect_to_v1_graphql), - path( - "v1/graphql", - csrf_exempt(FileUploadGraphQLView.as_view(graphiql=True)), - ), + path("api/", redirect_to_v1), + path("api/v1/", redirect_to_v1), + path("api/v1/graphql", graphql_view()), + path("search/", DatasetSearchView.as_view()), + path("search/debug/", include("haystack.urls")), + path("dataset/", DatasetRedirectView.as_view()), + path("dataset_redirect/", DatasetRedirectView.as_view()), ] diff --git a/bd_api/urls.py b/bd_api/urls.py index c4d1ca89..9e21395d 100644 --- a/bd_api/urls.py +++ b/bd_api/urls.py @@ -18,30 +18,13 @@ from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path -from django.views.decorators.csrf import csrf_exempt -from graphene_file_upload.django import FileUploadGraphQLView - -from bd_api.apps.api.v1.search_views import DatasetSearchView as DatasetSearchV2View -from bd_api.apps.api.v1.views import DatasetRedirectView -from bd_api.apps.api.v1.views import DatasetSearchView as DatasetSearchV1View - - -def graphql_view(): - return csrf_exempt(FileUploadGraphQLView.as_view(graphiql=True)) - urlpatterns = [ path("admin/", admin.site.urls), path("", include("bd_api.apps.core.urls")), - path("api/", include("bd_api.apps.api.v1.urls")), - path("api/graphql/", graphql_view()), - path("account/", include("bd_api.apps.account.urls")), - path("auth/", include("bd_api.apps.account_auth.urls")), - path("search/", DatasetSearchV1View.as_view()), - path("search/v2/", DatasetSearchV2View.as_view()), - path("search/debug/", include("haystack.urls")), - path("dataset/", DatasetRedirectView.as_view()), - path("dataset_redirect/", DatasetRedirectView.as_view()), - path("payment/", include("bd_api.apps.account_payment.urls")), + path("", include("bd_api.apps.api.v1.urls")), + path("", include("bd_api.apps.account.urls")), + path("", include("bd_api.apps.account_auth.urls")), + path("", include("bd_api.apps.account_payment.urls")), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)