Partition: añadido campo deployDate a la BBDD extraído automáticamente y de forma idempotente de la variable img= del getConfiguration del cliente, y securización de fallbacks a null por seguridad.
testing/ogcore-api/pipeline/head This commit looks good
Details
testing/ogcore-api/pipeline/head This commit looks good
Details
parent
bde77232cf
commit
b990a3d894
10
CHANGELOG.md
10
CHANGELOG.md
|
|
@ -1,7 +1,15 @@
|
|||
# Changelog
|
||||
## [1.4.0] - 2026-04-08
|
||||
### Added
|
||||
- Entidad Partition: Añadido el campo deployDate expuesto mediante el DTO para registrar la fecha exacta de despliegue de imagen.
|
||||
- CreatePartitionService: Inclusión de lógica idempotente que asocia la imagen y extrae su fecha real directamente del fichero /.ogimage enviado por el cliente en el parámetro img=.
|
||||
|
||||
### Fixed
|
||||
- Limpieza explícita del deployDate (null) en caso de que el inventario no informe de fecha o haya alteraciones en el payload para evitar desincronizaciones de trazas de la imagen subyacente.
|
||||
|
||||
## [1.3.0] - 2026-03-31
|
||||
### Added
|
||||
Añadida acción Refresh para actualizar el estado de un cliente o clientes. Se actualiza su configuración de discos y se recarga el ogBrowser por si hubiese cambio del menu.
|
||||
- Añadida acción Refresh para actualizar el estado de un cliente o clientes. Se actualiza su configuración de discos y se recarga el ogBrowser por si hubiese cambio del menu.
|
||||
|
||||
## [1.2.11] - 2026-03-25
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -74,6 +74,13 @@ class PartitionOutput extends AbstractOutput
|
|||
)]
|
||||
public ?int $memoryUsage = null;
|
||||
|
||||
#[Groups(['partition:read', 'client:read'])]
|
||||
#[ApiProperty(
|
||||
description: 'Fecha de despliegue de la imagen',
|
||||
example: '2025-01-01T00:00:00+00:00'
|
||||
)]
|
||||
public ?\DateTimeInterface $deployDate = null;
|
||||
|
||||
public function __construct(Partition $partition)
|
||||
{
|
||||
parent::__construct($partition);
|
||||
|
|
@ -94,5 +101,6 @@ class PartitionOutput extends AbstractOutput
|
|||
}
|
||||
|
||||
$this->memoryUsage = $partition->getMemoryUsage() / 100;
|
||||
$this->deployDate = $partition->getDeployDate();
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,21 @@ class Partition extends AbstractEntity
|
|||
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
|
||||
private ?ImageImageRepository $image = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $deployDate = null;
|
||||
|
||||
public function getDeployDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->deployDate;
|
||||
}
|
||||
|
||||
public function setDeployDate(?\DateTimeInterface $deployDate): static
|
||||
{
|
||||
$this->deployDate = $deployDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDiskNumber(): ?int
|
||||
{
|
||||
return $this->diskNumber;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,32 @@ class CreatePartitionService
|
|||
$partitionEntity->setOperativeSystem($operativeSystem);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($cfg['img']) && $cfg['img'] !== '') {
|
||||
$imgParts = explode(':', $cfg['img']);
|
||||
$imgName = $imgParts[0];
|
||||
$imgDate = $imgParts[1] ?? null;
|
||||
|
||||
$imageImageRepository = $this->entityManager->getRepository(\App\Entity\ImageImageRepository::class)
|
||||
->findOneBy(['name' => $imgName]);
|
||||
|
||||
if ($imageImageRepository) {
|
||||
$partitionEntity->setImage($imageImageRepository);
|
||||
$partitionEntity->setDeployDate(null);
|
||||
if ($imgDate) {
|
||||
$dateObj = \DateTime::createFromFormat('YmdHi', $imgDate);
|
||||
if ($dateObj) {
|
||||
$partitionEntity->setDeployDate($dateObj);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$partitionEntity->setImage(null);
|
||||
$partitionEntity->setDeployDate(null);
|
||||
}
|
||||
} elseif (isset($cfg['img']) && $cfg['img'] === '') {
|
||||
$partitionEntity->setImage(null);
|
||||
$partitionEntity->setDeployDate(null);
|
||||
}
|
||||
|
||||
$partitionEntity->setClient($clientEntity);
|
||||
$partitionEntity->setDiskNumber($cfg['disk']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue