From 8a7da6e146123bf8781932be1017a5a822f2be35 Mon Sep 17 00:00:00 2001 From: gourav Date: Sun, 11 Aug 2024 20:06:53 +0530 Subject: [PATCH] Folder structure change for backend --- backend/__init__.py | 0 auth.py => backend/auth.py | 4 +--- crypto.py => backend/crypto.py | 0 main.py => backend/main.py | 12 ++++++------ migration.py => backend/migration.py | 0 models.py => backend/models.py | 0 queries.py => backend/queries.py | 0 7 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 backend/__init__.py rename auth.py => backend/auth.py (98%) rename crypto.py => backend/crypto.py (100%) rename main.py => backend/main.py (92%) rename migration.py => backend/migration.py (100%) rename models.py => backend/models.py (100%) rename queries.py => backend/queries.py (100%) diff --git a/backend/__init__.py b/backend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/auth.py b/backend/auth.py similarity index 98% rename from auth.py rename to backend/auth.py index 7b13f3c..c7eead7 100644 --- a/auth.py +++ b/backend/auth.py @@ -1,6 +1,4 @@ import datetime -import json -import os from typing import Any, Union import bcrypt @@ -9,7 +7,7 @@ from fastapi import Depends, HTTPException, status from fastapi.security import HTTPBearer from jwt.exceptions import InvalidTokenError -import queries +import backend.queries as queries ACCESS_TOKEN_EXPIRE_MINUTES = 30 # 30 minutes ALGORITHM = "HS256" diff --git a/crypto.py b/backend/crypto.py similarity index 100% rename from crypto.py rename to backend/crypto.py diff --git a/main.py b/backend/main.py similarity index 92% rename from main.py rename to backend/main.py index 5a4e28c..e4094ca 100644 --- a/main.py +++ b/backend/main.py @@ -6,12 +6,12 @@ from fastapi import Depends, FastAPI, HTTPException, status from fastapi.encoders import jsonable_encoder from fastapi.middleware.cors import CORSMiddleware -import queries -from auth import Hasher, create_access_token, get_current_user -from crypto import (deserialize_into_bytes, fernet_decrypt, fernet_encrypt, - generate_random_encryption_key, generate_user_passkey, - serialize_bytes) -from models import Key, Secret, User, UserLogin +import backend.queries as queries +from backend.auth import Hasher, create_access_token, get_current_user +from backend.crypto import (deserialize_into_bytes, fernet_decrypt, + fernet_encrypt, generate_random_encryption_key, + generate_user_passkey, serialize_bytes) +from backend.models import Key, Secret, User, UserLogin app = FastAPI() diff --git a/migration.py b/backend/migration.py similarity index 100% rename from migration.py rename to backend/migration.py diff --git a/models.py b/backend/models.py similarity index 100% rename from models.py rename to backend/models.py diff --git a/queries.py b/backend/queries.py similarity index 100% rename from queries.py rename to backend/queries.py