From 24925d2eb259ea003f945c8cf7d6a7f5a0bf6bb8 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 20 Aug 2021 17:40:52 +0530 Subject: [PATCH] feat(usage): cleanup comments --- app/controllers/api/database.php | 5 ++--- app/controllers/api/storage.php | 4 +++- app/controllers/api/users.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index c167c2f6dd..ddbbe7e39b 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -249,7 +249,7 @@ App::get('/v1/database/collections/:collectionId') }); App::get('/v1/database/usage') - ->desc('Get Database Usage') + ->desc('Get usage stats for the database') ->groups(['api', 'database']) ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -258,7 +258,6 @@ App::get('/v1/database/usage') ->param('range', '30d', new WhiteList(['24h', '7d', '30d', '90d'], true), 'Date range.', true) ->inject('response') ->inject('dbForInternal') - ->inject('register') ->action(function ($range, $response, $dbForInternal) { /** @var Appwrite\Utopia\Response $response */ /** @var Utopia\Database\Database $dbForConsole */ @@ -399,7 +398,7 @@ App::get('/v1/database/usage') App::get('/v1/database/:collectionId/usage') - ->desc('Get Database Usage for a collection') + ->desc('Get usage stats for a collection') ->groups(['api', 'database']) ->label('scope', 'collections.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index d167ee88b7..0800f2ac65 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -645,7 +645,7 @@ App::delete('/v1/storage/files/:fileId') }); App::get('/v1/storage/:bucketId/usage') - ->desc('Get Bucket Usage') + ->desc('Get usage stats for a storage bucket') ->groups(['api', 'storage']) ->label('scope', 'storage.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) @@ -660,6 +660,8 @@ App::get('/v1/storage/:bucketId/usage') /** @var Appwrite\Utopia\Response $response */ /** @var Utopia\Database\Database $dbForInternal */ + // TODO: Check is the storage bucket exists else throw 404 + $stats = []; if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $period = [ diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 45d4eb03ed..6d82c4f472 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -610,7 +610,7 @@ App::delete('/v1/users/:userId') }); App::get('/v1/users/usage') - ->desc('Get Users Usage') + ->desc('Get usage stats for the users API') ->groups(['api', 'users']) ->label('scope', 'users.read') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])