mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add type hints. Return backup ID on creation
This commit is contained in:
parent
f0afcfbc23
commit
e5d18e5f2c
@ -200,7 +200,7 @@ class ManagementController:
|
|||||||
updates["backup_location"] = Helpers.wtol_path(updates["backup_location"])
|
updates["backup_location"] = Helpers.wtol_path(updates["backup_location"])
|
||||||
return HelpersManagement.update_backup_config(backup_id, updates)
|
return HelpersManagement.update_backup_config(backup_id, updates)
|
||||||
|
|
||||||
def add_backup_config(self, data):
|
def add_backup_config(self, data) -> str:
|
||||||
if "backup_location" in data:
|
if "backup_location" in data:
|
||||||
data["backup_location"] = Helpers.wtol_path(data["backup_location"])
|
data["backup_location"] = Helpers.wtol_path(data["backup_location"])
|
||||||
return self.management_helper.add_backup_config(data)
|
return self.management_helper.add_backup_config(data)
|
||||||
|
@ -393,9 +393,10 @@ class HelpersManagement:
|
|||||||
def remove_backup_config(backup_id):
|
def remove_backup_config(backup_id):
|
||||||
Backups.delete().where(Backups.backup_id == backup_id).execute()
|
Backups.delete().where(Backups.backup_id == backup_id).execute()
|
||||||
|
|
||||||
def add_backup_config(self, conf):
|
def add_backup_config(self, conf) -> str:
|
||||||
Backups.create(**conf)
|
backup = Backups.create(**conf)
|
||||||
logger.debug("Creating new backup record.")
|
logger.debug("Creating new backup record.")
|
||||||
|
return backup.backup_id
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_backup_config(backup_id, data):
|
def update_backup_config(backup_id, data):
|
||||||
|
Loading…
Reference in New Issue
Block a user