Esempio n. 1
0
    def get_user(user: User):
        request = DBRequest()

        data = RequestsHelper.get_user(user, request)

        request.close()

        return data
Esempio n. 2
0
    def create_status(user: User, start_status):
        request = DBRequest()

        RequestsHelper.create_status(request, user, start_status)

        request.complete()
        request.close()
Esempio n. 3
0
    def update_password(user: User):
        request = DBRequest()

        RequestsHelper.update_password(user, request)

        request.complete()
        request.close()
Esempio n. 4
0
    def delete_user(user: User):
        request = DBRequest()

        RequestsHelper.delete_user(user, request)

        request.complete()
        request.close()
Esempio n. 5
0
    def update_name(user: User):
        request = DBRequest()

        RequestsHelper.update_uname(user, request)

        request.complete()
        request.close()
Esempio n. 6
0
    def set_tabnr(user: User):
        request = DBRequest()

        RequestsHelper.set_tabnr(request, user)

        request.complete()
        request.close()
Esempio n. 7
0
    def insert_user_v2(user: User):
        request = DBRequest()

        RequestsHelper.insert_user_v2(user, request)

        request.complete()
        request.close()
Esempio n. 8
0
    def change_status(user: User, new_status):
        request = DBRequest()

        RequestsHelper.change_status(request, user, new_status)

        request.complete()
        request.close()
Esempio n. 9
0
    def get_all_users():
        request = DBRequest()

        data = RequestsHelper.get_all_users(request)

        request.complete()
        request.close()

        return data
Esempio n. 10
0
    def get_status(user: User):
        request = DBRequest()

        status = RequestsHelper.get_status(user)

        request.complete()
        request.close()

        return status
Esempio n. 11
0
    def check_password(user: User):
        request = DBRequest()

        data = RequestsHelper.get_user(user, request)

        request.complete()
        request.close()

        # Здесь добавить проверку на корректность пароля
        if not data[0][2]:
            return False
        return True
Esempio n. 12
0
 def get_user(user: User, request: DBRequest):
     cursor = request.get_cursor()
     cursor.execute(f"SELECT * FROM users WHERE _id = '{user.get_id()}'")
     return cursor.fetchall()
Esempio n. 13
0
 def change_status(request: DBRequest, user: User, new_status):
     cursor = request.get_cursor()
     cursor.execute(
         f"UPDATE user_statuses SET status = '{new_status}' WHERE _id = '{user.get_id()}'"
     )
Esempio n. 14
0
 def create_status(request: DBRequest, user: User, start_status):
     cursor = request.get_cursor()
     cursor.execute(
         f"INSERT INTO user_statuses VALUES('{user.get_id()}', '{start_status}')"
     )
Esempio n. 15
0
 def get_all_users(request: DBRequest):
     cursor = request.get_cursor()
     cursor.execute(f"SELECT * FROM users")
     return cursor.fetchall()
Esempio n. 16
0
 def delete_user(user: User, request: DBRequest):
     cursor = request.get_cursor()
     cursor.execute(f"DELETE FROM users WHERE _id = '{user.get_id()}'")
Esempio n. 17
0
 def update_password(user: User, request: DBRequest):
     cursor = request.get_cursor()
     cursor.execute(
         f"UPDATE users SET password = '******' WHERE _id = '{user.get_id()}'"
     )
Esempio n. 18
0
 def update_uname(user: User, request: DBRequest):
     cursor = request.get_cursor()
     cursor.execute(
         f"UPDATE users SET uname = '{user.get_uname()}' WHERE _id = '{user.get_id()}'"
     )
Esempio n. 19
0
 def set_tabnr(request: DBRequest, user: User):
     cursor = request.get_cursor()
     cursor.execute(
         f"UPDATE users SET tabnr = '{user.get_tabnr()}' WHERE _id = '{user.get_id()}'"
     )
Esempio n. 20
0
 def get_status(request: DBRequest, user: User):
     cursor = request.get_cursor()
     cursor.execute(
         f"SELECT status FROM user_statuses WHERE _id = '{user.get_id()}'")
Esempio n. 21
0
 def insert_user_v2(user: User, request: DBRequest):
     cursor = request.get_cursor()
     cursor.execute(
         f"INSERT INTO users VALUES ('{user.get_id()}', '{user.get_uname()}',  '{user.get_password()}', '{user.get_tabnr()}')"
     )