added version command and api endpoint (#321)

This commit is contained in:
Kevin Papst
2018-09-24 15:56:29 +02:00
committed by GitHub
parent 73e0a75585
commit 7bcd6a6382
15 changed files with 222 additions and 24 deletions

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace App\API;
use App\Constants;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\View\View;
use FOS\RestBundle\View\ViewHandlerInterface;
@@ -46,4 +47,25 @@ class HealthcheckController extends Controller
return $this->viewHandler->handle($view);
}
/**
* @SWG\Response(
* response=200,
* description="Returns version information about the current release",
* )
*
* @Rest\Get(path="/version")
*/
public function versionAction()
{
$version = [
'version' => Constants::VERSION,
'candidate' => Constants::STATUS,
'semver' => Constants::VERSION . '-' . Constants::STATUS,
'name' => Constants::NAME,
'copyright' => 'Kimai 2 - ' . Constants::VERSION . ' ' . Constants::STATUS . ' (' . Constants::NAME . ') by Kevin Papst and contributors.',
];
return $this->viewHandler->handle(new View($version, 200));
}
}