Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjustshubh committed Feb 4, 2024
2 parents cda19f0 + dfabcf8 commit 58dafd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 40 deletions.
42 changes: 3 additions & 39 deletions Backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,12 @@ def change_pass_w_old(db,USER_NAME,old_password,new_password):
return 1


def change_username(db,CURRENT_USER_NAME,NEW_USER_NAME):
if CURRENT_USER_NAME==NEW_USER_NAME:
return 0
def change_name(db,CURRENT_USER_NAME,NEW_USER):
document = db.users
existing_user = document.find_one({"User": CURRENT_USER_NAME})
if existing_user:
existing_user["USER_NAME"]=NEW_USER_NAME
document.update_one({"User": CURRENT_USER_NAME}, {"$set": {"USER_NAME": NEW_USER_NAME}})
existing_user["Real_Name"]=NEW_USER
document.update_one({"User": CURRENT_USER_NAME}, {"$set": {"Real_Name": NEW_USER}})
else:
print("Username not found")
return 1
Expand Down Expand Up @@ -108,37 +106,3 @@ def change_username(db,CURRENT_USER_NAME,NEW_USER_NAME):
"""



"""
if existing_user["Crossings"]
if "Crossings" not in existing_user:
existing_user["Crossings"] = []
existing_user["Crossings"] = []
update = {"$set": {"field_to_update": "new_value"}}
result = collection.update_one("User": USER_NAME, update)
"""
"""
#also take time
"""


"""
Givens:
User {
Real Name
User_Name
Password
Email
Connections: set(
)
}
{
Connection UserName : set()
location
}
"""
3 changes: 2 additions & 1 deletion Backend/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pymongo import MongoClient
import os
from dotenv import load_dotenv
from main import add_user, add_crossings,change_pass_w_old,change_username
from main import add_user, add_crossings,change_pass_w_old,change_name


load_dotenv()
Expand All @@ -22,3 +22,4 @@

#change_pass_w_old(db,"Bob","123","345")

#change_name(db,"Sam","bb")

0 comments on commit 58dafd0

Please sign in to comment.