refs #725. Updated API Dto
testing/ogcore-api/pipeline/head This commit looks good Details

develop-jenkins
Manuel Aranda Rosales 2024-10-03 08:58:25 +02:00
parent ca23d41241
commit 179f36ebef
6 changed files with 19 additions and 6 deletions

View File

@ -58,6 +58,13 @@ final class ClientInput
)]
public ?string $ip = null;
#[Groups(['client:write'])]
#[ApiProperty(
description: 'El estado del cliente',
example: 'active'
)]
public ?string $status = 'power-off';
#[Assert\NotNull(message: 'validators.organizational_unit.not_null')]
#[Groups(['client:write', 'client:patch'])]
#[ApiProperty(
@ -109,6 +116,7 @@ final class ClientInput
$this->mac = $client->getMac();
$this->ip = $client->getIp();
$this->position = $client->getPosition();
$this->status = $client->getStatus();
if ($client->getMenu()) {
$this->menu = new MenuOutput($client->getMenu());
@ -140,6 +148,7 @@ final class ClientInput
$client->setOgLive($this->ogLive?->getEntity());
$client->setHardwareProfile($this->hardwareProfile?->getEntity());
$client->setPosition($this->position);
$client->setStatus($this->status);
return $client;
}

View File

@ -55,7 +55,7 @@ class OrganizationalUnitInput
public ?RemoteCalendarOutput $remoteCalendar = null;
#[Groups(['organizational-unit:write'])]
public ?bool $remotePc = null;
public ?bool $remotePc = false;
public function __construct(?OrganizationalUnit $organizationalUnit = null)
{

View File

@ -55,6 +55,9 @@ final class ClientOutput extends AbstractOutput
#[Groups(['client:read'])]
public ?array $position = ['x' => 0, 'y' => 0];
#[Groups(['client:read'])]
public ?string $status = '';
#[Groups(['client:read'])]
public \DateTime $createdAt;
@ -84,6 +87,7 @@ final class ClientOutput extends AbstractOutput
$this->position = $client->getPosition();
$this->hardwareProfile = $client->getHardwareProfile() ? new HardwareProfileOutput($client->getHardwareProfile()) : null;
$this->ogLive = $client->getOgLive() ? new OgLiveOutput($client->getOgLive()) : null;
$this->status = $client->getStatus();
$this->createdAt = $client->getCreatedAt();
$this->createdBy = $client->getCreatedBy();
}

View File

@ -99,7 +99,6 @@ final class OrganizationalUnitOutput extends AbstractOutput
)->toArray();
}
$this->path = $organizationalUnit->getPath();
$this->createdAt = $organizationalUnit->getCreatedAt();
$this->createdBy = $organizationalUnit->getCreatedBy();

View File

@ -10,7 +10,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'RemoteCalendar')]
final class RemoteCalendarOutput extends AbstractOutput
{
#[Groups(['remote-calendar:read'])]
#[Groups(['remote-calendar:read', 'organizational-unit:read'])]
public ?string $name = null;
/**

View File

@ -90,7 +90,7 @@ class UDSClient
$this->scrambler = $data['scrambler'];
} catch (TransportExceptionInterface $e) {
throw new TransportException('Error while logging in');
throw new TransportException('Error while logging in to UDS');
} catch (ClientExceptionInterface|ServerExceptionInterface|RedirectionExceptionInterface $e) {
}
}
@ -142,14 +142,15 @@ class UDSClient
public function getMaxAvailableSeats(int $organizationalUnitId): int
{
$organizationalUnit = $this->entityManager->getRepository(OrganizationalUnit::class)->find($organizationalUnitId);
$organizationalUnit = $this->entityManager->getRepository(OrganizationalUnit::class)->findOneBy(['migrationId' => $organizationalUnitId]);
if (!$organizationalUnit) {
return 0;
}
$remoteCalendar = $organizationalUnit->getRemoteCalendar();
if (!$remoteCalendar || !$remoteCalendar->isRemoteAvailable()) {
$aux = $remoteCalendar->isAvailable();
if (!$remoteCalendar || !$aux) {
return 0;
}