ShopBot/utils/database/base.py

31 lines
616 B
Python
Raw Normal View History

2022-06-04 22:02:51 +03:00
from .model import Admin, Operator
def get_admins():
users = []
for i in Admin.select():
users.append(i.user_id)
return users
def get_operator():
users = []
for i in Operator.select():
users.append(i.user_id)
return users
def get_full_admin():
usr = []
for i in Admin.select():
usr.append({
"user_id": i.user_id,
"first_name": i.first_name,
"last_name": i.last_name,
"username": i.username
})
return usr
def del_admin(user_id:int):
Admin.delete().where(Admin.user_id == user_id).execute()