diff --git a/bd_api/apps/account/apps.py b/bd_api/apps/account/apps.py index a94c49d7..e4e529da 100644 --- a/bd_api/apps/account/apps.py +++ b/bd_api/apps/account/apps.py @@ -3,8 +3,9 @@ class AccountConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" name = "bd_api.apps.account" + verbose_name = "Contas" + default_auto_field = "django.db.models.BigAutoField" def ready(self): import bd_api.apps.account.signals # noqa diff --git a/bd_api/apps/account_auth/apps.py b/bd_api/apps/account_auth/apps.py index 40e4ef05..b95066a7 100644 --- a/bd_api/apps/account_auth/apps.py +++ b/bd_api/apps/account_auth/apps.py @@ -3,5 +3,6 @@ class AuthConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" name = "bd_api.apps.account_auth" + verbose_name = "Autenticação e Autorização Interna" + default_auto_field = "django.db.models.BigAutoField" 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/payment/__init__.py b/bd_api/apps/account_payment/__init__.py similarity index 100% rename from bd_api/apps/payment/__init__.py rename to bd_api/apps/account_payment/__init__.py diff --git a/bd_api/apps/payment/admin.py b/bd_api/apps/account_payment/admin.py similarity index 100% rename from bd_api/apps/payment/admin.py rename to bd_api/apps/account_payment/admin.py diff --git a/bd_api/apps/payment/apps.py b/bd_api/apps/account_payment/apps.py similarity index 50% rename from bd_api/apps/payment/apps.py rename to bd_api/apps/account_payment/apps.py index cc698c86..797c1619 100644 --- a/bd_api/apps/payment/apps.py +++ b/bd_api/apps/account_payment/apps.py @@ -3,9 +3,9 @@ class PaymentConfig(DjstripeAppConfig): - verbose_name = "Stripe" + verbose_name = "Pagamentos" def ready(self): super().ready() - import bd_api.apps.payment.signals # noqa - import bd_api.apps.payment.webhooks # noqa + import bd_api.apps.account_payment.signals # noqa + import bd_api.apps.account_payment.webhooks # noqa diff --git a/bd_api/apps/payment/graphql.py b/bd_api/apps/account_payment/graphql.py similarity index 99% rename from bd_api/apps/payment/graphql.py rename to bd_api/apps/account_payment/graphql.py index c2ac10d7..082343b8 100644 --- a/bd_api/apps/payment/graphql.py +++ b/bd_api/apps/account_payment/graphql.py @@ -12,7 +12,7 @@ from stripe import Customer as StripeCustomer from bd_api.apps.account.models import Account, Subscription -from bd_api.apps.payment.webhooks import add_user, remove_user +from bd_api.apps.account_payment.webhooks import add_user, remove_user from bd_api.custom.graphql_base import CountableConnection, PlainTextNode if settings.STRIPE_LIVE_MODE: diff --git a/bd_api/apps/payment/migrations/__init__.py b/bd_api/apps/account_payment/migrations/__init__.py similarity index 100% rename from bd_api/apps/payment/migrations/__init__.py rename to bd_api/apps/account_payment/migrations/__init__.py diff --git a/bd_api/apps/payment/models.py b/bd_api/apps/account_payment/models.py similarity index 100% rename from bd_api/apps/payment/models.py rename to bd_api/apps/account_payment/models.py diff --git a/bd_api/apps/payment/signals.py b/bd_api/apps/account_payment/signals.py similarity index 100% rename from bd_api/apps/payment/signals.py rename to bd_api/apps/account_payment/signals.py diff --git a/bd_api/apps/payment/tests.gql b/bd_api/apps/account_payment/tests.gql similarity index 100% rename from bd_api/apps/payment/tests.gql rename to bd_api/apps/account_payment/tests.gql diff --git a/bd_api/apps/payment/tests.py b/bd_api/apps/account_payment/tests.py similarity index 100% rename from bd_api/apps/payment/tests.py rename to bd_api/apps/account_payment/tests.py diff --git a/bd_api/apps/account_payment/urls.py b/bd_api/apps/account_payment/urls.py new file mode 100644 index 00000000..b1e5d7de --- /dev/null +++ b/bd_api/apps/account_payment/urls.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +from django.urls import include, path + +urlpatterns = [path("payment/", include("djstripe.urls", namespace="payment"))] diff --git a/bd_api/apps/payment/views.py b/bd_api/apps/account_payment/views.py similarity index 100% rename from bd_api/apps/payment/views.py rename to bd_api/apps/account_payment/views.py diff --git a/bd_api/apps/payment/webhooks.py b/bd_api/apps/account_payment/webhooks.py similarity index 100% rename from bd_api/apps/payment/webhooks.py rename to bd_api/apps/account_payment/webhooks.py diff --git a/bd_api/apps/api/v1/apps.py b/bd_api/apps/api/v1/apps.py index 8afe142e..2ea252c9 100644 --- a/bd_api/apps/api/v1/apps.py +++ b/bd_api/apps/api/v1/apps.py @@ -3,7 +3,6 @@ class ApiConfig(AppConfig): - app_label = "v1" - verbose_name = " V1" name = "bd_api.apps.api.v1" + verbose_name = " API" default_auto_field = "django.db.models.BigAutoField" 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/apps/payment/urls.py b/bd_api/apps/payment/urls.py deleted file mode 100644 index 70ade363..00000000 --- a/bd_api/apps/payment/urls.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -from django.urls import include, path - -urlpatterns = [path("", include("djstripe.urls", namespace="payment"))] diff --git a/bd_api/apps/schema.py b/bd_api/apps/schema.py index 2785e128..de4065e3 100644 --- a/bd_api/apps/schema.py +++ b/bd_api/apps/schema.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- from bd_api.apps.account.graphql import AccountMutation -from bd_api.apps.api.v1.graphql import APIQuery -from bd_api.apps.payment.graphql import ( +from bd_api.apps.account_payment.graphql import ( StripeCustomerMutation, StripePriceQuery, StripeSubscriptionCustomerMutation, StripeSubscriptionMutation, ) +from bd_api.apps.api.v1.graphql import APIQuery from bd_api.custom.graphql_auto import build_schema schema = build_schema( diff --git a/bd_api/settings/base.py b/bd_api/settings/base.py index 66372eb3..0a7ad704 100644 --- a/bd_api/settings/base.py +++ b/bd_api/settings/base.py @@ -45,6 +45,7 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", + # "health_check", "health_check.db", # @@ -56,10 +57,10 @@ "huey.contrib.djhuey", # "bd_api.apps.account", - "bd_api.apps.api.v1", "bd_api.apps.account_auth", + "bd_api.apps.account_payment.apps.PaymentConfig", + "bd_api.apps.api.v1", "bd_api.apps.core", - "bd_api.apps.payment.apps.PaymentConfig", ] MIDDLEWARE = [ diff --git a/bd_api/urls.py b/bd_api/urls.py index 1d6891c7..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.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)