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
|
|
|
|
|
2022-06-05 15:02:41 +03:00
|
|
|
|
2022-06-04 22:02:51 +03:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2022-06-16 00:32:17 +03:00
|
|
|
def get_full_operator():
|
|
|
|
usr = []
|
|
|
|
for i in Operator.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):
|
2022-06-04 22:02:51 +03:00
|
|
|
Admin.delete().where(Admin.user_id == user_id).execute()
|
2022-06-05 15:02:41 +03:00
|
|
|
|
|
|
|
|
2022-06-16 00:32:17 +03:00
|
|
|
def del_operator(user_id: int):
|
|
|
|
Operator.delete().where(Operator.user_id == user_id).execute()
|
|
|
|
|
|
|
|
|
2022-06-05 15:02:41 +03:00
|
|
|
def get_active_operator():
|
|
|
|
usr = []
|
|
|
|
for i in Operator.select().where(Operator.active==True):
|
|
|
|
usr.append(i.user_id)
|
|
|
|
return usr
|