Added image loader
testing/ogcore-api/pipeline/head There was a failure building this commit Details

develop-jenkins
Manuel Aranda Rosales 2024-10-08 17:27:48 +02:00
parent 29a222bc96
commit 07b6f55310
3 changed files with 36 additions and 3 deletions

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Command;
use App\Entity\Client;
use App\Entity\Image;
use App\Entity\OrganizationalUnit;
use App\Model\OrganizationalUnitTypes;
use App\Model\UserGroupPermissions;
@ -100,6 +101,24 @@ class LoadOrganizationalUnitDefaultCommand extends Command
]
];
$images = [
[
'name' => 'Imagen Test 1',
'type' => 'ISO',
'path' => '/path/to/imagen1.iso'
],
[
'name' => 'Imagen Test 2',
'type' => 'ISO',
'path' => '/path/to/imagen2.iso'
],
[
'name' => 'Imagen Test 3',
'type' => 'ISO',
'path' => '/path/to/imagen3.iso'
]
];
foreach ($organizationalUnits as $organizationalUnit) {
$organizationalUnitEntity = new OrganizationalUnit();
@ -132,6 +151,16 @@ class LoadOrganizationalUnitDefaultCommand extends Command
$clientEntity->setMaintenance(false);
$clientEntity->setOrganizationalUnit($classroomEntity);
$this->entityManager->persist($clientEntity);
foreach ($images as $image) {
$imageEntity = new Image();
$imageEntity->setName($image['name']);
$imageEntity->setType($image['type']);
$imageEntity->setPath($image['path']);
$imageEntity->setOrganizationalUnit($organizationalUnitEntity);
$imageEntity->setClient($clientEntity);
$this->entityManager->persist($imageEntity);
}
}
}

View File

@ -67,10 +67,14 @@ class OrganizationalUnitController extends AbstractController
#[Route('/opengnsys/rest//ous/{centerId}/images', methods: ['GET'])]
public function getImages(Request $request, int $centerId): JsonResponse
{
$parent = $this->entityManager
->getRepository(OrganizationalUnit::class)
->find($centerId);
$images = $this->entityManager
->getRepository(Image::class)
->findBy([
'organizationalUnit' => $centerId,
'organizationalUnit' => $parent,
], ['name' => 'ASC']);
$data = [];
@ -86,7 +90,7 @@ class OrganizationalUnitController extends AbstractController
}
#[Route('/opengnsys/rest//info', methods: ['GET'])]
public function getOpengnsysInfo(): JsonResponse
public function getOpengnsysInfo(Request $request, int $centerId): JsonResponse
{
$data = [
"project" => "OpenGnsys",

View File

@ -709,7 +709,7 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface
{
$openApi->getPaths()->addPath('/opengnsys/rest//ous', (new Model\PathItem())->withGet(
(new Model\Operation('getOUs'))
->withTags(['Organizational Unit'])
->withTags(['UDS'])
->withSummary('Obtener todas las Unidades Organizacionales')
->withResponses([
Response::HTTP_OK => [