From f8884ab93e8368e47e98fb2b34fbe1349f4d4fca Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Sun, 23 Jun 2024 19:10:42 -0400 Subject: [PATCH] Refactor api handler to use constant id error --- .../routes/api/servers/server/backups/backup/index.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/classes/web/routes/api/servers/server/backups/backup/index.py b/app/classes/web/routes/api/servers/server/backups/backup/index.py index fed6af46..35170e3b 100644 --- a/app/classes/web/routes/api/servers/server/backups/backup/index.py +++ b/app/classes/web/routes/api/servers/server/backups/backup/index.py @@ -49,6 +49,7 @@ BASIC_BACKUP_PATCH_SCHEMA = { "additionalProperties": False, "minProperties": 1, } +ID_MISMATCH = "Server ID backup server ID different" class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler): @@ -69,7 +70,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler): { "status": "error", "error": "ID_MISMATCH", - "error_data": "Server ID backup server ID different", + "error_data": ID_MISMATCH, }, ) server_permissions = self.controller.server_perms.get_permissions(mask) @@ -94,7 +95,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler): { "status": "error", "error": "ID_MISMATCH", - "error_data": "Server ID backup server ID different", + "error_data": ID_MISMATCH, }, ) if not auth_data: @@ -165,7 +166,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler): { "status": "error", "error": "ID_MISMATCH", - "error_data": "Server ID backup server ID different", + "error_data": ID_MISMATCH, }, ) @@ -338,7 +339,7 @@ class ApiServersServerBackupsBackupIndexHandler(BaseApiHandler): { "status": "error", "error": "ID_MISMATCH", - "error_data": "Server ID backup server ID different", + "error_data": ID_MISMATCH, }, ) mask = self.controller.server_perms.get_lowest_api_perm_mask( @@ -372,7 +373,7 @@ class ApiServersServerBackupsBackupFilesIndexHandler(BaseApiHandler): { "status": "error", "error": "ID_MISMATCH", - "error_data": "Server ID backup server ID different", + "error_data": ID_MISMATCH, }, ) if not auth_data: