Updated database schema. Removed old versions
parent
eb5aff8e7f
commit
38eb3775f1
|
@ -24,8 +24,8 @@ resources:
|
|||
|
||||
image_ogrepository_sync:
|
||||
shortName: OgRepository Server
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
class: ApiPlatform\Metadata\Get
|
||||
method: GET
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/sync
|
||||
controller: App\Controller\OgRepository\SyncAction
|
||||
|
|
|
@ -50,6 +50,11 @@ class StatusAction extends AbstractController
|
|||
if ($client->getStatus() === ClientStatus::LINUX) {
|
||||
$this->getSOStatus($client);
|
||||
}
|
||||
|
||||
return new JsonResponse(
|
||||
data: ['status' => $client->getStatus()],
|
||||
status: Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function getOgLiveStatus (Client $client): JsonResponse
|
||||
|
|
|
@ -21,9 +21,9 @@ class GetCollectionAction extends AbstractOgRepositoryController
|
|||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(ImageRepository $data, HttpClientInterface $httpClient): JsonResponse
|
||||
public function __invoke(ImageRepository $data): JsonResponse
|
||||
{
|
||||
$content = $this->createRequest($httpClient, 'GET', 'http://'.$data->getIp(). '/ogrepository/v1/images');
|
||||
$content = $this->createRequest('GET', 'http://'.$data->getIp(). ':8006/ogrepository/v1/images');
|
||||
|
||||
return new JsonResponse( data: $content, status: Response::HTTP_OK);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Controller\OgRepository;
|
|||
|
||||
use App\Entity\Image;
|
||||
use App\Entity\ImageRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use App\Model\ImageStatus;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\AsController;
|
||||
|
@ -12,7 +12,6 @@ use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
|||
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
#[AsController]
|
||||
class SyncAction extends AbstractOgRepositoryController
|
||||
|
@ -23,9 +22,9 @@ class SyncAction extends AbstractOgRepositoryController
|
|||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(ImageRepository $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse
|
||||
public function __invoke(ImageRepository $data): JsonResponse
|
||||
{
|
||||
$content = $this->createRequest($httpClient, 'GET', 'http://'.$data->getIp(). '/ogrepository/v1/images');
|
||||
$content = $this->createRequest('GET', 'http://'.$data->getIp(). ':8006/ogrepository/v1/images');
|
||||
|
||||
if (!isset($content['output']['REPOSITORY']['images'])) {
|
||||
return new JsonResponse(data: 'No images found', status: Response::HTTP_NOT_FOUND);
|
||||
|
@ -36,6 +35,9 @@ class SyncAction extends AbstractOgRepositoryController
|
|||
if (!$imageEntity) {
|
||||
$imageEntity = new Image();
|
||||
$imageEntity->setName($image['name'].$image['type']);
|
||||
$imageEntity->setStatus(ImageStatus::SUCCESS);
|
||||
$imageEntity->setRepository($data);
|
||||
$imageEntity->setCreated(true );
|
||||
$imageEntity->setImageFullsum($image['fullsum']);
|
||||
$imageEntity->setRemotePc(false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue