From 68b460935f9cf6e496cebc1365194d968001faee Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 2 Sep 2024 12:16:40 +0200 Subject: [PATCH] Change Output and added ogbott filters --- config/api_platform/OgLive.yaml | 1 + config/api_platform/PxeTemplate.yaml | 1 + config/services/api_platform.yaml | 15 +++++++++++++++ src/Dto/Output/ClientOutput.php | 6 +++--- src/Entity/OgLive.php | 4 ++-- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/config/api_platform/OgLive.yaml b/config/api_platform/OgLive.yaml index e24c61b..e1b3327 100644 --- a/config/api_platform/OgLive.yaml +++ b/config/api_platform/OgLive.yaml @@ -13,6 +13,7 @@ resources: filters: - 'api_platform.filter.og_live.order' - 'api_platform.filter.og_live.search' + - 'api_platform.filter.og_live.boolean' ApiPlatform\Metadata\Get: provider: App\State\Provider\OgLiveProvider diff --git a/config/api_platform/PxeTemplate.yaml b/config/api_platform/PxeTemplate.yaml index 0e36c96..b990141 100644 --- a/config/api_platform/PxeTemplate.yaml +++ b/config/api_platform/PxeTemplate.yaml @@ -13,6 +13,7 @@ resources: filters: - 'api_platform.filter.pxe_template.order' - 'api_platform.filter.pxe_template.search' + - 'api_platform.filter.pxe_template.boolean' ApiPlatform\Metadata\Get: provider: App\State\Provider\PxeTemplateProvider diff --git a/config/services/api_platform.yaml b/config/services/api_platform.yaml index ee1a157..fb2af43 100644 --- a/config/services/api_platform.yaml +++ b/config/services/api_platform.yaml @@ -30,6 +30,11 @@ services: arguments: [ { 'id': 'exact', 'name': 'partial', } ] tags: [ 'api_platform.filter' ] + api_platform.filter.og_live.boolean: + parent: 'api_platform.doctrine.orm.boolean_filter' + arguments: [ { 'isDefault': ~, 'installed': ~ } ] + tags: [ 'api_platform.filter' ] + api_platform.filter.hardware.search: parent: 'api_platform.doctrine.orm.search_filter' arguments: [ { 'id': 'exact', 'name': 'partial' } ] @@ -78,11 +83,21 @@ services: $orderParameterName: 'order' tags: [ 'api_platform.filter' ] + api_platform.filter.pxe_boot_file.search: + parent: 'api_platform.doctrine.orm.search_filter' + arguments: [ { 'id': 'exact', 'template': exact } ] + tags: [ 'api_platform.filter' ] + api_platform.filter.pxe_template.search: parent: 'api_platform.doctrine.orm.search_filter' arguments: [ { 'id': 'exact', 'name': 'partial', } ] tags: [ 'api_platform.filter' ] + api_platform.filter.pxe_template.boolean: + parent: 'api_platform.doctrine.orm.boolean_filter' + arguments: [ { 'synchronized': ~ } ] + tags: [ 'api_platform.filter' ] + api_platform.filter.user.order: parent: 'api_platform.doctrine.orm.order_filter' arguments: diff --git a/src/Dto/Output/ClientOutput.php b/src/Dto/Output/ClientOutput.php index 2fe5ff3..07cb0a1 100644 --- a/src/Dto/Output/ClientOutput.php +++ b/src/Dto/Output/ClientOutput.php @@ -13,16 +13,16 @@ final class ClientOutput extends AbstractOutput { CONST string TYPE = 'client'; - #[Groups(['client:read', 'organizational-unit:read'])] + #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read'])] public string $name; #[Groups(['client:read', 'organizational-unit:read'])] public string $type = self::TYPE; - #[Groups(['client:read', 'organizational-unit:read'])] + #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read'])] public ?string $ip = ''; - #[Groups(['client:read', 'organizational-unit:read'])] + #[Groups(['client:read', 'organizational-unit:read', 'pxe-boot-file:read'])] public ?string $mac = ''; #[Groups(['client:read', 'organizational-unit:read'])] diff --git a/src/Entity/OgLive.php b/src/Entity/OgLive.php index 4375882..2983c79 100644 --- a/src/Entity/OgLive.php +++ b/src/Entity/OgLive.php @@ -41,10 +41,10 @@ class OgLive extends AbstractEntity private ?string $filename = null; #[ORM\Column(nullable: true)] - private ?bool $installed = null; + private ?bool $installed = false; #[ORM\Column(nullable: true)] - private ?bool $isDefault = null; + private ?bool $isDefault = false; /** * @var Collection