def validation(email, password): user = Database.match(document="users", new_record={"email": email}) if user is None: return False if User.validation_password(password, user["password"]) is False: return False return True
def new_user(name, email, password): match = Database.match(document="users", new_record={"email": email}) if match is not None: return False else: User(name, email, User.encode_password(password)).add_to_database() return True
def new_reminder(email, currency, price): match = Database.match(document="all_alert", new_record={"email": email, "currency": currency}) if match is not None: return False else: Reminder(email, currency, price).add_to_database() return True
def new_watchList(email, currency, code, sell_rate, buy_rate): match = Database.match(document="preference", new_record={ "email": email, "code": code }) if match is not None: return False else: WatchList(email, currency, code, sell_rate, buy_rate).add_to_database() return True
def get_gamer_by_name(name): gamer = Database.match(document="game", new_record={"name": name}) return gamer
def getPassword(email): user = Database.match(document="users", new_record={"email": email}) return user["password"]
def get_user_by_email(email): return Database.match(document="users", new_record={"email": email})
from backends.database import Database Database.setup() print(Database.match(document="test", new_record={"name": "dolly"})) print(Database.find(document="test", new_record={"age": "3"})) print(Database.get_all(document="test")) print(Database.get_all(document="test")[0]['name']) print(Database.get_all(document="test")[1])