Skip to content

Commit

Permalink
Improve code formatting in routers and auth views
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro-Meireles committed Mar 3, 2025
1 parent 78649f6 commit b80bb69
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
11 changes: 8 additions & 3 deletions connect/api/v2/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ def get_available_roles(self):

def get(self, request, project_uuid: str = None):
try:
project_authorization = request.user.project_authorizations_user.get(project__uuid=project_uuid)
project_authorization = request.user.project_authorizations_user.get(
project__uuid=project_uuid
)
except ProjectAuthorization.DoesNotExist:
return Response({"error": "Project authorization not found"}, status=status.HTTP_404_NOT_FOUND)
return Response(
{"error": "Project authorization not found"},
status=status.HTTP_404_NOT_FOUND,
)

response = {
"user": request.user.email,
"project_authorization": project_authorization.role,
"available_roles": self.get_available_roles()
"available_roles": self.get_available_roles(),
}
return Response(response)
13 changes: 10 additions & 3 deletions connect/api/v2/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
TemplateFeatureViewSet,
TemplateSuggestionViewSet,
)
from connect.api.v2.commerce.views import CommerceOrganizationViewSet, CommerceProjectCheckExists
from connect.api.v2.commerce.views import (
CommerceOrganizationViewSet,
CommerceProjectCheckExists,
)
from connect.api.v2.organizations import views as organization_views
from connect.api.v2.projects import views as project_views
from connect.api.v2.internals import views as connect_internal_views
Expand Down Expand Up @@ -118,7 +121,11 @@
UserAPIToken.as_view(),
name="user-api-token",
),
path("projects/<project_uuid>/authorization", ProjectAuthView.as_view(), name="project-authorizations"),
path(
"projects/<project_uuid>/authorization",
ProjectAuthView.as_view(),
name="project-authorizations",
),
path("account/user-is-paying", UserIsPaying.as_view(), name="user-is-paying"),
path("omie/accounts", OmieAccountAPIView.as_view(), name="omie-accounts"),
path("omie/origins", OmieOriginAPIView.as_view(), name="omie-origins"),
Expand All @@ -132,7 +139,7 @@
path(
"commerce/check-project",
CommerceProjectCheckExists.as_view(),
name="check-exists-project"
name="check-exists-project",
),
path("auth/", KeycloakAuthView.as_view(), name="keycloak-auth"),
]
Expand Down

0 comments on commit b80bb69

Please sign in to comment.