From 4f1bfa04f63732e89c41159c6419942d19f5d60f Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 30 Sep 2024 11:37:36 +0200 Subject: [PATCH] Fixed conflicts and solved DTO bugs --- config/services/api_platform.yaml | 4 ---- src/Dto/Output/ClientOutput.php | 15 ++------------- src/Entity/Client.php | 11 +++++------ src/Factory/OgLiveFactory.php | 2 ++ tests/Functional/OgLiveTest.php | 6 ++++-- 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/config/services/api_platform.yaml b/config/services/api_platform.yaml index 91d360a..c7f7ea4 100644 --- a/config/services/api_platform.yaml +++ b/config/services/api_platform.yaml @@ -8,7 +8,6 @@ services: api_platform.filter.client.search: parent: 'api_platform.doctrine.orm.search_filter' -<<<<<<< HEAD arguments: [ { 'id': 'exact', 'name': 'partial', 'serialNumber': 'exact', organizationalUnit.id: 'exact', mac: 'exact', ip: 'exact' } ] tags: [ 'api_platform.filter' ] @@ -27,9 +26,6 @@ services: api_platform.filter.command.boolean: parent: 'api_platform.doctrine.orm.boolean_filter' arguments: [ { 'enabled': ~ } ] -======= - arguments: [ { 'id': 'exact', 'name': 'partial', 'serialNumber': 'exact', organizationalUnit.id: 'exact', 'ip': exact, 'mac': exact } ] ->>>>>>> feature/integration-ogboot tags: [ 'api_platform.filter' ] api_platform.filter.hardware.order: diff --git a/src/Dto/Output/ClientOutput.php b/src/Dto/Output/ClientOutput.php index 2579c80..f1a33dd 100644 --- a/src/Dto/Output/ClientOutput.php +++ b/src/Dto/Output/ClientOutput.php @@ -13,27 +13,16 @@ final class ClientOutput extends AbstractOutput { CONST string TYPE = 'client'; -<<<<<<< HEAD - #[Groups(['client:read', 'organizational-unit:read', 'trace:read'])] -======= - #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read'])] ->>>>>>> feature/integration-ogboot + #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read', 'trace:read'])] public string $name; #[Groups(['client:read', 'organizational-unit:read'])] public string $type = self::TYPE; -<<<<<<< HEAD - #[Groups(['client:read', 'organizational-unit:read', 'trace:read'])] - public ?string $ip = ''; - - #[Groups(['client:read', 'organizational-unit:read', 'trace:read'])] -======= - #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read'])] + #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read', 'trace:read'])] public ?string $ip = ''; #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read'])] ->>>>>>> feature/integration-ogboot public ?string $mac = ''; #[Groups(['client:read', 'organizational-unit:read', 'trace:read'])] diff --git a/src/Entity/Client.php b/src/Entity/Client.php index e51c56f..0c7a20f 100644 --- a/src/Entity/Client.php +++ b/src/Entity/Client.php @@ -64,11 +64,9 @@ class Client extends AbstractEntity private ?OgRepository $repository = null; #[ORM\ManyToOne(inversedBy: 'clients')] -<<<<<<< HEAD private ?Subnet $subnet = null; -======= + #[ORM\ManyToOne(inversedBy: 'clients')] private ?OgLive $ogLive = null; ->>>>>>> feature/integration-ogboot public function __construct() { @@ -262,7 +260,6 @@ class Client extends AbstractEntity return $this; } -<<<<<<< HEAD public function getSubnet(): ?Subnet { return $this->subnet; @@ -271,7 +268,10 @@ class Client extends AbstractEntity public function setSubnet(?Subnet $subnet): static { $this->subnet = $subnet; -======= + + return $this; + } + public function getOgLive(): ?OgLive { return $this->ogLive; @@ -280,7 +280,6 @@ class Client extends AbstractEntity public function setOgLive(?OgLive $ogLive): static { $this->ogLive = $ogLive; ->>>>>>> feature/integration-ogboot return $this; } diff --git a/src/Factory/OgLiveFactory.php b/src/Factory/OgLiveFactory.php index cb90dcd..bfe05a8 100644 --- a/src/Factory/OgLiveFactory.php +++ b/src/Factory/OgLiveFactory.php @@ -3,6 +3,7 @@ namespace App\Factory; use App\Entity\OgLive; +use App\Model\OgLiveStatus; use App\Repository\OgLiveRepository; use Zenstruck\Foundry\ModelFactory; use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory; @@ -35,6 +36,7 @@ final class OgLiveFactory extends ModelFactory 'createdAt' => self::faker()->dateTime(), 'name' => self::faker()->text(255), 'downloadUrl' => self::faker()->text(255), + 'status' => OgLiveStatus::ACTIVE, 'updatedAt' => self::faker()->dateTime(), ]; } diff --git a/tests/Functional/OgLiveTest.php b/tests/Functional/OgLiveTest.php index bb6c58a..95b2490 100644 --- a/tests/Functional/OgLiveTest.php +++ b/tests/Functional/OgLiveTest.php @@ -9,6 +9,7 @@ use App\Entity\User; use App\Factory\HardwareProfileFactory; use App\Factory\OgLiveFactory; use App\Factory\UserFactory; +use App\Model\OgLiveStatus; use App\Model\UserGroupPermissions; use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; @@ -61,7 +62,7 @@ class OgLiveTest extends AbstractTest $this->createClientWithCredentials()->request('POST', '/og-lives',['json' => [ 'name' => self::OGLIVE_CREATE, - 'downloadUrl' => 'http://example.com' + 'downloadUrl' => 'http://example.com', ]]); $this->assertResponseStatusCodeSame(201); @@ -70,7 +71,8 @@ class OgLiveTest extends AbstractTest '@context' => '/contexts/OgLiveOutput', '@type' => 'OgLive', 'name' => self::OGLIVE_CREATE, - 'downloadUrl' => 'http://example.com' + 'downloadUrl' => 'http://example.com', + 'status' => OgLiveStatus::INACTIVE ]); }