1
0
Fork 0
mirror of synced 2024-06-29 11:40:45 +12:00

collections count

This commit is contained in:
Damodar Lohani 2021-08-24 16:15:24 +05:45
parent 218b332b0f
commit 80fffe0ed4

View file

@ -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]); $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; $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]); $storageTotal = $dbForInternal->findOne('stats', [new Query('metric', Query::TYPE_EQUAL, ['storage.total'])], 0, ['time'], [Database::ORDER_DESC]);
$storage = $storageTotal ? $storageTotal->getAttribute('value', 0) : 0; $storage = $storageTotal ? $storageTotal->getAttribute('value', 0) : 0;
@ -320,6 +323,10 @@ App::get('/v1/projects/:projectId/usage')
'data' => [], 'data' => [],
'total' => $documentsTotal, 'total' => $documentsTotal,
], ],
'collections' => [
'data' => [],
'total' => $collectionsTotal,
],
'users' => [ 'users' => [
'data' => [], 'data' => [],
'total' => $usersTotal, 'total' => $usersTotal,