39 lines
765 B
Python
39 lines
765 B
Python
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()
|
|
|
|
|
|
def get_active_operator():
|
|
usr = []
|
|
for i in Operator.select().where(Operator.active==True):
|
|
usr.append(i.user_id)
|
|
return usr
|