mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Make some model removals way more efficient
This commit is contained in:
parent
65ba65a67d
commit
fbf820fd38
@ -264,8 +264,7 @@ class HelpersManagement:
|
||||
|
||||
@staticmethod
|
||||
def delete_scheduled_task(schedule_id):
|
||||
sch = Schedules.get(Schedules.schedule_id == schedule_id)
|
||||
return Schedules.delete_instance(sch)
|
||||
return Schedules.delete().where(Schedules.schedule_id == schedule_id).execute()
|
||||
|
||||
@staticmethod
|
||||
def update_scheduled_task(schedule_id, updates):
|
||||
|
@ -64,9 +64,7 @@ class HelperRoles:
|
||||
return Roles.update(up_data).where(Roles.role_id == role_id).execute()
|
||||
|
||||
def remove_role(self, role_id):
|
||||
with self.database.atomic():
|
||||
role = Roles.get(Roles.role_id == role_id)
|
||||
return role.delete_instance()
|
||||
return Roles.delete().where(Roles.role_id == role_id).execute()
|
||||
|
||||
@staticmethod
|
||||
def role_id_exists(role_id):
|
||||
|
@ -128,7 +128,6 @@ class HelperServers:
|
||||
return server_obj.save()
|
||||
|
||||
def remove_server(self, server_id):
|
||||
with self.database.atomic():
|
||||
Servers.delete().where(Servers.server_id == server_id).execute()
|
||||
|
||||
@staticmethod
|
||||
|
@ -224,8 +224,7 @@ class HelperUsers:
|
||||
def remove_user(self, user_id):
|
||||
with self.database.atomic():
|
||||
UserRoles.delete().where(UserRoles.user_id == user_id).execute()
|
||||
user = Users.get(Users.user_id == user_id)
|
||||
return user.delete_instance()
|
||||
Users.delete().where(Users.user_id == user_id).execute()
|
||||
|
||||
@staticmethod
|
||||
def set_support_path(user_id, support_path):
|
||||
|
Loading…
Reference in New Issue
Block a user