Add type hints. Return backup ID on creation

This commit is contained in:
amcmanu3 2024-06-14 19:30:43 -04:00
parent f0afcfbc23
commit e5d18e5f2c
2 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -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):