Skip to content

Commit

Permalink
made controllers operation id static #79 (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
eadwinCode authored Jul 9, 2024
1 parent 7d74a31 commit c40716b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ninja_jwt/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class TokenVerificationController(ControllerBase):
"/verify",
response={200: schema.verify_schema.get_response_schema()},
url_name="token_verify",
operation_id="token_verify",
)
def verify_token(self, token: schema.verify_schema):
return token.to_response_schema()
Expand All @@ -44,6 +45,7 @@ class TokenBlackListController(ControllerBase):
"/blacklist",
response={200: schema.blacklist_schema.get_response_schema()},
url_name="token_blacklist",
operation_id="token_blacklist",
)
def blacklist_token(self, refresh: schema.blacklist_schema):
return refresh.to_response_schema()
Expand All @@ -56,6 +58,7 @@ class TokenObtainPairController(ControllerBase):
"/pair",
response=schema.obtain_pair_schema.get_response_schema(),
url_name="token_obtain_pair",
operation_id="token_obtain_pair",
)
def obtain_token(self, user_token: schema.obtain_pair_schema):
user_token.check_user_authentication_rule()
Expand All @@ -65,6 +68,7 @@ def obtain_token(self, user_token: schema.obtain_pair_schema):
"/refresh",
response=schema.obtain_pair_refresh_schema.get_response_schema(),
url_name="token_refresh",
operation_id="token_refresh",
)
def refresh_token(self, refresh_token: schema.obtain_pair_refresh_schema):
return refresh_token.to_response_schema()
Expand All @@ -77,6 +81,7 @@ class TokenObtainSlidingController(TokenObtainPairController):
"/sliding",
response=schema.obtain_sliding_schema.get_response_schema(),
url_name="token_obtain_sliding",
operation_id="token_obtain_sliding",
)
def obtain_token(self, user_token: schema.obtain_sliding_schema):
user_token.check_user_authentication_rule()
Expand All @@ -86,6 +91,7 @@ def obtain_token(self, user_token: schema.obtain_sliding_schema):
"/sliding/refresh",
response=schema.obtain_sliding_refresh_schema.get_response_schema(),
url_name="token_refresh_sliding",
operation_id="token_refresh_sliding",
)
def refresh_token(self, refresh_token: schema.obtain_sliding_refresh_schema):
return refresh_token.to_response_schema()
Expand Down Expand Up @@ -115,6 +121,7 @@ class AsyncTokenVerificationController(TokenVerificationController):
"/verify",
response={200: schema.verify_schema.get_response_schema()},
url_name="token_verify",
operation_id="token_verify_async",
)
async def verify_token(self, token: schema.verify_schema):
return token.to_response_schema()
Expand All @@ -127,6 +134,7 @@ class AsyncTokenBlackListController(TokenBlackListController):
"/blacklist",
response={200: schema.blacklist_schema.get_response_schema()},
url_name="token_blacklist",
operation_id="token_blacklist_async",
)
async def blacklist_token(self, refresh: schema.blacklist_schema):
return refresh.to_response_schema()
Expand All @@ -137,6 +145,7 @@ class AsyncTokenObtainPairController(TokenObtainPairController):
"/pair",
response=schema.obtain_pair_schema.get_response_schema(),
url_name="token_obtain_pair",
operation_id="token_obtain_pair_async",
)
async def obtain_token(self, user_token: schema.obtain_pair_schema):
await sync_to_async(user_token.check_user_authentication_rule)()
Expand All @@ -146,6 +155,7 @@ async def obtain_token(self, user_token: schema.obtain_pair_schema):
"/refresh",
response=schema.obtain_pair_refresh_schema.get_response_schema(),
url_name="token_refresh",
operation_id="token_refresh_async",
)
async def refresh_token(self, refresh_token: schema.obtain_pair_refresh_schema):
refresh = await sync_to_async(refresh_token.to_response_schema)()
Expand All @@ -157,6 +167,7 @@ class AsyncTokenObtainSlidingController(TokenObtainSlidingController):
"/sliding",
response=schema.obtain_sliding_schema.get_response_schema(),
url_name="token_obtain_sliding",
operation_id="token_obtain_sliding_async",
)
async def obtain_token(self, user_token: schema.obtain_sliding_schema):
await sync_to_async(user_token.check_user_authentication_rule)()
Expand All @@ -166,6 +177,7 @@ async def obtain_token(self, user_token: schema.obtain_sliding_schema):
"/sliding/refresh",
response=schema.obtain_sliding_refresh_schema.get_response_schema(),
url_name="token_refresh_sliding",
operation_id="token_refresh_sliding_async",
)
async def refresh_token(self, refresh_token: schema.obtain_sliding_refresh_schema):
refresh = await sync_to_async(refresh_token.to_response_schema)()
Expand Down
1 change: 1 addition & 0 deletions ninja_jwt/routers/blacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"/blacklist",
response={200: schema.blacklist_schema.get_response_schema()},
url_name="token_blacklist",
operation_id="token_blacklist",
auth=None,
)
def blacklist_token(request, refresh: schema.blacklist_schema):
Expand Down
4 changes: 4 additions & 0 deletions ninja_jwt/routers/obtain.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"/pair",
response=schema.obtain_pair_schema.get_response_schema(),
url_name="token_obtain_pair",
operation_id="token_obtain_pair",
auth=None,
)
def obtain_token(request, user_token: schema.obtain_pair_schema):
Expand All @@ -24,6 +25,7 @@ def obtain_token(request, user_token: schema.obtain_pair_schema):
"/refresh",
response=schema.obtain_pair_refresh_schema.get_response_schema(),
url_name="token_refresh",
operation_id="token_refresh",
auth=None,
)
def refresh_token(request, refresh_token: schema.obtain_pair_refresh_schema):
Expand All @@ -34,6 +36,7 @@ def refresh_token(request, refresh_token: schema.obtain_pair_refresh_schema):
"/sliding",
response=schema.obtain_sliding_schema.get_response_schema(),
url_name="token_obtain_sliding",
operation_id="token_obtain_sliding",
auth=None,
)
def obtain_token_sliding_token(request, user_token: schema.obtain_sliding_schema):
Expand All @@ -45,6 +48,7 @@ def obtain_token_sliding_token(request, user_token: schema.obtain_sliding_schema
"/sliding/refresh",
response=schema.obtain_sliding_refresh_schema.get_response_schema(),
url_name="token_refresh_sliding",
operation_id="token_refresh_sliding",
auth=None,
)
def refresh_token_sliding(request, refresh_token: schema.obtain_sliding_refresh_schema):
Expand Down
1 change: 1 addition & 0 deletions ninja_jwt/routers/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"/verify",
response={200: schema.verify_schema.get_response_schema()},
url_name="token_verify",
operation_id="token_verify",
auth=None,
)
def verify_token(request, token: schema.verify_schema):
Expand Down

0 comments on commit c40716b

Please sign in to comment.