Refine
This commit is contained in:
@@ -15,12 +15,12 @@ class User(object):
|
|||||||
return { 'type': self.type, 'id': self.id }
|
return { 'type': self.type, 'id': self.id }
|
||||||
|
|
||||||
|
|
||||||
def get_user_schema(name: str) -> dict[str, dict[str, Any]]:
|
def get_user_schema(name: str) -> dict[str, dict[Any, Any]]:
|
||||||
return { 'id' : {'type': 'str' , 'optional': False , 'readonly': True },
|
return { 'id' : {'type': 'str' , 'optional': False , 'readonly': True },
|
||||||
'name' : {'type': 'str' , 'optional': False , 'readonly': False},
|
'name' : {'type': 'str' , 'optional': False , 'readonly': False},
|
||||||
'password' : {'type': 'str' , 'optional': False , 'readonly': False} }
|
'password' : {'type': 'str' , 'optional': False , 'readonly': False} }
|
||||||
|
|
||||||
def get_user(name: str, user_name: str) -> dict[str, Any]:
|
def get_user(name: str, user_name: str) -> dict[Any, Any]:
|
||||||
t = try_read(name, f"select * from users where username = '{user_name}'")
|
t = try_read(name, f"select * from users where username = '{user_name}'")
|
||||||
if t == None:
|
if t == None:
|
||||||
return {}
|
return {}
|
||||||
@@ -32,6 +32,6 @@ def get_user(name: str, user_name: str) -> dict[str, Any]:
|
|||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def get_all_users(name: str) -> list[dict[str, Any]]:
|
def get_all_users(name: str) -> list[dict[Any, Any]]:
|
||||||
return read_all(name, "select * from users")
|
return read_all(name, "select * from users")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user