def post_scare(login: str, email: str, _pass: str): res = db.add_user(login=login, email=email, upass=app.hash_password(_pass), admin=False) # NOTE bad, should wait for cache expiration app.clear_caches() return json(res), 201
def get_scare_token(): return json(app.create_token()), 200
def get_hits(): return json((len(app._fsa._cache), app._fsa._cache.hits())), 200
def get_scare(): return json(db.get_user_data(login=app.get_user())), 200
def get_users_login(login: str): res = db.get_user_data(login=login) return (json(res), 200) if res else ("", 404)
def get_users(): return json(db.get_user_all()), 200
def get_stuff_sid(sid: int): res = db.get_stuff_sid(sid=sid) return (json(res), 200) if res else ("", 404)
def post_stuff(sname: str): res = db.add_stuff(sname=sname) return json(res), 201
def get_stuff(pattern: str = None): res = db.get_stuff_like(pattern=pattern) if pattern else db.get_stuff_all() return json(res), 200