From 80fffe0ed49d85ffefc224c4458273c134a857a4 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 24 Aug 2021 16:15:24 +0545 Subject: [PATCH] collections count --- app/controllers/api/projects.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 7d8f4ed54c..7042281679 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -290,6 +290,9 @@ App::get('/v1/projects/:projectId/usage') $documentsCount = $dbForInternal->findOne('stats', [new Query('metric', Query::TYPE_EQUAL, ['database.documents.count'])], 0, ['time'], [Database::ORDER_DESC]); $documentsTotal = $documentsCount ? $documentsCount->getAttribute('value', 0) : 0; + + $collectionsCount = $dbForInternal->findOne('stats', [new Query('metric', Query::TYPE_EQUAL, ['database.collections.count'])], 0, ['time'], [Database::ORDER_DESC]); + $collectionsTotal = $collectionsCount ? $collectionsCount->getAttribute('value', 0) : 0; $storageTotal = $dbForInternal->findOne('stats', [new Query('metric', Query::TYPE_EQUAL, ['storage.total'])], 0, ['time'], [Database::ORDER_DESC]); $storage = $storageTotal ? $storageTotal->getAttribute('value', 0) : 0; @@ -320,6 +323,10 @@ App::get('/v1/projects/:projectId/usage') 'data' => [], 'total' => $documentsTotal, ], + 'collections' => [ + 'data' => [], + 'total' => $collectionsTotal, + ], 'users' => [ 'data' => [], 'total' => $usersTotal,