Skip to content

Commit

Permalink
Merge pull request #77 from renathossain/refactor/cleanup
Browse files Browse the repository at this point in the history
Refactor/cleanup
  • Loading branch information
JoeZhou1234 authored Apr 1, 2024
2 parents 1660ea7 + 14a47ef commit 4793ea8
Show file tree
Hide file tree
Showing 21 changed files with 3 additions and 2,406 deletions.
1 change: 0 additions & 1 deletion .dev-setup/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ done
# gnome-terminal --tab --title="Auth Service" --working-directory=$PWD/backend/auth_service -- /bin/bash -c "$command; exec bash" &
gnome-terminal --tab --title="Verification Service" --working-directory=$PWD/backend/verification_service -- /bin/bash -c "python -m src.main.py; exec bash" &
gnome-terminal --tab --title="ScrapeDescription Service" --working-directory=$PWD/backend -- /bin/bash -c "source .venv/bin/activate; python scrapeDescription.py; exec bash" &
# gnome-terminal --tab --title="User Service" --working-directory=$PWD/backend/user_service -- /bin/bash -c "source .venv/bin/activate; python main.py; exec bash" &
gnome-terminal --tab --title="Prescriber Service" --working-directory=$PWD/backend/database_functions -- /bin/bash -c "source .venv/bin/activate; python database_Prescriptions.py; exec bash" &
gnome-terminal --tab --title="Authentication Service" --working-directory=$PWD/backend/auth_service -- /bin/bash -c "source .venv/bin/activate; python database_Authentications.py; exec bash" &
gnome-terminal --tab --title="Frontend" --working-directory=$PWD/frontend -- /bin/bash -c "$command; exec bash" &
2 changes: 0 additions & 2 deletions backend/api_gateway/src/middleware/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ function getService(serviceName) {
};
}

// TODO: Implement middleware to validate service registration requests

export default getService;
18 changes: 3 additions & 15 deletions backend/auth_service/database_Authentications.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

required_authentication_fields = [
"username",
"password",
# "role",
"password"
]

prescribers_collection = db["prescribers"]
Expand All @@ -35,11 +34,6 @@

# https://stackoverflow.com/questions/10434599/get-the-data-received-in-a-flask-request

# Routes
# /register - POST (username, password, role)
# /login - GET (username, password, role)
# /logout - GET (username, password)


def generate_id():
return str(uuid.uuid4())
Expand All @@ -64,7 +58,7 @@ def wrapper(*args, **kwargs):
)
return func(*args, **kwargs)

wrapper.__name__ = func.__name__ # HOTFIX: Map overwriting fix
wrapper.__name__ = func.__name__
return wrapper


Expand All @@ -78,9 +72,6 @@ def create_user_account():
password = data.get("password")
role = data.get("role")

# Additional Fields
# print(data)

# Encrypting Password
salt = bcrypt.gensalt()
hashed_password = bcrypt.hashpw(password.encode(), salt)
Expand Down Expand Up @@ -150,8 +141,7 @@ def authenticate_user():

username = data.get("username")
password = data.get("password")
# role = data.get("role")
# user = collection.find_one({"username": username, "role": role})

# username should be unique.
user = collection.find_one({"username": username})
if not user:
Expand All @@ -176,12 +166,10 @@ def authenticate_user():
authSource=cur_db_name,
authMechanism="SCRAM-SHA-256",
)
# cur_client = MongoClient(f"mongodb://{username}:{password}@{server_IP}/{db_name}")
cur_db = cur_client[cur_db_name]
cur_collection = cur_db[cur_collection_name]
test_database_operation(cur_collection)
connections.append(cur_client)
# print(">>USER", user)

# Strip password
user.pop("password")
Expand Down
1 change: 0 additions & 1 deletion backend/auth_service_old/.env

This file was deleted.

Loading

0 comments on commit 4793ea8

Please sign in to comment.