From eab18af07e50f74266f2bbd9dfc42f623281b1ef Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 3 May 2021 13:25:05 +0300 Subject: [PATCH] Added support for count --- app/controllers/api/storage.php | 6 ++---- composer.lock | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index ff9fe9467..d90a46702 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -179,11 +179,9 @@ App::get('/v1/storage/files') /** @var Appwrite\Utopia\Response $response */ /** @var Utopia\Database\Database $dbForInternal */ - $results = $dbForInternal->find('files', [], $limit, $offset); - $response->dynamic2(new Document([ - 'sum' => $limit, - 'files' => $results + 'sum' => $dbForInternal->count('files', [], 5000), + 'files' => $dbForInternal->find('files', [], $limit, $offset) ]), Response::MODEL_FILE_LIST); }); diff --git a/composer.lock b/composer.lock index 50dbbb380..b15378c86 100644 --- a/composer.lock +++ b/composer.lock @@ -1923,7 +1923,7 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database", - "reference": "518265a14702f61a35b95d4ae25c8b23e7c2b478" + "reference": "81a16f851c712f5857c044c0e71c0abc698cd619" }, "require": { "ext-mongodb": "*", @@ -1970,7 +1970,7 @@ "upf", "utopia" ], - "time": "2021-05-02T18:26:42+00:00" + "time": "2021-05-03T09:59:14+00:00" }, { "name": "utopia-php/domains",