Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 def get_gamer_by_name(name):
     gamer = Database.match(document="game", new_record={"name": name})
     return gamer
Пример #6
0
 def getPassword(email):
     user = Database.match(document="users", new_record={"email": email})
     return user["password"]
Пример #7
0
 def get_user_by_email(email):
     return Database.match(document="users", new_record={"email": email})
Пример #8
0
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])