1
0
Fork 0
mirror of synced 2024-09-30 17:26:48 +13:00

Apply suggestions from code review

Co-authored-by: Christy Jacob <christyjacob4@gmail.com>
This commit is contained in:
Matej Bačo 2021-12-15 11:06:26 +01:00 committed by GitHub
parent 5d373e1ce7
commit 77d6ea8890
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View file

@ -355,15 +355,15 @@ App::get('/v1/health/anti-virus')
(int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310)); (int) App::getEnv('_APP_STORAGE_ANTIVIRUS_PORT', 3310));
try { try {
$output['version'] = @$antiVirus->version(); $output['version'] = @$antivirus->version();
$output['status'] = (@$antiVirus->ping()) ? 'pass' : 'fail'; $output['status'] = (@$antivirus->ping()) ? 'pass' : 'fail';
} catch( \Exception $e) { } catch( \Exception $e) {
$output['status'] = 'offline'; $output['status'] = 'offline';
$output['version'] = ''; $output['version'] = '';
} }
} }
$response->dynamic(new Document($output), Response::MODEL_HEALTH_STATUS); $response->dynamic(new Document($output), Response::MODEL_HEALTH_ANTIVIRUS);
}); });
App::get('/v1/health/stats') // Currently only used internally App::get('/v1/health/stats') // Currently only used internally

View file

@ -5,20 +5,20 @@ namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response; use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response\Model;
class HealthAntiVirus extends Model class HealthAntivirus extends Model
{ {
public function __construct() public function __construct()
{ {
$this $this
->addRule('version', [ ->addRule('version', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'AntiVirus version.', 'description' => 'Antivirus version.',
'default' => '', 'default' => '',
'example' => '1.0.0', 'example' => '1.0.0',
]) ])
->addRule('status', [ ->addRule('status', [
'type' => self::TYPE_STRING, 'type' => self::TYPE_STRING,
'description' => 'AntiVirus status. Possible values can are: `disabled`, `offline`, `online`', 'description' => 'Antivirus status. Possible values can are: `disabled`, `offline`, `online`',
'default' => '', 'default' => '',
'example' => 'online', 'example' => 'online',
]) ])
@ -32,11 +32,11 @@ class HealthAntiVirus extends Model
*/ */
public function getName():string public function getName():string
{ {
return 'Health AntiVirus'; return 'Health Antivirus';
} }
/** /**
* Get Collection * Get Type
* *
* @return string * @return string
*/ */

View file

@ -10,7 +10,7 @@ class HealthStatus extends Model
public function __construct() public function __construct()
{ {
$this $this
->addRule('checkTime', [ ->addRule('ping', [
'type' => self::TYPE_INTEGER, 'type' => self::TYPE_INTEGER,
'description' => 'Duration in milliseconds how long the health check took.', 'description' => 'Duration in milliseconds how long the health check took.',
'default' => 0, 'default' => 0,

View file

@ -10,13 +10,13 @@ class HealthTime extends Model
public function __construct() public function __construct()
{ {
$this $this
->addRule('remote', [ ->addRule('remoteTime', [
'type' => self::TYPE_INTEGER, 'type' => self::TYPE_INTEGER,
'description' => 'Current unix timestamp on trustful remote server.', 'description' => 'Current unix timestamp on trustful remote server.',
'default' => 0, 'default' => 0,
'example' => 1639490751, 'example' => 1639490751,
]) ])
->addRule('local', [ ->addRule('localTime', [
'type' => self::TYPE_INTEGER, 'type' => self::TYPE_INTEGER,
'description' => 'Current unix timestamp of local server where Appwrite runs.', 'description' => 'Current unix timestamp of local server where Appwrite runs.',
'default' => 0, 'default' => 0,

View file

@ -30,7 +30,7 @@ class HealthVersion extends Model
} }
/** /**
* Get Collection * Get Type
* *
* @return string * @return string
*/ */