Skip to content

Commit

Permalink
Merge pull request #90 from mayureshagashe2105/prod
Browse files Browse the repository at this point in the history
Patch
  • Loading branch information
HemanthSai7 committed Aug 6, 2023
2 parents d06fe06 + 810cb26 commit 9fc7f44
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
12 changes: 8 additions & 4 deletions API/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
actions that are required to be performed only once.
"""

from fastapi import FastAPI
from fastapi import FastAPI, status
from fastapi.exceptions import HTTPException

from pymongo.errors import ServerSelectionTimeoutError

app = FastAPI(title="Connecting Villages API",version="V0.2.0",description="API for Connecting Villages")

Expand All @@ -20,7 +23,8 @@
# inits
try:
dbconnection = DBConnection()
print(f"Connection successful:{dbconnection.get_client()}")
except Exception as e:
print(e)
test_conn = DBConnection.get_client().server_info()

except ServerSelectionTimeoutError as e:
raise HTTPException(status_code=status.HTTP_503_SERVICE_UNAVAILABLE)

4 changes: 2 additions & 2 deletions API/services/auth/utils/Auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


ACCESS_TOKEN_EXPIRE_MINUTES = 30 # 30 minutes
REFRESH_TOKEN_EXPIRE_MINUTES = 60 * 24 * 3 # 3 days
REFRESH_TOKEN_EXPIRE_MINUTES = 60 * 3 # 3 hours


class Auth:
Expand Down Expand Up @@ -139,7 +139,7 @@ def generate_access_tokens_from_refresh_tokens(token: str) -> TokenSchema:
except (jwt.JWTError, ValidationError):
raise LoginFailedException(tokens)
tokens['access_token'] = Auth.create_access_token(token_data.sub)
tokens['refresh_token'] = Auth.create_refresh_token(token_data.sub)
tokens['refresh_token'] = token # Do not generate new `REFRESH_ACCESS_TOKEN`, instead, return the original
tokens['status'] = 'login successful'
tokens['role'] = token_data.sub.split("_")[1]
return tokens
Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @mayureshagashe2105 @HemanthSai7

# DB Generic Queries
./API/services/db/* @HemanthSai7 @mayureshagashe2105
./API/services/db/utils/* @HemanthSai7
/API/services/db/* @HemanthSai7 @mayureshagashe2105
/API/services/db/utils/* @HemanthSai7

# Auth processes
/API/services/auth/* @mayureshagashe2105
Expand Down
4 changes: 2 additions & 2 deletions tests/login_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# from dotenv import load_dotenv
# load_dotenv()

# BASE_URL = "https://ubaformapi-git-prod-fastapis-build.vercel.app" # for GitHub actions
BASE_URL = "https://ubaformapi-git-prod-fastapis-build.vercel.app" # for GitHub actions
# BASE_URL = "http://127.0.0.1:8000" # for testing locally
BASE_URL = "https://ubaformapi-git-fastapi01000andpydanticv2c-80d502-fastapis-build.vercel.app"
# BASE_URL = "https://ubaformapi-git-fastapi01000andpydanticv2c-80d502-fastapis-build.vercel.app"


def get_access_token(data, return_refresh_token=False):
Expand Down

0 comments on commit 9fc7f44

Please sign in to comment.