From 0e30f6533e574abf4f64e62fdd869511610f2e61 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 22 Jan 2024 09:54:09 +0200 Subject: [PATCH] Added marked_for_deletion and billing_plan_downgrade to hamster export --- src/Appwrite/Platform/Workers/Hamster.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Hamster.php b/src/Appwrite/Platform/Workers/Hamster.php index 0da625c543..dcc4404dda 100644 --- a/src/Appwrite/Platform/Workers/Hamster.php +++ b/src/Appwrite/Platform/Workers/Hamster.php @@ -367,19 +367,19 @@ class Hamster extends Action throw new \Exception('Membership not found. Skipping organization : ' . $organization->getId()); } - $billingPlan = $membership->getAttribute('billingPlan', null); - $billingPlanDowngrade = $membership->getAttribute('billingPlanDowngrade', null); + $billingPlan = $organization->getAttribute('billingPlan', null); + $billingPlanDowngrade = $organization->getAttribute('billingPlanDowngrade', null); if (!empty($billingPlan) && is_null($billingPlanDowngrade)) { $statsPerOrganization['billing_plan'] = $billingPlan; } if (in_array($billingPlan, ['tier-1', 'tier-2'])) { - $billingStartDate = $membership->getAttribute('billingStartDate', null); + $billingStartDate = $organization->getAttribute('billingStartDate', null); $statsPerOrganization['billing_start_date'] = $billingStartDate; } - $statsPerOrganization['marked_for_deletion'] = $membership->getAttribute('markedForDeletion', 0); + $statsPerOrganization['marked_for_deletion'] = $organization->getAttribute('markedForDeletion', 0); $statsPerOrganization['billing_plan_downgrade'] = $billingPlanDowngrade; $userId = $membership->getAttribute('userId', null); @@ -424,20 +424,20 @@ class Hamster extends Action try { $statsPerUser = []; - $membership = $dbForConsole->findOne('teams', [ + $organization = $dbForConsole->findOne('teams', [ Query::equal('userInternalId', [$user->getInternalId()]) ]); - if (!empty($membership) || !$membership->isEmpty()) { - $billingPlan = $membership->getAttribute('billingPlan', null); - $billingPlanDowngrade = $membership->getAttribute('billingPlanDowngrade', null); + if (!empty($organization) || !$organization->isEmpty()) { + $billingPlan = $organization->getAttribute('billingPlan', null); + $billingPlanDowngrade = $organization->getAttribute('billingPlanDowngrade', null); if (!empty($billingPlan) && is_null($billingPlanDowngrade)) { $statsPerUser['billing_plan'] = $billingPlan; } if (in_array($billingPlan, ['tier-1', 'tier-2'])) { - $billingStartDate = $membership->getAttribute('billingStartDate', null); + $billingStartDate = $organization->getAttribute('billingStartDate', null); $statsPerUser['billing_start_date'] = $billingStartDate; } }