better typing
This commit is contained in:
17
allfence.py
17
allfence.py
@@ -1,4 +1,5 @@
|
||||
import bcrypt
|
||||
import datetime
|
||||
|
||||
def create_user(db, login_info, user_info):
|
||||
|
||||
@@ -7,8 +8,8 @@ def create_user(db, login_info, user_info):
|
||||
|
||||
Args:
|
||||
db (psycopg2.connection): connection to postgres database
|
||||
login_info (dict of str:int): username and password info
|
||||
user_info (dict of str:int): name and dob info
|
||||
login_info (dict of str:str): username and password info
|
||||
user_info (dict of str:value): name (str) and dob (datetime.date) info
|
||||
|
||||
Returns:
|
||||
bool, str: status, message
|
||||
@@ -37,7 +38,7 @@ def get_user_details(db, user_id):
|
||||
id (int): user id
|
||||
|
||||
Returns:
|
||||
bool, dict of str to str, dict of str to str: user existance, login info (username, password), user info (name, dob)
|
||||
bool, dict of str to str, dict of str to value: user existance, login info (username, password), user info (name (str), dob (datetime.date))
|
||||
"""
|
||||
|
||||
with db:
|
||||
@@ -49,8 +50,14 @@ def get_user_details(db, user_id):
|
||||
user = user[0]
|
||||
return True, {"username": user[1], "password_hash": user[2]}, {"name": user[3], "dob": user[4]}
|
||||
|
||||
def create_event(db):
|
||||
pass
|
||||
def create_event(db, name, timestamp):
|
||||
"""
|
||||
with db:
|
||||
with db.cursor() as curs:
|
||||
curs.execute("INSERT INTO Events (name, datetime, users, results) VALUES (%s, %s, %s, %s)", (username, password_hash, name, dob))
|
||||
db.commit()
|
||||
return True, "Success"
|
||||
"""
|
||||
|
||||
def finish_event(db, event):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user