Updated repo deleted endpoint
testing/ogcore-api/pipeline/head This commit looks good
Details
testing/ogcore-api/pipeline/head This commit looks good
Details
parent
2cadfbf1e3
commit
6d3604565b
|
@ -178,6 +178,18 @@ services:
|
|||
arguments: [ { 'id': 'exact', 'name': 'partial', } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.repository.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.repository.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial'} ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.software.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250203113932 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image ADD is_global TINYINT(1) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image DROP is_global');
|
||||
}
|
||||
}
|
|
@ -29,7 +29,11 @@ class DeletePermanentAction extends AbstractOgRepositoryController
|
|||
throw new ValidatorException('Fullsum is required');
|
||||
}
|
||||
|
||||
$content = $this->createRequest( 'DELETE', 'http://'.$data->getRepository()->getIp().':8006/ogrepository/v1/images/'.$data->getImageFullsum().'?method=trash');
|
||||
$this->logger->info('Deleting image', ['image' => $data->getName()]);
|
||||
|
||||
$content = $this->createRequest( 'DELETE', 'http://'.$data->getRepository()->getIp().':8006/ogrepository/v1/images/'.$data->getImageFullsum().'?method=permanent');
|
||||
|
||||
$this->logger->info('Image deleted', ['image' => $data->getName()]);
|
||||
|
||||
$this->entityManager->remove($data);
|
||||
$this->entityManager->flush();
|
||||
|
|
|
@ -30,8 +30,12 @@ class DeleteTrashAction extends AbstractOgRepositoryController
|
|||
throw new ValidatorException('Fullsum is required');
|
||||
}
|
||||
|
||||
$this->logger->info('Deleting image', ['image' => $data->getName()]);
|
||||
|
||||
$content = $this->createRequest('DELETE', 'http://'.$data->getRepository()->getIp().':8006/ogrepository/v1/images/'.$data->getImageFullsum().'?method=trash');
|
||||
|
||||
$this->logger->info('Image deleted', ['image' => $data->getName()]);
|
||||
|
||||
$data->setStatus(ImageStatus::TRASH);
|
||||
$this->entityManager->persist($data);
|
||||
$this->entityManager->flush();
|
||||
|
|
|
@ -66,6 +66,11 @@ final class ImageInput
|
|||
#[ApiProperty(description: 'The remote pc of the image')]
|
||||
public ?bool $remotePc = false;
|
||||
|
||||
#[Groups(['image:write'])]
|
||||
#[ApiProperty(description: 'The global property of the image')]
|
||||
public ?bool $isGlobal = false;
|
||||
|
||||
|
||||
public function __construct(?Image $image = null)
|
||||
{
|
||||
if (!$image) {
|
||||
|
@ -77,6 +82,7 @@ final class ImageInput
|
|||
$this->comments = $image->getComments();
|
||||
$this->type = $image->getType();
|
||||
$this->remotePc = $image->isRemotePc();
|
||||
$this->isGlobal = $image->isGlobal();
|
||||
$this->status = $image->getStatus();
|
||||
|
||||
if ($image->getSoftwareProfile()) {
|
||||
|
@ -124,6 +130,7 @@ final class ImageInput
|
|||
}
|
||||
|
||||
$image->setRemotePc($this->remotePc);
|
||||
$image->setIsGlobal($this->isGlobal);
|
||||
$image->setCreated(false);
|
||||
|
||||
$partitionInfo = [];
|
||||
|
|
|
@ -36,6 +36,9 @@ final class ImageOutput extends AbstractOutput
|
|||
#[Groups(['image:read'])]
|
||||
public ?bool $remotePc = null;
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?bool $isGlobal = null;
|
||||
|
||||
#[Groups(['image:read'])]
|
||||
public ?bool $created = null;
|
||||
|
||||
|
@ -78,6 +81,7 @@ final class ImageOutput extends AbstractOutput
|
|||
$this->imageRepository = $image->getRepository() ? new ImageRepositoryOutput($image->getRepository()) : null;
|
||||
$this->partitionInfo = json_decode($image->getPartitionInfo(), true);
|
||||
$this->remotePc = $image->isRemotePc();
|
||||
$this->isGlobal = $image->isGlobal();
|
||||
$this->created = $image->isCreated();
|
||||
$this->createdAt = $image->getCreatedAt();
|
||||
$this->createdBy = $image->getCreatedBy();
|
||||
|
|
|
@ -65,6 +65,9 @@ class Image extends AbstractEntity
|
|||
#[ORM\Column(length: 255)]
|
||||
private ?string $status = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?bool $isGlobal = null;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -262,4 +265,16 @@ class Image extends AbstractEntity
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isGlobal(): ?bool
|
||||
{
|
||||
return $this->isGlobal;
|
||||
}
|
||||
|
||||
public function setIsGlobal(bool $isGlobal): static
|
||||
{
|
||||
$this->isGlobal = $isGlobal;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue