From c3627cac24888c36ddeea00fb434951fb86c1563 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Mon, 25 Oct 2021 20:14:55 -0400 Subject: [PATCH] Define delete types as constants --- app/init.php | 5 +++++ app/workers/deletes.php | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/init.php b/app/init.php index 7bc2d4fa3..a365eaf2d 100644 --- a/app/init.php +++ b/app/init.php @@ -93,6 +93,11 @@ const DATABASE_TYPE_DELETE_ATTRIBUTE = 'deleteAttribute'; const DATABASE_TYPE_DELETE_INDEX = 'deleteIndex'; // Deletion Types const DELETE_TYPE_DOCUMENT = 'document'; +const DELETE_TYPE_COLLECTIONS = 'collections'; +const DELETE_TYPE_PROJECTS = 'projects'; +const DELETE_TYPE_FUNCTIONS = 'functions'; +const DELETE_TYPE_USERS = 'users'; +const DELETE_TYPE_TEAMS= 'teams'; const DELETE_TYPE_EXECUTIONS = 'executions'; const DELETE_TYPE_AUDIT = 'audit'; const DELETE_TYPE_ABUSE = 'abuse'; diff --git a/app/workers/deletes.php b/app/workers/deletes.php index f507a72bb..bd663836a 100644 --- a/app/workers/deletes.php +++ b/app/workers/deletes.php @@ -38,20 +38,19 @@ class DeletesV1 extends Worker $document = new Document($document); switch ($document->getCollection()) { - // TODO@kodumbeats define these as constants somewhere - case 'collections': + case DELETE_TYPE_COLLECTIONS: $this->deleteCollection($document, $projectId); break; - case 'projects': + case DELETE_TYPE_PROJECTS: $this->deleteProject($document); break; - case 'functions': + case DELETE_TYPE_FUNCTIONS: $this->deleteFunction($document, $projectId); break; - case 'users': + case DELETE_TYPE_USERS: $this->deleteUser($document, $projectId); break; - case 'teams': + case DELETE_TYPE_TEAMS: $this->deleteMemberships($document, $projectId); break; default: