Commit 68706de9 authored by Laura Heimann's avatar Laura Heimann

minimized client code, added file path to api endpoint

parent 8a886d0e
...@@ -31,10 +31,7 @@ class APIClientController extends AbstractController ...@@ -31,10 +31,7 @@ class APIClientController extends AbstractController
$data = []; $data = [];
$latestVersion = $em->getRepository(ClientRelease::class)->findOneBy(array('platform' => $platform), array('majorVersion' => 'DESC', 'minorVersion' => 'DESC', 'patchVersion' => 'DESC')); $latestVersion = $em->getRepository(ClientRelease::class)->findOneBy(array('platform' => $platform), array('majorVersion' => 'DESC', 'minorVersion' => 'DESC', 'patchVersion' => 'DESC'));
$data['stringVersion'] = $latestVersion->getMajorVersion().".".$latestVersion->getMinorVersion().".".$latestVersion->getPatchVersion(); $data = $latestVersion->getJSON();
$data['majorVersion'] = $latestVersion->getMajorVersion();
$data['minorVersion'] = $latestVersion->getMinorVersion();
$data['patchVersion'] = $latestVersion->getPatchVersion();
$response = new JsonResponse(['version' => $this->getParameter('api_version'), 'status' => 200, 'data' => $data]); $response = new JsonResponse(['version' => $this->getParameter('api_version'), 'status' => 200, 'data' => $data]);
return $response; return $response;
......
...@@ -123,4 +123,17 @@ class ClientRelease ...@@ -123,4 +123,17 @@ class ClientRelease
return $this; return $this;
} }
public function getJSON() {
return array(
'id' => $this->id,
'uploadDate' => $this->uploadDate,
'stringVersion' => $this->majorVersion.'.'.$this->minorVersion.'.'.$this->patchVersion,
'majorVersion' => $this->majorVersion,
'minorVersion' => $this->minorVersion,
'patchVersion' => $this->patchVersion,
'platform' => $this->platform,
'path' => $_ENV['ASSET_BASE_URL']."/".$_ENV['ASSET_CLIENT_FOLDER']."/".$this->fileReference,
);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment