From 159d38570ade4f96f5dd61577c6106ab9b895ddd Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 14 Aug 2024 15:06:17 +0200 Subject: [PATCH 01/17] refs #638. Updated pxe template database field --- migrations/Version20240814130427.php | 31 ++++++++++++++++++++++++++++ src/Entity/PxeTemplate.php | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 migrations/Version20240814130427.php diff --git a/migrations/Version20240814130427.php b/migrations/Version20240814130427.php new file mode 100644 index 0000000..8e2cabc --- /dev/null +++ b/migrations/Version20240814130427.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE pxe_template CHANGE template_content template_content TINYTEXT NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE pxe_template CHANGE template_content template_content VARCHAR(255) NOT NULL'); + } +} diff --git a/src/Entity/PxeTemplate.php b/src/Entity/PxeTemplate.php index ef310ff..af0e7b3 100644 --- a/src/Entity/PxeTemplate.php +++ b/src/Entity/PxeTemplate.php @@ -3,6 +3,7 @@ namespace App\Entity; use App\Repository\PxeTemplateRepository; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; @@ -13,7 +14,7 @@ class PxeTemplate extends AbstractEntity { use NameableTrait; - #[ORM\Column(length: 255)] + #[ORM\Column(length: 255, type: Types::TEXT)] private ?string $templateContent = null; public function getTemplateContent(): ?string From f483b94a703d8fd41c03f2dba4481fd63c4934c6 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 19 Aug 2024 15:01:32 +0200 Subject: [PATCH 02/17] Improvements, and fixed pagination --- .env | 2 +- composer.json | 2 +- composer.lock | 624 +++++++++--------- config/api_platform/Client.yaml | 2 +- config/api_platform/OrganizationalUnit.yaml | 1 + config/packages/api_platform.yaml | 35 +- docker/default.conf | 10 +- migrations/Version20240819062421.php | 33 + src/Dto/Output/OgLiveOutput.php | 4 + src/Dto/Output/PxeTemplateOutput.php | 4 + src/Entity/OgLive.php | 1 + src/Entity/PxeTemplate.php | 3 +- src/Entity/SynchronizedTrait.php | 23 + src/OpenApi/OpenApiFactory.php | 51 +- .../Processor/OrganizationalUnitProcessor.php | 8 +- src/State/Provider/ClientProvider.php | 6 +- .../Provider/OrganizationalUnitProvider.php | 2 +- 17 files changed, 455 insertions(+), 356 deletions(-) create mode 100644 migrations/Version20240819062421.php create mode 100644 src/Entity/SynchronizedTrait.php diff --git a/.env b/.env index 001e100..340a072 100644 --- a/.env +++ b/.env @@ -24,7 +24,7 @@ APP_SECRET=e95c7f17da15ce1b03d77ad655379c34 # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" -# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" +#DATABASE_URL="mysql://root:root@127.0.0.1:3336/dimio?serverVersion=8.0.32&charset=utf8mb4" DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore?serverVersion=10.11.2-MariaDB&charset=utf8mb4" OG_1_DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore_old_og?serverVersion=10.11.2-MariaDB&charset=utf8mb4" diff --git a/composer.json b/composer.json index 7aa562a..1c7178a 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "php": ">=8.1", "ext-ctype": "*", "ext-iconv": "*", - "api-platform/core": "^3.3", + "api-platform/core": "^3.2", "doctrine/dbal": "^3", "doctrine/doctrine-bundle": "^2.12", "doctrine/doctrine-migrations-bundle": "^3.3", diff --git a/composer.lock b/composer.lock index 05fab12..e2c3c61 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "788f45c89f13c815d43700e8374bf655", + "content-hash": "696433794f1d706f6d16af7589d2c1ea", "packages": [ { "name": "api-platform/core", - "version": "v3.3.5", + "version": "v3.3.11", "source": { "type": "git", "url": "https://github.com/api-platform/core.git", - "reference": "b5a93fb0bb855273aabb0807505ba61b68813246" + "reference": "ea7d443376dfa1f9a05b53060049e7837d2ec7d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/api-platform/core/zipball/b5a93fb0bb855273aabb0807505ba61b68813246", - "reference": "b5a93fb0bb855273aabb0807505ba61b68813246", + "url": "https://api.github.com/repos/api-platform/core/zipball/ea7d443376dfa1f9a05b53060049e7837d2ec7d4", + "reference": "ea7d443376dfa1f9a05b53060049e7837d2ec7d4", "shasum": "" }, "require": { @@ -190,9 +190,9 @@ ], "support": { "issues": "https://github.com/api-platform/core/issues", - "source": "https://github.com/api-platform/core/tree/v3.3.5" + "source": "https://github.com/api-platform/core/tree/v3.3.11" }, - "time": "2024-05-29T05:48:47+00:00" + "time": "2024-07-20T08:19:33+00:00" }, { "name": "behat/transliterator", @@ -575,16 +575,16 @@ }, { "name": "doctrine/dbal", - "version": "3.8.5", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "0e3536ba088a749985c8801105b6b3ac6c1280b6" + "reference": "d8f68ea6cc00912e5313237130b8c8decf4d28c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/0e3536ba088a749985c8801105b6b3ac6c1280b6", - "reference": "0e3536ba088a749985c8801105b6b3ac6c1280b6", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/d8f68ea6cc00912e5313237130b8c8decf4d28c6", + "reference": "d8f68ea6cc00912e5313237130b8c8decf4d28c6", "shasum": "" }, "require": { @@ -600,12 +600,12 @@ "doctrine/coding-standard": "12.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.1", - "phpstan/phpstan": "1.11.1", + "phpstan/phpstan": "1.11.7", "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "9.6.19", + "phpunit/phpunit": "9.6.20", "psalm/plugin-phpunit": "0.18.4", "slevomat/coding-standard": "8.13.1", - "squizlabs/php_codesniffer": "3.9.2", + "squizlabs/php_codesniffer": "3.10.2", "symfony/cache": "^5.4|^6.0|^7.0", "symfony/console": "^4.4|^5.4|^6.0|^7.0", "vimeo/psalm": "4.30.0" @@ -668,7 +668,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.8.5" + "source": "https://github.com/doctrine/dbal/tree/3.9.0" }, "funding": [ { @@ -684,7 +684,7 @@ "type": "tidelift" } ], - "time": "2024-06-08T17:49:56+00:00" + "time": "2024-08-15T07:34:42+00:00" }, { "name": "doctrine/deprecations", @@ -1276,21 +1276,21 @@ }, { "name": "doctrine/migrations", - "version": "3.7.4", + "version": "3.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/migrations.git", - "reference": "954e0a314c2f0eb9fb418210445111747de254a6" + "reference": "535a70dcbd88b8c6ba945be050977457f4f4c06c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/954e0a314c2f0eb9fb418210445111747de254a6", - "reference": "954e0a314c2f0eb9fb418210445111747de254a6", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/535a70dcbd88b8c6ba945be050977457f4f4c06c", + "reference": "535a70dcbd88b8c6ba945be050977457f4f4c06c", "shasum": "" }, "require": { "composer-runtime-api": "^2", - "doctrine/dbal": "^3.5.1 || ^4", + "doctrine/dbal": "^3.6 || ^4", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2.0", "php": "^8.1", @@ -1328,7 +1328,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\Migrations\\": "lib/Doctrine/Migrations" + "Doctrine\\Migrations\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1358,7 +1358,7 @@ ], "support": { "issues": "https://github.com/doctrine/migrations/issues", - "source": "https://github.com/doctrine/migrations/tree/3.7.4" + "source": "https://github.com/doctrine/migrations/tree/3.8.0" }, "funding": [ { @@ -1374,20 +1374,20 @@ "type": "tidelift" } ], - "time": "2024-03-06T13:41:11+00:00" + "time": "2024-06-26T14:12:46+00:00" }, { "name": "doctrine/orm", - "version": "2.19.5", + "version": "2.19.6", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "94986af28452da42a46a4489d1c958a2e5d710e5" + "reference": "c1bb2ccf4b19c845f91ff7c4c01dc7cbba7f4073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/94986af28452da42a46a4489d1c958a2e5d710e5", - "reference": "94986af28452da42a46a4489d1c958a2e5d710e5", + "url": "https://api.github.com/repos/doctrine/orm/zipball/c1bb2ccf4b19c845f91ff7c4c01dc7cbba7f4073", + "reference": "c1bb2ccf4b19c845f91ff7c4c01dc7cbba7f4073", "shasum": "" }, "require": { @@ -1416,14 +1416,14 @@ "doctrine/annotations": "^1.13 || ^2", "doctrine/coding-standard": "^9.0.2 || ^12.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.10.59", + "phpstan/phpstan": "~1.4.10 || 1.11.1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2 || ^7.0", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0 || ^7.0", - "vimeo/psalm": "4.30.0 || 5.22.2" + "vimeo/psalm": "4.30.0 || 5.24.0" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", @@ -1473,22 +1473,22 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.19.5" + "source": "https://github.com/doctrine/orm/tree/2.19.6" }, - "time": "2024-04-30T06:49:54+00:00" + "time": "2024-06-26T17:24:40+00:00" }, { "name": "doctrine/persistence", - "version": "3.3.2", + "version": "3.3.3", "source": { "type": "git", "url": "https://github.com/doctrine/persistence.git", - "reference": "477da35bd0255e032826f440b94b3e37f2d56f42" + "reference": "b337726451f5d530df338fc7f68dee8781b49779" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/477da35bd0255e032826f440b94b3e37f2d56f42", - "reference": "477da35bd0255e032826f440b94b3e37f2d56f42", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/b337726451f5d530df338fc7f68dee8781b49779", + "reference": "b337726451f5d530df338fc7f68dee8781b49779", "shasum": "" }, "require": { @@ -1500,15 +1500,14 @@ "doctrine/common": "<2.10" }, "require-dev": { - "composer/package-versions-deprecated": "^1.11", - "doctrine/coding-standard": "^11", + "doctrine/coding-standard": "^12", "doctrine/common": "^3.0", - "phpstan/phpstan": "1.9.4", + "phpstan/phpstan": "1.11.1", "phpstan/phpstan-phpunit": "^1", "phpstan/phpstan-strict-rules": "^1.1", "phpunit/phpunit": "^8.5 || ^9.5", "symfony/cache": "^4.4 || ^5.4 || ^6.0", - "vimeo/psalm": "4.30.0 || 5.3.0" + "vimeo/psalm": "4.30.0 || 5.24.0" }, "type": "library", "autoload": { @@ -1557,7 +1556,7 @@ ], "support": { "issues": "https://github.com/doctrine/persistence/issues", - "source": "https://github.com/doctrine/persistence/tree/3.3.2" + "source": "https://github.com/doctrine/persistence/tree/3.3.3" }, "funding": [ { @@ -1573,20 +1572,20 @@ "type": "tidelift" } ], - "time": "2024-03-12T14:54:36+00:00" + "time": "2024-06-20T10:14:30+00:00" }, { "name": "doctrine/sql-formatter", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/sql-formatter.git", - "reference": "d1ac84aef745c69ea034929eb6d65a6908b675cc" + "reference": "7f83911cc5eba870de7ebb11283972483f7e2891" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/sql-formatter/zipball/d1ac84aef745c69ea034929eb6d65a6908b675cc", - "reference": "d1ac84aef745c69ea034929eb6d65a6908b675cc", + "url": "https://api.github.com/repos/doctrine/sql-formatter/zipball/7f83911cc5eba870de7ebb11283972483f7e2891", + "reference": "7f83911cc5eba870de7ebb11283972483f7e2891", "shasum": "" }, "require": { @@ -1626,22 +1625,22 @@ ], "support": { "issues": "https://github.com/doctrine/sql-formatter/issues", - "source": "https://github.com/doctrine/sql-formatter/tree/1.4.0" + "source": "https://github.com/doctrine/sql-formatter/tree/1.4.1" }, - "time": "2024-05-08T08:12:09+00:00" + "time": "2024-08-05T20:32:22+00:00" }, { "name": "gedmo/doctrine-extensions", - "version": "v3.15.0", + "version": "v3.16.1", "source": { "type": "git", "url": "https://github.com/doctrine-extensions/DoctrineExtensions.git", - "reference": "2a89103f4984d8970f3855284c8c04e6e6a63c0f" + "reference": "e85560ed96f977b8c29428a99222cb2ef2f0e80d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine-extensions/DoctrineExtensions/zipball/2a89103f4984d8970f3855284c8c04e6e6a63c0f", - "reference": "2a89103f4984d8970f3855284c8c04e6e6a63c0f", + "url": "https://api.github.com/repos/doctrine-extensions/DoctrineExtensions/zipball/e85560ed96f977b8c29428a99222cb2ef2f0e80d", + "reference": "e85560ed96f977b8c29428a99222cb2ef2f0e80d", "shasum": "" }, "require": { @@ -1660,7 +1659,7 @@ "doctrine/annotations": "<1.13 || >=3.0", "doctrine/dbal": "<3.2 || >=4.0", "doctrine/mongodb-odm": "<2.3 || >=3.0", - "doctrine/orm": "<2.14.0 || 2.16.0 || 2.16.1 || >=3.0" + "doctrine/orm": "<2.14.0 || 2.16.0 || 2.16.1 || >=4.0" }, "require-dev": { "doctrine/annotations": "^1.13 || ^2.0", @@ -1668,16 +1667,18 @@ "doctrine/dbal": "^3.2", "doctrine/doctrine-bundle": "^2.3", "doctrine/mongodb-odm": "^2.3", - "doctrine/orm": "^2.14.0", + "doctrine/orm": "^2.14.0 || ^3.0", "friendsofphp/php-cs-fixer": "^3.14.0", "nesbot/carbon": "^2.71 || ^3.0", - "phpstan/phpstan": "^1.10.2", - "phpstan/phpstan-doctrine": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan": "^1.11", + "phpstan/phpstan-doctrine": "^1.4", + "phpstan/phpstan-phpunit": "^1.4", "phpunit/phpunit": "^9.6", - "rector/rector": "^0.19", + "rector/rector": "^1.1", "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0", "symfony/phpunit-bridge": "^6.0 || ^7.0", + "symfony/uid": "^5.4 || ^6.0 || ^7.0", "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "suggest": { @@ -1687,7 +1688,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.13-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -1735,7 +1736,7 @@ "support": { "email": "gediminas.morkevicius@gmail.com", "issues": "https://github.com/doctrine-extensions/DoctrineExtensions/issues", - "source": "https://github.com/doctrine-extensions/DoctrineExtensions/tree/v3.15.0", + "source": "https://github.com/doctrine-extensions/DoctrineExtensions/tree/v3.16.1", "wiki": "https://github.com/Atlantic18/DoctrineExtensions/tree/main/doc" }, "funding": [ @@ -1756,7 +1757,7 @@ "type": "github" } ], - "time": "2024-02-12T15:17:22+00:00" + "time": "2024-06-25T16:22:14+00:00" }, { "name": "gesdinet/jwt-refresh-token-bundle", @@ -1977,16 +1978,16 @@ }, { "name": "lexik/jwt-authentication-bundle", - "version": "v3.0.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/lexik/LexikJWTAuthenticationBundle.git", - "reference": "b20c4ae7fdfe1d7422c7099a141cc9eb64627310" + "reference": "4f1a638289cf9282bad1b82b8df56d3bd4e0743c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lexik/LexikJWTAuthenticationBundle/zipball/b20c4ae7fdfe1d7422c7099a141cc9eb64627310", - "reference": "b20c4ae7fdfe1d7422c7099a141cc9eb64627310", + "url": "https://api.github.com/repos/lexik/LexikJWTAuthenticationBundle/zipball/4f1a638289cf9282bad1b82b8df56d3bd4e0743c", + "reference": "4f1a638289cf9282bad1b82b8df56d3bd4e0743c", "shasum": "" }, "require": { @@ -2076,7 +2077,7 @@ ], "support": { "issues": "https://github.com/lexik/LexikJWTAuthenticationBundle/issues", - "source": "https://github.com/lexik/LexikJWTAuthenticationBundle/tree/v3.0.0" + "source": "https://github.com/lexik/LexikJWTAuthenticationBundle/tree/v3.1.0" }, "funding": [ { @@ -2088,20 +2089,20 @@ "type": "tidelift" } ], - "time": "2024-05-05T17:49:24+00:00" + "time": "2024-07-03T20:49:59+00:00" }, { "name": "nelmio/cors-bundle", - "version": "2.4.0", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/nelmio/NelmioCorsBundle.git", - "reference": "78fcdb91f76b080a1008133def9c7f613833933d" + "reference": "3a526fe025cd20e04a6a11370cf5ab28dbb5a544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nelmio/NelmioCorsBundle/zipball/78fcdb91f76b080a1008133def9c7f613833933d", - "reference": "78fcdb91f76b080a1008133def9c7f613833933d", + "url": "https://api.github.com/repos/nelmio/NelmioCorsBundle/zipball/3a526fe025cd20e04a6a11370cf5ab28dbb5a544", + "reference": "3a526fe025cd20e04a6a11370cf5ab28dbb5a544", "shasum": "" }, "require": { @@ -2148,9 +2149,9 @@ ], "support": { "issues": "https://github.com/nelmio/NelmioCorsBundle/issues", - "source": "https://github.com/nelmio/NelmioCorsBundle/tree/2.4.0" + "source": "https://github.com/nelmio/NelmioCorsBundle/tree/2.5.0" }, - "time": "2023-11-30T16:41:19+00:00" + "time": "2024-06-24T21:25:28+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2947,16 +2948,16 @@ }, { "name": "stof/doctrine-extensions-bundle", - "version": "v1.11.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/stof/StofDoctrineExtensionsBundle.git", - "reference": "9f7023e4c8a1c00a5627d41c1027a3f89e477630" + "reference": "473ae65598fa4160654c350e139e20ee75d9a91a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stof/StofDoctrineExtensionsBundle/zipball/9f7023e4c8a1c00a5627d41c1027a3f89e477630", - "reference": "9f7023e4c8a1c00a5627d41c1027a3f89e477630", + "url": "https://api.github.com/repos/stof/StofDoctrineExtensionsBundle/zipball/473ae65598fa4160654c350e139e20ee75d9a91a", + "reference": "473ae65598fa4160654c350e139e20ee75d9a91a", "shasum": "" }, "require": { @@ -3021,9 +3022,9 @@ ], "support": { "issues": "https://github.com/stof/StofDoctrineExtensionsBundle/issues", - "source": "https://github.com/stof/StofDoctrineExtensionsBundle/tree/v1.11.0" + "source": "https://github.com/stof/StofDoctrineExtensionsBundle/tree/v1.12.0" }, - "time": "2024-02-13T14:43:20+00:00" + "time": "2024-06-10T12:27:27+00:00" }, { "name": "symfony/asset", @@ -3096,16 +3097,16 @@ }, { "name": "symfony/cache", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "287142df5579ce223c485b3872df3efae8390984" + "reference": "6702d2d777260e6ff3451fee2d7d78ab5f715cdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/287142df5579ce223c485b3872df3efae8390984", - "reference": "287142df5579ce223c485b3872df3efae8390984", + "url": "https://api.github.com/repos/symfony/cache/zipball/6702d2d777260e6ff3451fee2d7d78ab5f715cdc", + "reference": "6702d2d777260e6ff3451fee2d7d78ab5f715cdc", "shasum": "" }, "require": { @@ -3172,7 +3173,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.8" + "source": "https://github.com/symfony/cache/tree/v6.4.10" }, "funding": [ { @@ -3188,7 +3189,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-17T06:05:49+00:00" }, { "name": "symfony/cache-contracts", @@ -3417,16 +3418,16 @@ }, { "name": "symfony/console", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "be5854cee0e8c7b110f00d695d11debdfa1a2a91" + "reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/be5854cee0e8c7b110f00d695d11debdfa1a2a91", - "reference": "be5854cee0e8c7b110f00d695d11debdfa1a2a91", + "url": "https://api.github.com/repos/symfony/console/zipball/504974cbe43d05f83b201d6498c206f16fc0cdbc", + "reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc", "shasum": "" }, "require": { @@ -3491,7 +3492,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.8" + "source": "https://github.com/symfony/console/tree/v6.4.10" }, "funding": [ { @@ -3507,20 +3508,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "d3b618176e8c3a9e5772151c51eba0c52a0c771c" + "reference": "5caf9c5f6085f13b27d70a236b776c07e4a1c3eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d3b618176e8c3a9e5772151c51eba0c52a0c771c", - "reference": "d3b618176e8c3a9e5772151c51eba0c52a0c771c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5caf9c5f6085f13b27d70a236b776c07e4a1c3eb", + "reference": "5caf9c5f6085f13b27d70a236b776c07e4a1c3eb", "shasum": "" }, "require": { @@ -3572,7 +3573,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.8" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.10" }, "funding": [ { @@ -3588,7 +3589,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T07:32:07+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3659,16 +3660,16 @@ }, { "name": "symfony/doctrine-bridge", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-bridge.git", - "reference": "afbf291ccaf595c8ff6f4ed3943aa0ea479e4d04" + "reference": "0de9662441bce4670506d0c371cc819a9d0a7607" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/afbf291ccaf595c8ff6f4ed3943aa0ea479e4d04", - "reference": "afbf291ccaf595c8ff6f4ed3943aa0ea479e4d04", + "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/0de9662441bce4670506d0c371cc819a9d0a7607", + "reference": "0de9662441bce4670506d0c371cc819a9d0a7607", "shasum": "" }, "require": { @@ -3747,7 +3748,7 @@ "description": "Provides integration for Doctrine with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/doctrine-bridge/tree/v6.4.8" + "source": "https://github.com/symfony/doctrine-bridge/tree/v6.4.10" }, "funding": [ { @@ -3763,20 +3764,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/dotenv", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "55aefa0029adff89ecffdb560820e945c7983f06" + "reference": "2ae0c84cc9be0dc1eeb86016970b63c764d8472e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/55aefa0029adff89ecffdb560820e945c7983f06", - "reference": "55aefa0029adff89ecffdb560820e945c7983f06", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/2ae0c84cc9be0dc1eeb86016970b63c764d8472e", + "reference": "2ae0c84cc9be0dc1eeb86016970b63c764d8472e", "shasum": "" }, "require": { @@ -3821,7 +3822,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v6.4.8" + "source": "https://github.com/symfony/dotenv/tree/v6.4.10" }, "funding": [ { @@ -3837,20 +3838,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-09T18:29:35+00:00" }, { "name": "symfony/error-handler", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc" + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc", - "reference": "ef836152bf13472dc5fb5b08b0c0c4cfeddc0fcc", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/231f1b2ee80f72daa1972f7340297d67439224f0", + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0", "shasum": "" }, "require": { @@ -3896,7 +3897,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.8" + "source": "https://github.com/symfony/error-handler/tree/v6.4.10" }, "funding": [ { @@ -3912,7 +3913,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/event-dispatcher", @@ -4136,16 +4137,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.8", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3" + "reference": "b51ef8059159330b74a4d52f68e671033c0fe463" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/4d37529150e7081c51b3c5d5718c55a04a9503f3", - "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b51ef8059159330b74a4d52f68e671033c0fe463", + "reference": "b51ef8059159330b74a4d52f68e671033c0fe463", "shasum": "" }, "require": { @@ -4182,7 +4183,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.8" + "source": "https://github.com/symfony/filesystem/tree/v6.4.9" }, "funding": [ { @@ -4198,20 +4199,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-06-28T09:49:33+00:00" }, { "name": "symfony/finder", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3ef977a43883215d560a2cecb82ec8e62131471c" + "reference": "af29198d87112bebdd397bd7735fbd115997824c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3ef977a43883215d560a2cecb82ec8e62131471c", - "reference": "3ef977a43883215d560a2cecb82ec8e62131471c", + "url": "https://api.github.com/repos/symfony/finder/zipball/af29198d87112bebdd397bd7735fbd115997824c", + "reference": "af29198d87112bebdd397bd7735fbd115997824c", "shasum": "" }, "require": { @@ -4246,7 +4247,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.8" + "source": "https://github.com/symfony/finder/tree/v6.4.10" }, "funding": [ { @@ -4262,20 +4263,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-24T07:06:38+00:00" }, { "name": "symfony/flex", - "version": "v2.4.5", + "version": "v2.4.6", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "b0a405f40614c9f584b489d54f91091817b0e26e" + "reference": "4dc11919791f81d087a12db2ab4c7e044431ef6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/b0a405f40614c9f584b489d54f91091817b0e26e", - "reference": "b0a405f40614c9f584b489d54f91091817b0e26e", + "url": "https://api.github.com/repos/symfony/flex/zipball/4dc11919791f81d087a12db2ab4c7e044431ef6b", + "reference": "4dc11919791f81d087a12db2ab4c7e044431ef6b", "shasum": "" }, "require": { @@ -4311,7 +4312,7 @@ "description": "Composer plugin for Symfony", "support": { "issues": "https://github.com/symfony/flex/issues", - "source": "https://github.com/symfony/flex/tree/v2.4.5" + "source": "https://github.com/symfony/flex/tree/v2.4.6" }, "funding": [ { @@ -4327,20 +4328,20 @@ "type": "tidelift" } ], - "time": "2024-03-02T08:16:47+00:00" + "time": "2024-04-27T10:22:22+00:00" }, { "name": "symfony/framework-bundle", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "7c7739f87f1a8be1c2f5e7d28addfe763a917acb" + "reference": "6cbdb0cc3ddbb63499262cd3036882b08ee2690b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/7c7739f87f1a8be1c2f5e7d28addfe763a917acb", - "reference": "7c7739f87f1a8be1c2f5e7d28addfe763a917acb", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/6cbdb0cc3ddbb63499262cd3036882b08ee2690b", + "reference": "6cbdb0cc3ddbb63499262cd3036882b08ee2690b", "shasum": "" }, "require": { @@ -4459,7 +4460,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v6.4.8" + "source": "https://github.com/symfony/framework-bundle/tree/v6.4.10" }, "funding": [ { @@ -4475,7 +4476,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T13:24:20+00:00" }, { "name": "symfony/http-client", @@ -4650,16 +4651,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "27de8cc95e11db7a50b027e71caaab9024545947" + "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/27de8cc95e11db7a50b027e71caaab9024545947", - "reference": "27de8cc95e11db7a50b027e71caaab9024545947", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/117f1f20a7ade7bcea28b861fb79160a21a1e37b", + "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b", "shasum": "" }, "require": { @@ -4707,7 +4708,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.8" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.10" }, "funding": [ { @@ -4723,20 +4724,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:36:27+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1" + "reference": "147e0daf618d7575b5007055340d09aece5cf068" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1", - "reference": "6c519aa3f32adcfd1d1f18d923f6b227d9acf3c1", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/147e0daf618d7575b5007055340d09aece5cf068", + "reference": "147e0daf618d7575b5007055340d09aece5cf068", "shasum": "" }, "require": { @@ -4821,7 +4822,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.8" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.10" }, "funding": [ { @@ -4837,7 +4838,7 @@ "type": "tidelift" } ], - "time": "2024-06-02T16:06:25+00:00" + "time": "2024-07-26T14:52:04+00:00" }, { "name": "symfony/password-hasher", @@ -4913,16 +4914,16 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { @@ -4971,7 +4972,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { @@ -4987,20 +4988,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { @@ -5052,7 +5053,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { @@ -5068,20 +5069,20 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "shasum": "" }, "require": { @@ -5132,7 +5133,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" }, "funding": [ { @@ -5148,25 +5149,24 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff" + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/86fcae159633351e5fd145d1c47de6c528f8caff", - "reference": "86fcae159633351e5fd145d1c47de6c528f8caff", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", + "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-php80": "^1.14" + "php": ">=7.1" }, "type": "library", "extra": { @@ -5209,7 +5209,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0" }, "funding": [ { @@ -5225,7 +5225,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-06-19T12:35:24+00:00" }, { "name": "symfony/property-access", @@ -5306,16 +5306,16 @@ }, { "name": "symfony/property-info", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "7f544bc6ceb1a6a2283c7af8e8621262c43b7ede" + "reference": "edaea9dcc723cb4a0ab6a00f7d6f8c07c0d8ff77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/7f544bc6ceb1a6a2283c7af8e8621262c43b7ede", - "reference": "7f544bc6ceb1a6a2283c7af8e8621262c43b7ede", + "url": "https://api.github.com/repos/symfony/property-info/zipball/edaea9dcc723cb4a0ab6a00f7d6f8c07c0d8ff77", + "reference": "edaea9dcc723cb4a0ab6a00f7d6f8c07c0d8ff77", "shasum": "" }, "require": { @@ -5369,7 +5369,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v6.4.8" + "source": "https://github.com/symfony/property-info/tree/v6.4.10" }, "funding": [ { @@ -5385,20 +5385,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T07:32:07+00:00" }, { "name": "symfony/routing", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58" + "reference": "aad19fe10753ba842f0d653a8db819c4b3affa87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58", - "reference": "8a40d0f9b01f0fbb80885d3ce0ad6714fb603a58", + "url": "https://api.github.com/repos/symfony/routing/zipball/aad19fe10753ba842f0d653a8db819c4b3affa87", + "reference": "aad19fe10753ba842f0d653a8db819c4b3affa87", "shasum": "" }, "require": { @@ -5452,7 +5452,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.4.8" + "source": "https://github.com/symfony/routing/tree/v6.4.10" }, "funding": [ { @@ -5468,7 +5468,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-15T09:26:24+00:00" }, { "name": "symfony/runtime", @@ -5551,16 +5551,16 @@ }, { "name": "symfony/security-bundle", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "dfb286069b0332e1f1c21962133d17c0fbc1e5e7" + "reference": "50007f4f76632741b62fa9604c5f65807f268b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/dfb286069b0332e1f1c21962133d17c0fbc1e5e7", - "reference": "dfb286069b0332e1f1c21962133d17c0fbc1e5e7", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/50007f4f76632741b62fa9604c5f65807f268b72", + "reference": "50007f4f76632741b62fa9604c5f65807f268b72", "shasum": "" }, "require": { @@ -5643,7 +5643,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v6.4.8" + "source": "https://github.com/symfony/security-bundle/tree/v6.4.10" }, "funding": [ { @@ -5659,20 +5659,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-17T10:49:44+00:00" }, { "name": "symfony/security-core", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "5fc7850ada5e8e03d78c1739c82c64d5e2f7d495" + "reference": "432dec55da108c471adcf58c351af01372a52164" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/5fc7850ada5e8e03d78c1739c82c64d5e2f7d495", - "reference": "5fc7850ada5e8e03d78c1739c82c64d5e2f7d495", + "url": "https://api.github.com/repos/symfony/security-core/zipball/432dec55da108c471adcf58c351af01372a52164", + "reference": "432dec55da108c471adcf58c351af01372a52164", "shasum": "" }, "require": { @@ -5729,7 +5729,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v6.4.8" + "source": "https://github.com/symfony/security-core/tree/v6.4.10" }, "funding": [ { @@ -5745,7 +5745,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/security-csrf", @@ -5817,16 +5817,16 @@ }, { "name": "symfony/security-http", - "version": "v6.4.8", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "fb82ddec887dc67f3bcf4d6df3cb8efd529be104" + "reference": "8e70f39626ada36c5492c3aff9369c85d2840948" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/fb82ddec887dc67f3bcf4d6df3cb8efd529be104", - "reference": "fb82ddec887dc67f3bcf4d6df3cb8efd529be104", + "url": "https://api.github.com/repos/symfony/security-http/zipball/8e70f39626ada36c5492c3aff9369c85d2840948", + "reference": "8e70f39626ada36c5492c3aff9369c85d2840948", "shasum": "" }, "require": { @@ -5885,7 +5885,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v6.4.8" + "source": "https://github.com/symfony/security-http/tree/v6.4.9" }, "funding": [ { @@ -5901,20 +5901,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-06-21T16:04:15+00:00" }, { "name": "symfony/serializer", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "d6eda9966a3e5d1823c1cedf41bf98f8ed969d7c" + "reference": "9a67fcf320561e96f94d62bbe0e169ac534a5718" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/d6eda9966a3e5d1823c1cedf41bf98f8ed969d7c", - "reference": "d6eda9966a3e5d1823c1cedf41bf98f8ed969d7c", + "url": "https://api.github.com/repos/symfony/serializer/zipball/9a67fcf320561e96f94d62bbe0e169ac534a5718", + "reference": "9a67fcf320561e96f94d62bbe0e169ac534a5718", "shasum": "" }, "require": { @@ -5983,7 +5983,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v6.4.8" + "source": "https://github.com/symfony/serializer/tree/v6.4.10" }, "funding": [ { @@ -5999,7 +5999,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T13:13:26+00:00" }, { "name": "symfony/service-contracts", @@ -6148,16 +6148,16 @@ }, { "name": "symfony/string", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "a147c0f826c4a1f3afb763ab8e009e37c877a44d" + "reference": "ccf9b30251719567bfd46494138327522b9a9446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/a147c0f826c4a1f3afb763ab8e009e37c877a44d", - "reference": "a147c0f826c4a1f3afb763ab8e009e37c877a44d", + "url": "https://api.github.com/repos/symfony/string/zipball/ccf9b30251719567bfd46494138327522b9a9446", + "reference": "ccf9b30251719567bfd46494138327522b9a9446", "shasum": "" }, "require": { @@ -6214,7 +6214,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.8" + "source": "https://github.com/symfony/string/tree/v6.4.10" }, "funding": [ { @@ -6230,20 +6230,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-22T10:21:14+00:00" }, { "name": "symfony/translation", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "a002933b13989fc4bd0b58e04bf7eec5210e438a" + "reference": "94041203f8ac200ae9e7c6a18fa6137814ccecc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/a002933b13989fc4bd0b58e04bf7eec5210e438a", - "reference": "a002933b13989fc4bd0b58e04bf7eec5210e438a", + "url": "https://api.github.com/repos/symfony/translation/zipball/94041203f8ac200ae9e7c6a18fa6137814ccecc9", + "reference": "94041203f8ac200ae9e7c6a18fa6137814ccecc9", "shasum": "" }, "require": { @@ -6309,7 +6309,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.8" + "source": "https://github.com/symfony/translation/tree/v6.4.10" }, "funding": [ { @@ -6325,7 +6325,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/translation-contracts", @@ -6407,16 +6407,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v6.4.8", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "57de1b7d7499053a2c5beb9344751e8bfd332649" + "reference": "9bcb26445b9d4ef1087c389234bf33fb00e10ea6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/57de1b7d7499053a2c5beb9344751e8bfd332649", - "reference": "57de1b7d7499053a2c5beb9344751e8bfd332649", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/9bcb26445b9d4ef1087c389234bf33fb00e10ea6", + "reference": "9bcb26445b9d4ef1087c389234bf33fb00e10ea6", "shasum": "" }, "require": { @@ -6496,7 +6496,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v6.4.8" + "source": "https://github.com/symfony/twig-bridge/tree/v6.4.9" }, "funding": [ { @@ -6512,7 +6512,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-06-21T16:04:15+00:00" }, { "name": "symfony/twig-bundle", @@ -6600,16 +6600,16 @@ }, { "name": "symfony/validator", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "dab2781371d54c86f6b25623ab16abb2dde2870c" + "reference": "bcf939a9d1acd7d2912e9474c0c3d7840a03cbcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/dab2781371d54c86f6b25623ab16abb2dde2870c", - "reference": "dab2781371d54c86f6b25623ab16abb2dde2870c", + "url": "https://api.github.com/repos/symfony/validator/zipball/bcf939a9d1acd7d2912e9474c0c3d7840a03cbcd", + "reference": "bcf939a9d1acd7d2912e9474c0c3d7840a03cbcd", "shasum": "" }, "require": { @@ -6677,7 +6677,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.4.8" + "source": "https://github.com/symfony/validator/tree/v6.4.10" }, "funding": [ { @@ -6693,20 +6693,20 @@ "type": "tidelift" } ], - "time": "2024-06-02T15:48:50+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "ad23ca4312395f0a8a8633c831ef4c4ee542ed25" + "reference": "a71cc3374f5fb9759da1961d28c452373b343dd4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ad23ca4312395f0a8a8633c831ef4c4ee542ed25", - "reference": "ad23ca4312395f0a8a8633c831ef4c4ee542ed25", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/a71cc3374f5fb9759da1961d28c452373b343dd4", + "reference": "a71cc3374f5fb9759da1961d28c452373b343dd4", "shasum": "" }, "require": { @@ -6762,7 +6762,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.8" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.10" }, "funding": [ { @@ -6778,20 +6778,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/var-exporter", - "version": "v6.4.8", + "version": "v6.4.9", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "792ca836f99b340f2e9ca9497c7953948c49a504" + "reference": "f9a060622e0d93777b7f8687ec4860191e16802e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/792ca836f99b340f2e9ca9497c7953948c49a504", - "reference": "792ca836f99b340f2e9ca9497c7953948c49a504", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/f9a060622e0d93777b7f8687ec4860191e16802e", + "reference": "f9a060622e0d93777b7f8687ec4860191e16802e", "shasum": "" }, "require": { @@ -6839,7 +6839,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.4.8" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.9" }, "funding": [ { @@ -6855,7 +6855,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-06-24T15:53:56+00:00" }, { "name": "symfony/web-link", @@ -7014,16 +7014,16 @@ }, { "name": "twig/twig", - "version": "v3.10.3", + "version": "v3.11.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572" + "reference": "e80fb8ebba85c7341a97a9ebf825d7fd4b77708d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/e80fb8ebba85c7341a97a9ebf825d7fd4b77708d", + "reference": "e80fb8ebba85c7341a97a9ebf825d7fd4b77708d", "shasum": "" }, "require": { @@ -7031,7 +7031,8 @@ "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php80": "^1.22" + "symfony/polyfill-php80": "^1.22", + "symfony/polyfill-php81": "^1.29" }, "require-dev": { "psr/container": "^1.0|^2.0", @@ -7077,7 +7078,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.10.3" + "source": "https://github.com/twigphp/Twig/tree/v3.11.0" }, "funding": [ { @@ -7089,7 +7090,7 @@ "type": "tidelift" } ], - "time": "2024-05-16T10:04:27+00:00" + "time": "2024-08-08T16:15:16+00:00" }, { "name": "webmozart/assert", @@ -7577,16 +7578,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -7594,11 +7595,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -7624,7 +7626,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -7632,20 +7634,20 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -7656,7 +7658,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -7688,9 +7690,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "phar-io/manifest", @@ -8131,45 +8133,45 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.19", + "version": "9.6.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" + "reference": "49d7820565836236411f5dc002d16dd689cde42f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", - "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", + "reference": "49d7820565836236411f5dc002d16dd689cde42f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", + "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", + "phpunit/php-text-template": "^2.0.4", + "phpunit/php-timer": "^5.0.3", + "sebastian/cli-parser": "^1.0.2", + "sebastian/code-unit": "^1.0.8", "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", + "sebastian/diff": "^4.0.6", + "sebastian/environment": "^5.1.5", + "sebastian/exporter": "^4.0.6", + "sebastian/global-state": "^5.0.7", + "sebastian/object-enumerator": "^4.0.4", + "sebastian/resource-operations": "^3.0.4", + "sebastian/type": "^3.2.1", "sebastian/version": "^3.0.2" }, "suggest": { @@ -8214,7 +8216,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" }, "funding": [ { @@ -8230,7 +8232,7 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:35:58+00:00" + "time": "2024-07-10T11:45:39+00:00" }, { "name": "sebastian/cli-parser", @@ -9489,16 +9491,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v7.1.1", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16" + "reference": "e823122d31935eb711e2767c31f3d71cb0b87fb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16", - "reference": "3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/e823122d31935eb711e2767c31f3d71cb0b87fb1", + "reference": "e823122d31935eb711e2767c31f3d71cb0b87fb1", "shasum": "" }, "require": { @@ -9551,7 +9553,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v7.1.1" + "source": "https://github.com/symfony/phpunit-bridge/tree/v7.1.3" }, "funding": [ { @@ -9567,7 +9569,7 @@ "type": "tidelift" } ], - "time": "2024-06-04T06:50:37+00:00" + "time": "2024-07-26T12:41:01+00:00" }, { "name": "symfony/process", @@ -9632,16 +9634,16 @@ }, { "name": "symfony/web-profiler-bundle", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "bcc806d1360991de3bf78ac5ca0202db85de9bfc" + "reference": "370c9f1e3567cd4670d44311838e37d16182c3a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/bcc806d1360991de3bf78ac5ca0202db85de9bfc", - "reference": "bcc806d1360991de3bf78ac5ca0202db85de9bfc", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/370c9f1e3567cd4670d44311838e37d16182c3a7", + "reference": "370c9f1e3567cd4670d44311838e37d16182c3a7", "shasum": "" }, "require": { @@ -9694,7 +9696,7 @@ "dev" ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.8" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.10" }, "funding": [ { @@ -9710,7 +9712,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-19T07:26:48+00:00" }, { "name": "theseer/tokenizer", @@ -9879,16 +9881,16 @@ }, { "name": "zenstruck/foundry", - "version": "v1.38.0", + "version": "v1.38.3", "source": { "type": "git", "url": "https://github.com/zenstruck/foundry.git", - "reference": "fd3c763de120445878077e54c608d8d75a3cc22d" + "reference": "112e3a6ce1d75627a3fbfd6cd009055994167edb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zenstruck/foundry/zipball/fd3c763de120445878077e54c608d8d75a3cc22d", - "reference": "fd3c763de120445878077e54c608d8d75a3cc22d", + "url": "https://api.github.com/repos/zenstruck/foundry/zipball/112e3a6ce1d75627a3fbfd6cd009055994167edb", + "reference": "112e3a6ce1d75627a3fbfd6cd009055994167edb", "shasum": "" }, "require": { @@ -9961,7 +9963,7 @@ ], "support": { "issues": "https://github.com/zenstruck/foundry/issues", - "source": "https://github.com/zenstruck/foundry/tree/v1.38.0" + "source": "https://github.com/zenstruck/foundry/tree/v1.38.3" }, "funding": [ { @@ -9969,7 +9971,7 @@ "type": "github" } ], - "time": "2024-06-07T23:04:21+00:00" + "time": "2024-07-04T19:59:49+00:00" } ], "aliases": [], diff --git a/config/api_platform/Client.yaml b/config/api_platform/Client.yaml index b61769b..4fca0a6 100644 --- a/config/api_platform/Client.yaml +++ b/config/api_platform/Client.yaml @@ -13,7 +13,7 @@ resources: filters: - 'api_platform.filter.client.order' - 'api_platform.filter.client.search' - - 'api_platform.filter.client.boolean' + ApiPlatform\Metadata\Get: provider: App\State\Provider\ClientProvider ApiPlatform\Metadata\Put: diff --git a/config/api_platform/OrganizationalUnit.yaml b/config/api_platform/OrganizationalUnit.yaml index ac90e14..e8f198b 100644 --- a/config/api_platform/OrganizationalUnit.yaml +++ b/config/api_platform/OrganizationalUnit.yaml @@ -13,6 +13,7 @@ resources: filters: - 'api_platform.filter.organizational_unit.order' - 'api_platform.filter.organizational_unit.search' + ApiPlatform\Metadata\Get: security: 'is_granted("ORGANIZATIONAL_UNIT_VIEW", object)' provider: App\State\Provider\OrganizationalUnitProvider diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index 352abc2..f449351 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -2,39 +2,20 @@ api_platform: title: 'OgCore Api' description: 'Api Documentation for OgCore' version: 1.0.0 - path_segment_name_generator: 'api_platform.path_segment_name_generator.dash' + path_segment_name_generator: api_platform.path_segment_name_generator.dash + defaults: + pagination_client_items_per_page: true + collection: + pagination: + items_per_page_parameter_name: 'itemsPerPage' formats: jsonld: [ 'application/ld+json' ] - jsonhal: [ 'application/hal+json' ] - jsonapi: [ 'application/vnd.api+json' ] - json: [ 'application/json' ] - xml: [ 'application/xml', 'text/xml' ] - yaml: [ 'application/x-yaml' ] - csv: [ 'text/csv' ] - html: [ 'text/html' ] + json: [ 'application/json' ] + csv: [ 'text/csv' ] patch_formats: jsonld: ['application/ld+json', 'application/json'] mapping: paths: ['%kernel.project_dir%/config/api_platform', '%kernel.project_dir%/src/Dto'] - use_symfony_listeners: true - collection: - pagination: - items_per_page_parameter_name: 'itemsPerPage' - defaults: - pagination_client_items_per_page: true - denormalization_context: - allow_extra_attributes: false - cache_headers: - vary: [ 'Content-Type', 'Authorization', 'Origin' ] - extra_properties: - standard_put: true - rfc_7807_compliant_errors: true - event_listeners_backward_compatibility_layer: false - keep_legacy_inflector: true - docs_formats: - jsonld: ['application/ld+json'] - jsonopenapi: ['application/vnd.openapi+json'] - html: ['text/html'] swagger: versions: [3] api_keys: diff --git a/docker/default.conf b/docker/default.conf index 654373e..7d7fc2c 100644 --- a/docker/default.conf +++ b/docker/default.conf @@ -2,19 +2,19 @@ server { listen 80; server_name localhost; root /var/www/html/public; + index index.html index.php; - location / { - try_files $uri /index.php?$is_args$args; + location / { + try_files $uri $uri/ /index.php?$args; } - location ~ ^/index.php(/|$) { + location ~ \.php$ { include fastcgi_params; fastcgi_pass php:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param DOCUMENT_ROOT $document_root; - internal; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; } location ~ \.php$ { diff --git a/migrations/Version20240819062421.php b/migrations/Version20240819062421.php new file mode 100644 index 0000000..79b21f8 --- /dev/null +++ b/migrations/Version20240819062421.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE og_live ADD synchronized TINYINT(1) DEFAULT NULL'); + $this->addSql('ALTER TABLE pxe_template ADD synchronized TINYINT(1) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE og_live DROP synchronized'); + $this->addSql('ALTER TABLE pxe_template DROP synchronized'); + } +} diff --git a/src/Dto/Output/OgLiveOutput.php b/src/Dto/Output/OgLiveOutput.php index 1b15405..c4462b5 100644 --- a/src/Dto/Output/OgLiveOutput.php +++ b/src/Dto/Output/OgLiveOutput.php @@ -13,6 +13,9 @@ final class OgLiveOutput extends AbstractOutput #[Groups(['og-live:read'])] public string $name; + #[Groups(['og-live:read'])] + public ?bool $synchronized = false; + #[Groups(['og-live:read'])] public ?string $downloadUrl = ''; @@ -27,6 +30,7 @@ final class OgLiveOutput extends AbstractOutput parent::__construct($ogLive); $this->name = $ogLive->getName(); + $this->synchronized = $ogLive->isSynchronized(); $this->downloadUrl = $ogLive->getDownloadUrl(); $this->createdAt = $ogLive->getCreatedAt(); $this->createdBy = $ogLive->getCreatedBy(); diff --git a/src/Dto/Output/PxeTemplateOutput.php b/src/Dto/Output/PxeTemplateOutput.php index 245e007..fd7b5e9 100644 --- a/src/Dto/Output/PxeTemplateOutput.php +++ b/src/Dto/Output/PxeTemplateOutput.php @@ -13,6 +13,9 @@ final class PxeTemplateOutput extends AbstractOutput #[Groups(['pxe-template:read'])] public string $name; + #[Groups(['pxe-template:read'])] + public ?bool $synchronized = null; + #[Groups(['pxe-template:read'])] public ?string $templateContent = ''; @@ -27,6 +30,7 @@ final class PxeTemplateOutput extends AbstractOutput parent::__construct($pxeTemplate); $this->name = $pxeTemplate->getName(); + $this->synchronized = $pxeTemplate->isSynchronized(); $this->templateContent = $pxeTemplate->getTemplateContent(); $this->createdAt = $pxeTemplate->getCreatedAt(); $this->createdBy = $pxeTemplate->getCreatedBy(); diff --git a/src/Entity/OgLive.php b/src/Entity/OgLive.php index e9c6e82..14decae 100644 --- a/src/Entity/OgLive.php +++ b/src/Entity/OgLive.php @@ -12,6 +12,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; class OgLive extends AbstractEntity { use NameableTrait; + use SynchronizedTrait; #[ORM\Column(length: 255, nullable: true)] private ?string $downloadUrl = null; diff --git a/src/Entity/PxeTemplate.php b/src/Entity/PxeTemplate.php index af0e7b3..b2d3cfb 100644 --- a/src/Entity/PxeTemplate.php +++ b/src/Entity/PxeTemplate.php @@ -13,8 +13,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; class PxeTemplate extends AbstractEntity { use NameableTrait; + use SynchronizedTrait; - #[ORM\Column(length: 255, type: Types::TEXT)] + #[ORM\Column(type: Types::TEXT, length: 255)] private ?string $templateContent = null; public function getTemplateContent(): ?string diff --git a/src/Entity/SynchronizedTrait.php b/src/Entity/SynchronizedTrait.php new file mode 100644 index 0000000..f4da200 --- /dev/null +++ b/src/Entity/SynchronizedTrait.php @@ -0,0 +1,23 @@ +synchronized; + } + + public function setSynchronized(?bool $synchronized): self + { + $this->synchronized = $synchronized; + + return $this; + } +} diff --git a/src/OpenApi/OpenApiFactory.php b/src/OpenApi/OpenApiFactory.php index 9e0ae6f..dc755c8 100644 --- a/src/OpenApi/OpenApiFactory.php +++ b/src/OpenApi/OpenApiFactory.php @@ -20,7 +20,7 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface $this->addRefreshToken($openApi); $this->addSearchEndpoint($openApi); - + $this->addStatusEndpoint($openApi); // Agregar el nuevo endpoint return $openApi; } @@ -126,4 +126,53 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface ]) )); } + + private function addStatusEndpoint(OpenApi $openApi): void + { + $openApi + ->getPaths() + ->addPath('/og-boot/status', (new Model\PathItem())->withGet( + (new Model\Operation('getStatus')) + ->withTags(['OgBoot']) + ->withResponses([ + Response::HTTP_OK => [ + 'description' => 'Service status', + 'content' => [ + 'application/json' => [ + 'schema' => [ + 'type' => 'object', + 'properties' => [ + 'status' => [ + 'type' => 'string', + 'example' => 'ok', + ], + 'uptime' => [ + 'type' => 'integer', + 'example' => 12345, + ], + ], + ], + ], + ], + ], + Response::HTTP_SERVICE_UNAVAILABLE => [ + 'description' => 'Service unavailable', + 'content' => [ + 'application/json' => [ + 'schema' => [ + 'type' => 'object', + 'properties' => [ + 'error' => [ + 'type' => 'string', + 'example' => 'Service is down', + ], + ], + ], + ], + ], + ], + ]) + ->withSummary('Get service status') + )); + } } \ No newline at end of file diff --git a/src/State/Processor/OrganizationalUnitProcessor.php b/src/State/Processor/OrganizationalUnitProcessor.php index 41d3974..468e410 100644 --- a/src/State/Processor/OrganizationalUnitProcessor.php +++ b/src/State/Processor/OrganizationalUnitProcessor.php @@ -21,12 +21,12 @@ use App\Repository\OrganizationalUnitRepository; use App\Service\ChangeClientNetworkSettingsService; use Doctrine\ORM\EntityManagerInterface; -class OrganizationalUnitProcessor implements ProcessorInterface +readonly class OrganizationalUnitProcessor implements ProcessorInterface { public function __construct( - private readonly OrganizationalUnitRepository $organizationalUnitRepository, - private readonly ValidatorInterface $validator, - private readonly ChangeClientNetworkSettingsService $changeClientNetworkSettingsService, + private OrganizationalUnitRepository $organizationalUnitRepository, + private ValidatorInterface $validator, + private ChangeClientNetworkSettingsService $changeClientNetworkSettingsService, ) { } diff --git a/src/State/Provider/ClientProvider.php b/src/State/Provider/ClientProvider.php index d398a0f..c5dd7d0 100644 --- a/src/State/Provider/ClientProvider.php +++ b/src/State/Provider/ClientProvider.php @@ -13,11 +13,11 @@ use App\Dto\Input\ClientInput; use App\Dto\Output\ClientOutput; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -class ClientProvider implements ProviderInterface +readonly class ClientProvider implements ProviderInterface { public function __construct( - private readonly ProviderInterface $collectionProvider, - private readonly ProviderInterface $itemProvider + private ProviderInterface $collectionProvider, + private ProviderInterface $itemProvider ) { } diff --git a/src/State/Provider/OrganizationalUnitProvider.php b/src/State/Provider/OrganizationalUnitProvider.php index 7475e68..3aa0349 100644 --- a/src/State/Provider/OrganizationalUnitProvider.php +++ b/src/State/Provider/OrganizationalUnitProvider.php @@ -14,7 +14,7 @@ use App\Dto\Output\OrganizationalUnitOutput; use App\Entity\OrganizationalUnit; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -readonly class OrganizationalUnitProvider implements ProviderInterface +final readonly class OrganizationalUnitProvider implements ProviderInterface { public function __construct( private ProviderInterface $collectionProvider, From 36863bff7bfbde5f8c6ad11c943f890c285e5403 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 19 Aug 2024 16:03:37 +0200 Subject: [PATCH 03/17] refs #632. Create new fields and updated API --- config/api_platform/PxeBootFile.yaml | 17 +++++++--- migrations/Version20240819140045.php | 33 +++++++++++++++++++ .../OgBoot/OgLive/InstallAction.php | 9 +++-- .../OgBoot/OgLive/SetDefaultAction.php | 7 +++- ...{GetAction.php => GetCollectionAction.php} | 4 +-- .../OgBoot/PxeTemplate/PostAction.php | 7 +++- src/Dto/Output/OgLiveOutput.php | 8 +++++ src/Dto/Output/PxeBootFileOutput.php | 4 +++ src/Entity/OgLive.php | 15 +++++++++ src/Entity/PxeBootFile.php | 2 ++ 10 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 migrations/Version20240819140045.php rename src/Controller/OgBoot/PxeBootFile/{GetAction.php => GetCollectionAction.php} (94%) diff --git a/config/api_platform/PxeBootFile.yaml b/config/api_platform/PxeBootFile.yaml index 6c5886d..f8cafaa 100644 --- a/config/api_platform/PxeBootFile.yaml +++ b/config/api_platform/PxeBootFile.yaml @@ -9,20 +9,29 @@ resources: groups: ['pxe-boot-file:write'] operations: ApiPlatform\Metadata\GetCollection: - provider: App\State\Provider\PPxeBootFileProvider + provider: App\State\Provider\PxeBootFileProvider filters: - 'api_platform.filter.pxe_boot_file.order' - 'api_platform.filter.pxe_boot_file.search' ApiPlatform\Metadata\Get: - provider: App\State\Provider\PxeTemplateProvider + provider: App\State\Provider\PxeBootFileProvider ApiPlatform\Metadata\Put: - provider: App\State\Provider\PxeTemplateProvider + provider: App\State\Provider\PxeBootFileProvider ApiPlatform\Metadata\Patch: - provider: App\State\Provider\PxeTemplateProvider + provider: App\State\Provider\PxeBootFileProvider ApiPlatform\Metadata\Post: ~ ApiPlatform\Metadata\Delete: ~ + get_collection: + shortName: PxeBootFile Server + description: Get collection of PxeBootFile + class: ApiPlatform\Metadata\GetCollection + method: GET + input: false + uriTemplate: /pxe-boot-files/server/get-collection + controller: App\Controller\OgBoot\PxeBootFile\GetCollectionAction + properties: App\Entity\PxeBootFile: id: diff --git a/migrations/Version20240819140045.php b/migrations/Version20240819140045.php new file mode 100644 index 0000000..01a67ef --- /dev/null +++ b/migrations/Version20240819140045.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE og_live ADD `default` TINYINT(1) DEFAULT NULL'); + $this->addSql('ALTER TABLE pxe_boot_file ADD synchronized TINYINT(1) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE og_live DROP `default`'); + $this->addSql('ALTER TABLE pxe_boot_file DROP synchronized'); + } +} diff --git a/src/Controller/OgBoot/OgLive/InstallAction.php b/src/Controller/OgBoot/OgLive/InstallAction.php index 485cb4d..b2bcdac 100644 --- a/src/Controller/OgBoot/OgLive/InstallAction.php +++ b/src/Controller/OgBoot/OgLive/InstallAction.php @@ -4,6 +4,7 @@ namespace App\Controller\OgBoot\OgLive; use App\Controller\OgBoot\AbstractOgLiveController; use App\Entity\OgLive; +use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; @@ -22,7 +23,7 @@ class InstallAction extends AbstractOgLiveController * @throws RedirectionExceptionInterface * @throws ClientExceptionInterface */ - public function __invoke(OgLive $data, HttpClientInterface $httpClient): JsonResponse + public function __invoke(OgLive $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { try { $response = $httpClient->request('POST', $this->ogBootApiUrl.'/ogboot/v1/oglives/install', [ @@ -31,13 +32,17 @@ class InstallAction extends AbstractOgLiveController 'Content-Type' => 'application/json', ], 'json' => [ - 'isoname' => $data->getName() + 'url' => $data->getDownloadUrl() ] ]); } catch (TransportExceptionInterface $e) { return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); } + $data->setInstalled(true); + $entityManager->persist($data); + $entityManager->flush(); + $data = json_decode($response->getContent(), true); return new JsonResponse( data: $data, status: Response::HTTP_OK); diff --git a/src/Controller/OgBoot/OgLive/SetDefaultAction.php b/src/Controller/OgBoot/OgLive/SetDefaultAction.php index 0f96d13..ffdf033 100644 --- a/src/Controller/OgBoot/OgLive/SetDefaultAction.php +++ b/src/Controller/OgBoot/OgLive/SetDefaultAction.php @@ -4,6 +4,7 @@ namespace App\Controller\OgBoot\OgLive; use App\Controller\OgBoot\AbstractOgLiveController; use App\Entity\OgLive; +use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; @@ -22,7 +23,7 @@ class SetDefaultAction extends AbstractOgLiveController * @throws RedirectionExceptionInterface * @throws ClientExceptionInterface */ - public function __invoke(OgLive $data, HttpClientInterface $httpClient): JsonResponse + public function __invoke(OgLive $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { try { $response = $httpClient->request('POST', $this->ogBootApiUrl.'/ogboot/v1/oglives/default', [ @@ -37,6 +38,10 @@ class SetDefaultAction extends AbstractOgLiveController return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); } + $data->setDefault(true); + $entityManager->persist($data); + $entityManager->flush(); + $data = json_decode($response->getContent(), true); return new JsonResponse( data: $data, status: Response::HTTP_OK); diff --git a/src/Controller/OgBoot/PxeBootFile/GetAction.php b/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php similarity index 94% rename from src/Controller/OgBoot/PxeBootFile/GetAction.php rename to src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php index 766da38..1b07fc6 100644 --- a/src/Controller/OgBoot/PxeBootFile/GetAction.php +++ b/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php @@ -16,7 +16,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class GetAction extends AbstractOgLiveController +class GetCollectionAction extends AbstractOgLiveController { /** * @throws TransportExceptionInterface @@ -27,7 +27,7 @@ class GetAction extends AbstractOgLiveController public function __invoke(PxeBootFile $data, HttpClientInterface $httpClient): JsonResponse { try { - $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/pxes/'.$data->getName(), [ + $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/pxes', [ 'headers' => [ 'accept' => 'application/json', ], diff --git a/src/Controller/OgBoot/PxeTemplate/PostAction.php b/src/Controller/OgBoot/PxeTemplate/PostAction.php index a2f996c..6daf8d8 100644 --- a/src/Controller/OgBoot/PxeTemplate/PostAction.php +++ b/src/Controller/OgBoot/PxeTemplate/PostAction.php @@ -4,6 +4,7 @@ namespace App\Controller\OgBoot\PxeTemplate; use App\Controller\OgBoot\AbstractOgLiveController; use App\Entity\PxeTemplate; +use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; @@ -23,7 +24,7 @@ class PostAction extends AbstractOgLiveController * @throws RedirectionExceptionInterface * @throws ClientExceptionInterface */ - public function __invoke(PxeTemplate $data, HttpClientInterface $httpClient): JsonResponse + public function __invoke(PxeTemplate $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { try { $response = $httpClient->request('POST', $this->ogBootApiUrl.'/ogboot/v1/pxe-templates', [ @@ -37,6 +38,10 @@ class PostAction extends AbstractOgLiveController ], ]); + $data->setSynchronized(true); + $entityManager->persist($data); + $entityManager->flush(); + $data = json_decode($response->getContent(), true); return new JsonResponse($data, Response::HTTP_OK); diff --git a/src/Dto/Output/OgLiveOutput.php b/src/Dto/Output/OgLiveOutput.php index c4462b5..28e117e 100644 --- a/src/Dto/Output/OgLiveOutput.php +++ b/src/Dto/Output/OgLiveOutput.php @@ -16,6 +16,12 @@ final class OgLiveOutput extends AbstractOutput #[Groups(['og-live:read'])] public ?bool $synchronized = false; + #[Groups(['og-live:read'])] + public ?bool $installed = false; + + #[Groups(['og-live:read'])] + public ?bool $default = false; + #[Groups(['og-live:read'])] public ?string $downloadUrl = ''; @@ -31,6 +37,8 @@ final class OgLiveOutput extends AbstractOutput $this->name = $ogLive->getName(); $this->synchronized = $ogLive->isSynchronized(); + $this->installed = $ogLive->isInstalled(); + $this->default = $ogLive->isDefault(); $this->downloadUrl = $ogLive->getDownloadUrl(); $this->createdAt = $ogLive->getCreatedAt(); $this->createdBy = $ogLive->getCreatedBy(); diff --git a/src/Dto/Output/PxeBootFileOutput.php b/src/Dto/Output/PxeBootFileOutput.php index 9000eab..ff76bc6 100644 --- a/src/Dto/Output/PxeBootFileOutput.php +++ b/src/Dto/Output/PxeBootFileOutput.php @@ -17,6 +17,9 @@ final class PxeBootFileOutput extends AbstractOutput #[Groups(['pxe-boot-file:read'])] public array $clients; + #[Groups(['pxe-boot-file:read'])] + public ?bool $synchronized = null; + #[Groups(['pxe-boot-file:read'])] public \DateTime $createdAt; @@ -32,6 +35,7 @@ final class PxeBootFileOutput extends AbstractOutput fn(Client $client) => new ClientOutput($client) )->toArray(); + $this->synchronized = $bootFile->isSynchronized(); $this->createdAt = $bootFile->getCreatedAt(); $this->createdBy = $bootFile->getCreatedBy(); } diff --git a/src/Entity/OgLive.php b/src/Entity/OgLive.php index 14decae..2ecb106 100644 --- a/src/Entity/OgLive.php +++ b/src/Entity/OgLive.php @@ -41,6 +41,9 @@ class OgLive extends AbstractEntity #[ORM\Column(nullable: true)] private ?bool $installed = null; + #[ORM\Column(nullable: true)] + private ?bool $default = null; + public function getDownloadUrl(): ?string { return $this->downloadUrl; @@ -148,4 +151,16 @@ class OgLive extends AbstractEntity return $this; } + + public function isDefault(): ?bool + { + return $this->default; + } + + public function setDefault(?bool $default): static + { + $this->default = $default; + + return $this; + } } diff --git a/src/Entity/PxeBootFile.php b/src/Entity/PxeBootFile.php index 1498caf..b14dd3f 100644 --- a/src/Entity/PxeBootFile.php +++ b/src/Entity/PxeBootFile.php @@ -10,6 +10,8 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: PxeBootFileRepository::class)] class PxeBootFile extends AbstractEntity { + use SynchronizedTrait; + #[ORM\ManyToOne] private ?PxeTemplate $template = null; From fa2ee36cb9263c3604401d461167e8bec8c56423 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 20 Aug 2024 08:44:28 +0200 Subject: [PATCH 04/17] refs #632. Create new fields and updated API --- migrations/Version20240820063513.php | 41 +++++++++++++++++++ migrations/Version20240820064106.php | 31 ++++++++++++++ src/Dto/Input/ClientInput.php | 12 ++++++ src/Dto/Input/NetworkSettingsInput.php | 13 ++++++ src/Dto/Output/ClientOutput.php | 5 +++ src/Dto/Output/NetworkSettingsOutput.php | 7 ++++ src/Dto/Output/OgLiveOutput.php | 4 +- src/Entity/Client.php | 15 +++++++ src/Entity/NetworkSettings.php | 15 +++++++ src/Entity/OgLive.php | 52 +++++++++++++++++++++--- 10 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 migrations/Version20240820063513.php create mode 100644 migrations/Version20240820064106.php diff --git a/migrations/Version20240820063513.php b/migrations/Version20240820063513.php new file mode 100644 index 0000000..42803dd --- /dev/null +++ b/migrations/Version20240820063513.php @@ -0,0 +1,41 @@ +addSql('ALTER TABLE client ADD og_live_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455F7E54CF3 FOREIGN KEY (og_live_id) REFERENCES og_live (id)'); + $this->addSql('CREATE INDEX IDX_C7440455F7E54CF3 ON client (og_live_id)'); + $this->addSql('ALTER TABLE network_settings ADD og_live_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B54F7E54CF3 FOREIGN KEY (og_live_id) REFERENCES og_live (id)'); + $this->addSql('CREATE INDEX IDX_48869B54F7E54CF3 ON network_settings (og_live_id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B54F7E54CF3'); + $this->addSql('DROP INDEX IDX_48869B54F7E54CF3 ON network_settings'); + $this->addSql('ALTER TABLE network_settings DROP og_live_id'); + $this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455F7E54CF3'); + $this->addSql('DROP INDEX IDX_C7440455F7E54CF3 ON client'); + $this->addSql('ALTER TABLE client DROP og_live_id'); + } +} diff --git a/migrations/Version20240820064106.php b/migrations/Version20240820064106.php new file mode 100644 index 0000000..2e387f6 --- /dev/null +++ b/migrations/Version20240820064106.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE og_live CHANGE `default` is_default TINYINT(1) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE og_live CHANGE is_default `default` TINYINT(1) DEFAULT NULL'); + } +} diff --git a/src/Dto/Input/ClientInput.php b/src/Dto/Input/ClientInput.php index 065e7a2..fbc5bf9 100644 --- a/src/Dto/Input/ClientInput.php +++ b/src/Dto/Input/ClientInput.php @@ -5,6 +5,7 @@ namespace App\Dto\Input; use ApiPlatform\Metadata\ApiProperty; use App\Dto\Output\HardwareProfileOutput; use App\Dto\Output\MenuOutput; +use App\Dto\Output\OgLiveOutput; use App\Dto\Output\OrganizationalUnitOutput; use App\Entity\Client; use App\Entity\OgRepository; @@ -76,6 +77,12 @@ final class ClientInput )] public ?HardwareProfileOutput $hardwareProfile = null; + #[Groups(['client:write'])] + #[ApiProperty( + description: 'OgLive del cliente' + )] + public ?OgLiveOutput $ogLive = null; + #[Groups(['client:write'])] #[ApiProperty( description: 'La posición del cliente dentro del aula' @@ -107,6 +114,10 @@ final class ClientInput $this->menu = new MenuOutput($client->getMenu()); } + if ($client->getOgLive()) { + $this->ogLive = new OgLiveOutput($client->getOgLive()); + } + if ($client->getHardwareProfile()) { $this->hardwareProfile = new HardwareProfileOutput($client->getHardwareProfile()); } @@ -126,6 +137,7 @@ final class ClientInput $client->setMac($this->mac); $client->setIp($this->ip); $client->setMenu($this->menu?->getEntity()); + $client->setOgLive($this->ogLive?->getEntity()); $client->setHardwareProfile($this->hardwareProfile?->getEntity()); $client->setPosition($this->position); diff --git a/src/Dto/Input/NetworkSettingsInput.php b/src/Dto/Input/NetworkSettingsInput.php index e32c732..899a495 100644 --- a/src/Dto/Input/NetworkSettingsInput.php +++ b/src/Dto/Input/NetworkSettingsInput.php @@ -2,8 +2,10 @@ namespace App\Dto\Input; +use ApiPlatform\Metadata\ApiProperty; use App\Dto\Output\HardwareProfileOutput; use App\Dto\Output\MenuOutput; +use App\Dto\Output\OgLiveOutput; use App\Entity\HardwareProfile; use App\Entity\Menu; use App\Entity\NetworkSettings; @@ -62,6 +64,9 @@ class NetworkSettingsInput #[Groups(['organizational-unit:write'])] public ?HardwareProfileOutput $hardwareProfile = null; + #[Groups(['organizational-unit:write'])] + public ?OgLiveOutput $ogLive = null; + #[Groups(['organizational-unit:write'])] public ?bool $validation = null; @@ -91,6 +96,10 @@ class NetworkSettingsInput $this->hardwareProfile = new HardwareProfileOutput($networkSettings->getHardwareProfile()); } + if ($networkSettings->getOgLive()) { + $this->ogLive = new OgLiveOutput($networkSettings->getOgLive()); + } + $this->validation = $networkSettings->getValidation(); } @@ -120,6 +129,10 @@ class NetworkSettingsInput $networkSettings->setHardwareProfile($this->hardwareProfile->getEntity()); } + if ($this->ogLive) { + $networkSettings->setOgLive($this->ogLive->getEntity()); + } + $networkSettings->setValidation($this->validation); return $networkSettings; diff --git a/src/Dto/Output/ClientOutput.php b/src/Dto/Output/ClientOutput.php index 97c0b5a..2fe5ff3 100644 --- a/src/Dto/Output/ClientOutput.php +++ b/src/Dto/Output/ClientOutput.php @@ -48,6 +48,10 @@ final class ClientOutput extends AbstractOutput #[ApiProperty(readableLink: true )] public ?HardwareProfileOutput $hardwareProfile = null; + #[Groups(['client:read'])] + #[ApiProperty(readableLink: true )] + public ?OgLiveOutput $ogLive = null; + #[Groups(['client:read'])] public ?array $position = ['x' => 0, 'y' => 0]; @@ -79,6 +83,7 @@ final class ClientOutput extends AbstractOutput $this->menu = $client->getMenu() ? new MenuOutput($client->getMenu()) : null; $this->position = $client->getPosition(); $this->hardwareProfile = $client->getHardwareProfile() ? new HardwareProfileOutput($client->getHardwareProfile()) : null; + $this->ogLive = $client->getOgLive() ? new OgLiveOutput($client->getOgLive()) : null; $this->createdAt = $client->getCreatedAt(); $this->createdBy = $client->getCreatedBy(); } diff --git a/src/Dto/Output/NetworkSettingsOutput.php b/src/Dto/Output/NetworkSettingsOutput.php index 9c0b66d..1b90e03 100644 --- a/src/Dto/Output/NetworkSettingsOutput.php +++ b/src/Dto/Output/NetworkSettingsOutput.php @@ -48,6 +48,9 @@ final class NetworkSettingsOutput extends AbstractOutput #[Groups(['network-settings:read', "organizational-unit:read", "client:read"])] public ?HardwareProfileOutput $hardwareProfile = null; + #[Groups(['network-settings:read', "organizational-unit:read", "client:read"])] + public ?OgLiveOutput $ogLive = null; + #[Groups(['network-settings:read', "organizational-unit:read", "client:read"])] public ?bool $validation = null; @@ -81,6 +84,10 @@ final class NetworkSettingsOutput extends AbstractOutput $this->hardwareProfile = new HardwareProfileOutput($networkSettings->getHardwareProfile()); } + if ($networkSettings->getOgLive()) { + $this->ogLive = new OgLiveOutput($networkSettings->getOgLive()); + } + $this->validation = $networkSettings->getValidation(); $this->createdAt = $networkSettings->getCreatedAt(); $this->createdBy = $networkSettings->getCreatedBy(); diff --git a/src/Dto/Output/OgLiveOutput.php b/src/Dto/Output/OgLiveOutput.php index 28e117e..bc9fc32 100644 --- a/src/Dto/Output/OgLiveOutput.php +++ b/src/Dto/Output/OgLiveOutput.php @@ -20,7 +20,7 @@ final class OgLiveOutput extends AbstractOutput public ?bool $installed = false; #[Groups(['og-live:read'])] - public ?bool $default = false; + public ?bool $isDefault = false; #[Groups(['og-live:read'])] public ?string $downloadUrl = ''; @@ -38,7 +38,7 @@ final class OgLiveOutput extends AbstractOutput $this->name = $ogLive->getName(); $this->synchronized = $ogLive->isSynchronized(); $this->installed = $ogLive->isInstalled(); - $this->default = $ogLive->isDefault(); + $this->isDefault = $ogLive->getIsDefault(); $this->downloadUrl = $ogLive->getDownloadUrl(); $this->createdAt = $ogLive->getCreatedAt(); $this->createdBy = $ogLive->getCreatedBy(); diff --git a/src/Entity/Client.php b/src/Entity/Client.php index 82f5cac..f0aa640 100644 --- a/src/Entity/Client.php +++ b/src/Entity/Client.php @@ -63,6 +63,9 @@ class Client extends AbstractEntity #[ORM\ManyToOne(inversedBy: 'clients')] private ?OgRepository $repository = null; + #[ORM\ManyToOne(inversedBy: 'clients')] + private ?OgLive $ogLive = null; + public function __construct() { parent::__construct(); @@ -254,4 +257,16 @@ class Client extends AbstractEntity return $this; } + + public function getOgLive(): ?OgLive + { + return $this->ogLive; + } + + public function setOgLive(?OgLive $ogLive): static + { + $this->ogLive = $ogLive; + + return $this; + } } diff --git a/src/Entity/NetworkSettings.php b/src/Entity/NetworkSettings.php index de3b9c9..586386a 100644 --- a/src/Entity/NetworkSettings.php +++ b/src/Entity/NetworkSettings.php @@ -63,6 +63,9 @@ class NetworkSettings extends AbstractEntity #[ORM\ManyToOne] private ?OgRepository $repository = null; + #[ORM\ManyToOne] + private ?OgLive $ogLive = null; + public function __construct() { parent::__construct(); @@ -283,4 +286,16 @@ class NetworkSettings extends AbstractEntity return $this; } + + public function getOgLive(): ?OgLive + { + return $this->ogLive; + } + + public function setOgLive(?OgLive $ogLive): static + { + $this->ogLive = $ogLive; + + return $this; + } } diff --git a/src/Entity/OgLive.php b/src/Entity/OgLive.php index 2ecb106..4375882 100644 --- a/src/Entity/OgLive.php +++ b/src/Entity/OgLive.php @@ -3,6 +3,8 @@ namespace App\Entity; use App\Repository\OgLiveRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; @@ -42,7 +44,19 @@ class OgLive extends AbstractEntity private ?bool $installed = null; #[ORM\Column(nullable: true)] - private ?bool $default = null; + private ?bool $isDefault = null; + + /** + * @var Collection + */ + #[ORM\OneToMany(mappedBy: 'ogLive', targetEntity: Client::class)] + private Collection $clients; + + public function __construct() + { + parent::__construct(); + $this->clients = new ArrayCollection(); + } public function getDownloadUrl(): ?string { @@ -152,14 +166,42 @@ class OgLive extends AbstractEntity return $this; } - public function isDefault(): ?bool + public function getIsDefault(): ?bool { - return $this->default; + return $this->isDefault; } - public function setDefault(?bool $default): static + public function setIsDefault(?bool $isDefault): void { - $this->default = $default; + $this->isDefault = $isDefault; + } + + /** + * @return Collection + */ + public function getClients(): Collection + { + return $this->clients; + } + + public function addClient(Client $client): static + { + if (!$this->clients->contains($client)) { + $this->clients->add($client); + $client->setOgLive($this); + } + + return $this; + } + + public function removeClient(Client $client): static + { + if ($this->clients->removeElement($client)) { + // set the owning side to null (unless already changed) + if ($client->getOgLive() === $this) { + $client->setOgLive(null); + } + } return $this; } From 75ff3ff11c6e37517e7143f58f79abb4b443297e Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 20 Aug 2024 10:31:21 +0200 Subject: [PATCH 05/17] Updated ogBoot components view --- .env | 4 +-- config/api_platform/OgLive.yaml | 4 +-- config/api_platform/PxeBootFile.yaml | 2 +- .../OgBoot/OgLive/GetIsosAction.php | 29 ------------------- .../OgBoot/OgLive/InstallAction.php | 10 ++++--- .../OgBoot/OgLive/SetDefaultAction.php | 10 ++++--- 6 files changed, 17 insertions(+), 42 deletions(-) diff --git a/.env b/.env index 340a072..08e42ca 100644 --- a/.env +++ b/.env @@ -24,8 +24,8 @@ APP_SECRET=e95c7f17da15ce1b03d77ad655379c34 # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" -#DATABASE_URL="mysql://root:root@127.0.0.1:3336/dimio?serverVersion=8.0.32&charset=utf8mb4" -DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore?serverVersion=10.11.2-MariaDB&charset=utf8mb4" +DATABASE_URL="mysql://root:root@127.0.0.1:3336/dimio?serverVersion=8.0.32&charset=utf8mb4" +#DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore?serverVersion=10.11.2-MariaDB&charset=utf8mb4" OG_1_DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore_old_og?serverVersion=10.11.2-MariaDB&charset=utf8mb4" #DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" diff --git a/config/api_platform/OgLive.yaml b/config/api_platform/OgLive.yaml index 0504100..4239240 100644 --- a/config/api_platform/OgLive.yaml +++ b/config/api_platform/OgLive.yaml @@ -23,7 +23,7 @@ resources: ApiPlatform\Metadata\Post: ~ ApiPlatform\Metadata\Delete: ~ - get_collection: + get_collection_oglives: shortName: OgLive Server description: Get collection of OgLive class: ApiPlatform\Metadata\GetCollection @@ -32,7 +32,7 @@ resources: uriTemplate: /og-lives/server/get-collection controller: App\Controller\OgBoot\OgLive\GetCollectionAction - get: + get_oglive: shortName: OgLive Server description: Get OgLive class: ApiPlatform\Metadata\Get diff --git a/config/api_platform/PxeBootFile.yaml b/config/api_platform/PxeBootFile.yaml index f8cafaa..62775c5 100644 --- a/config/api_platform/PxeBootFile.yaml +++ b/config/api_platform/PxeBootFile.yaml @@ -23,7 +23,7 @@ resources: ApiPlatform\Metadata\Post: ~ ApiPlatform\Metadata\Delete: ~ - get_collection: + get_all: shortName: PxeBootFile Server description: Get collection of PxeBootFile class: ApiPlatform\Metadata\GetCollection diff --git a/src/Controller/OgBoot/OgLive/GetIsosAction.php b/src/Controller/OgBoot/OgLive/GetIsosAction.php index 436f9d4..2ad93b4 100644 --- a/src/Controller/OgBoot/OgLive/GetIsosAction.php +++ b/src/Controller/OgBoot/OgLive/GetIsosAction.php @@ -38,35 +38,6 @@ class GetIsosAction extends AbstractOgLiveController $data = json_decode($response->getContent(), true); - if (!empty($data['downloads'])) { - $ogLivesInserted = $this->insertOglives($data); - } - return new JsonResponse( data: [ 'data' => $data, 'ogLivesInserted' => $ogLivesInserted], status: Response::HTTP_OK); } - - public function insertOglives(array $data): int - { - $count = 0; - - foreach ($data['downloads'] as $ogLive ) { - $ogLiveEntity = $this->entityManager->getRepository(OgLive::class)->findOneBy(['name' => $ogLive['filename']]); - - if ($ogLiveEntity) { - continue; - } - - $ogLiveEntity = new OgLive(); - $ogLiveEntity->setName($ogLive['filename']); - $ogLiveEntity->setInstalled($ogLive['installed']); - $ogLiveEntity->setFilename($ogLive['filename']); - - $this->entityManager->persist($ogLiveEntity); - $count++; - } - - $this->entityManager->flush(); - - return $count; - } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/InstallAction.php b/src/Controller/OgBoot/OgLive/InstallAction.php index b2bcdac..7868240 100644 --- a/src/Controller/OgBoot/OgLive/InstallAction.php +++ b/src/Controller/OgBoot/OgLive/InstallAction.php @@ -36,12 +36,14 @@ class InstallAction extends AbstractOgLiveController ] ]); } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + return new JsonResponse( data: $e->getMessage(), status: Response::HTTP_INTERNAL_SERVER_ERROR); } - $data->setInstalled(true); - $entityManager->persist($data); - $entityManager->flush(); + if ($response->getStatusCode() === Response::HTTP_OK) { + $data->setInstalled(true); + $entityManager->persist($data); + $entityManager->flush(); + } $data = json_decode($response->getContent(), true); diff --git a/src/Controller/OgBoot/OgLive/SetDefaultAction.php b/src/Controller/OgBoot/OgLive/SetDefaultAction.php index ffdf033..3864e67 100644 --- a/src/Controller/OgBoot/OgLive/SetDefaultAction.php +++ b/src/Controller/OgBoot/OgLive/SetDefaultAction.php @@ -26,7 +26,7 @@ class SetDefaultAction extends AbstractOgLiveController public function __invoke(OgLive $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { try { - $response = $httpClient->request('POST', $this->ogBootApiUrl.'/ogboot/v1/oglives/default', [ + $response = $httpClient->request('PUT', $this->ogBootApiUrl.'/ogboot/v1/oglives/default', [ 'headers' => [ 'accept' => 'application/json', ], @@ -38,9 +38,11 @@ class SetDefaultAction extends AbstractOgLiveController return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); } - $data->setDefault(true); - $entityManager->persist($data); - $entityManager->flush(); + if ($response->getStatusCode() === Response::HTTP_OK) { + $data->setIsDefault(true); + $entityManager->persist($data); + $entityManager->flush(); + } $data = json_decode($response->getContent(), true); From 8677fc0f9452783ebb95f8a18e33cd5cd0a034be Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 20 Aug 2024 11:46:31 +0200 Subject: [PATCH 06/17] Updated PXEbootFiles input --- src/Controller/OgBoot/OgLive/SyncAction.php | 8 ++++++++ src/Dto/Input/PxeBootFileInput.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/Controller/OgBoot/OgLive/SyncAction.php diff --git a/src/Controller/OgBoot/OgLive/SyncAction.php b/src/Controller/OgBoot/OgLive/SyncAction.php new file mode 100644 index 0000000..edaee84 --- /dev/null +++ b/src/Controller/OgBoot/OgLive/SyncAction.php @@ -0,0 +1,8 @@ +setTemplate($this->template); + $bootFile->setTemplate($this->template->getEntity()); foreach ($this->clients as $client) { $clientsToAdd[] = $client->getEntity(); From 8e9db51cbc6ea6681106fef98d37f611c598334c Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 20 Aug 2024 12:10:04 +0200 Subject: [PATCH 07/17] Updated .env --- .env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 08e42ca..340a072 100644 --- a/.env +++ b/.env @@ -24,8 +24,8 @@ APP_SECRET=e95c7f17da15ce1b03d77ad655379c34 # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" -DATABASE_URL="mysql://root:root@127.0.0.1:3336/dimio?serverVersion=8.0.32&charset=utf8mb4" -#DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore?serverVersion=10.11.2-MariaDB&charset=utf8mb4" +#DATABASE_URL="mysql://root:root@127.0.0.1:3336/dimio?serverVersion=8.0.32&charset=utf8mb4" +DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore?serverVersion=10.11.2-MariaDB&charset=utf8mb4" OG_1_DATABASE_URL="mysql://root:root@ogcore-database:3306/ogcore_old_og?serverVersion=10.11.2-MariaDB&charset=utf8mb4" #DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" From 750e36ec99c1d0226b6b340d71acbac3c66680f3 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 21 Aug 2024 09:17:48 +0200 Subject: [PATCH 08/17] refs #601. Integration API pxe-boot-file --- config/api_platform/OgLive.yaml | 12 +++- migrations/Version20240821065158.php | 31 +++++++++ src/Controller/OgBoot/OgLive/SyncAction.php | 66 ++++++++++++++++++- .../OgBoot/OgLive/UninstallAction.php | 16 +++-- .../PxeBootFile/GetCollectionAction.php | 2 +- .../OgBoot/PxeTemplate/PostAction.php | 8 ++- src/Dto/Output/PxeTemplateOutput.php | 2 +- src/Entity/PxeTemplate.php | 2 +- .../OgBoot/PxeBootFile/PostService.php | 21 ++++-- src/State/Processor/PxeBootFileProcessor.php | 8 ++- 10 files changed, 146 insertions(+), 22 deletions(-) create mode 100644 migrations/Version20240821065158.php diff --git a/config/api_platform/OgLive.yaml b/config/api_platform/OgLive.yaml index 4239240..d69ddad 100644 --- a/config/api_platform/OgLive.yaml +++ b/config/api_platform/OgLive.yaml @@ -23,6 +23,13 @@ resources: ApiPlatform\Metadata\Post: ~ ApiPlatform\Metadata\Delete: ~ + sync: + class: ApiPlatform\Metadata\Post + method: POST + input: false + uriTemplate: /og-lives/sync + controller: App\Controller\OgBoot\OgLive\SyncAction + get_collection_oglives: shortName: OgLive Server description: Get collection of OgLive @@ -80,9 +87,10 @@ resources: uninstall: shortName: OgLive Server description: Uninstall OgLive - class: ApiPlatform\Metadata\Get - method: GET + class: ApiPlatform\Metadata\Post + method: POST input: false + output: false uriTemplate: /og-lives/server/{uuid}/uninstall controller: App\Controller\OgBoot\OgLive\UninstallAction diff --git a/migrations/Version20240821065158.php b/migrations/Version20240821065158.php new file mode 100644 index 0000000..dfcd85a --- /dev/null +++ b/migrations/Version20240821065158.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE pxe_template CHANGE template_content template_content LONGTEXT NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE pxe_template CHANGE template_content template_content TINYTEXT NOT NULL'); + } +} diff --git a/src/Controller/OgBoot/OgLive/SyncAction.php b/src/Controller/OgBoot/OgLive/SyncAction.php index edaee84..6171cc8 100644 --- a/src/Controller/OgBoot/OgLive/SyncAction.php +++ b/src/Controller/OgBoot/OgLive/SyncAction.php @@ -2,7 +2,69 @@ namespace App\Controller\OgBoot\OgLive; -class SyncAction -{ +use App\Controller\OgBoot\AbstractOgLiveController; +use App\Entity\OgLive; +use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Attribute\AsController; +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\HttpClientInterface; +#[AsController] +class SyncAction extends AbstractOgLiveController +{ + /** + * @throws TransportExceptionInterface + * @throws ServerExceptionInterface + * @throws RedirectionExceptionInterface + * @throws ClientExceptionInterface + */ + public function __invoke(HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse + { + try { + $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/oglives', [ + 'headers' => [ + 'accept' => 'application/json', + ], + ]); + + } catch (TransportExceptionInterface $e) { + return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + } + + $data = json_decode($response->getContent(), true); + + foreach ($data['installed_ogLives'] as $ogLive) { + $ogLiveEntity = $this->entityManager->getRepository(OgLive::class)->findOneBy(['checksum' => $ogLive['id']]); + if ($ogLiveEntity) { + $ogLiveEntity->setName($ogLive['filename']); + $ogLiveEntity->setInstalled(true); + $ogLiveEntity->setArchitecture($ogLive['architecture']); + $ogLiveEntity->setKernel($ogLive['kernel']); + $ogLiveEntity->setRevision($ogLive['revision']); + $ogLiveEntity->setDirectory($ogLive['directory']); + $ogLiveEntity->setChecksum($ogLive['id']); + $this->entityManager->persist($ogLiveEntity); + } else { + $ogLiveEntity = new OgLive(); + $ogLiveEntity->setName($ogLive['filename']); + $ogLiveEntity->setInstalled(true); + $ogLiveEntity->setArchitecture($ogLive['architecture']); + $ogLiveEntity->setKernel($ogLive['kernel']); + $ogLiveEntity->setRevision($ogLive['revision']); + $ogLiveEntity->setDirectory($ogLive['directory']); + $ogLiveEntity->setChecksum($ogLive['id']); + } + $this->entityManager->persist($ogLiveEntity); + + } + + $this->entityManager->flush(); + + return new JsonResponse( data: $data, status: Response::HTTP_OK); + } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/UninstallAction.php b/src/Controller/OgBoot/OgLive/UninstallAction.php index e2981ec..ac9f047 100644 --- a/src/Controller/OgBoot/OgLive/UninstallAction.php +++ b/src/Controller/OgBoot/OgLive/UninstallAction.php @@ -4,6 +4,7 @@ namespace App\Controller\OgBoot\OgLive; use App\Controller\OgBoot\AbstractOgLiveController; use App\Entity\OgLive; +use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; @@ -17,12 +18,12 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class UninstallAction extends AbstractOgLiveController { /** - * @throws TransportExceptionInterface * @throws ServerExceptionInterface * @throws RedirectionExceptionInterface * @throws ClientExceptionInterface + * @throws TransportExceptionInterface */ - public function __invoke(OgLive $data, HttpClientInterface $httpClient): JsonResponse + public function __invoke(OgLive $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { try { $response = $httpClient->request('DELETE', $this->ogBootApiUrl.'/ogboot/v1/oglives/'.$data->getChecksum(), [ @@ -30,12 +31,17 @@ class UninstallAction extends AbstractOgLiveController 'accept' => 'application/json', ], ]); + } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + return new JsonResponse( data: $e->getMessage(), status: Response::HTTP_INTERNAL_SERVER_ERROR); } - $data = json_decode($response->getContent(), true); + if ($response->getStatusCode() === Response::HTTP_OK) { + $data->setInstalled(false); + $entityManager->persist($data); + $entityManager->flush(); + } - return new JsonResponse( data: $data, status: Response::HTTP_OK); + return new JsonResponse(status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php b/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php index 1b07fc6..f758745 100644 --- a/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php +++ b/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php @@ -24,7 +24,7 @@ class GetCollectionAction extends AbstractOgLiveController * @throws RedirectionExceptionInterface * @throws ClientExceptionInterface */ - public function __invoke(PxeBootFile $data, HttpClientInterface $httpClient): JsonResponse + public function __invoke(HttpClientInterface $httpClient): JsonResponse { try { $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/pxes', [ diff --git a/src/Controller/OgBoot/PxeTemplate/PostAction.php b/src/Controller/OgBoot/PxeTemplate/PostAction.php index 6daf8d8..d07a016 100644 --- a/src/Controller/OgBoot/PxeTemplate/PostAction.php +++ b/src/Controller/OgBoot/PxeTemplate/PostAction.php @@ -38,9 +38,11 @@ class PostAction extends AbstractOgLiveController ], ]); - $data->setSynchronized(true); - $entityManager->persist($data); - $entityManager->flush(); + if ($response->getStatusCode() === Response::HTTP_OK) { + $data->setSynchronized(true); + $entityManager->persist($data); + $entityManager->flush(); + } $data = json_decode($response->getContent(), true); return new JsonResponse($data, Response::HTTP_OK); diff --git a/src/Dto/Output/PxeTemplateOutput.php b/src/Dto/Output/PxeTemplateOutput.php index fd7b5e9..e66ba17 100644 --- a/src/Dto/Output/PxeTemplateOutput.php +++ b/src/Dto/Output/PxeTemplateOutput.php @@ -10,7 +10,7 @@ use Symfony\Component\Serializer\Annotation\Groups; #[Get(shortName: 'PxeTemplate')] final class PxeTemplateOutput extends AbstractOutput { - #[Groups(['pxe-template:read'])] + #[Groups(['pxe-template:read', 'pxe-boot-file:read'])] public string $name; #[Groups(['pxe-template:read'])] diff --git a/src/Entity/PxeTemplate.php b/src/Entity/PxeTemplate.php index b2d3cfb..39a79b1 100644 --- a/src/Entity/PxeTemplate.php +++ b/src/Entity/PxeTemplate.php @@ -15,7 +15,7 @@ class PxeTemplate extends AbstractEntity use NameableTrait; use SynchronizedTrait; - #[ORM\Column(type: Types::TEXT, length: 255)] + #[ORM\Column(type: Types::TEXT)] private ?string $templateContent = null; public function getTemplateContent(): ?string diff --git a/src/Service/OgBoot/PxeBootFile/PostService.php b/src/Service/OgBoot/PxeBootFile/PostService.php index cc19f4d..e836af2 100644 --- a/src/Service/OgBoot/PxeBootFile/PostService.php +++ b/src/Service/OgBoot/PxeBootFile/PostService.php @@ -35,31 +35,40 @@ readonly class PostService foreach ($bootFile->getClients() as $client) { $data = [ - 'template_name' => $bootFile->getTemplate()->getName(), + 'template_name' => 'pxe_default', 'mac' => $client->getMac(), + 'lang' => 'es_ES.UTF_8', 'ip' => $client->getIp(), - 'server_ip' => '', + 'server_ip' => '92.168.2.1', 'router' => $client->getOrganizationalUnit()->getNetworkSettings()->getRouter(), 'netmask' => $client->getOrganizationalUnit()->getNetworkSettings()->getNetmask(), 'computer_name' => $client->getName(), 'netiface' => $client->getNetiface(), 'group' => $client->getOrganizationalUnit()->getName(), - 'ogrepo' => $client->getRepository() ? $client->getRepository()->getIpAddress() : $client->getOrganizationalUnit()->getNetworkSettings()->getRepository()->getIpAddress(), - 'oglive' => '', + 'ogrepo' => $client->getRepository() ? $client->getRepository()->getIpAddress() : '192.168.2.1', + 'oglive' => '127.0.0.1', + 'oglog' => '192.168.2.1', + 'ogshare' => '192.168.2.1', + 'oglivedir' => 'ogLive', + 'ogprof' => 'false', + 'hardprofile' => '', + 'ogntp' => $client->getOrganizationalUnit()->getNetworkSettings()->getNtp(), 'ogdns' => $client->getOrganizationalUnit()->getNetworkSettings()->getDns(), 'ogProxy' => $client->getOrganizationalUnit()->getNetworkSettings()->getProxy(), - 'ogunit' => '' + 'ogunit' => '', + 'resolution' => '768' ]; try { $response = $httpClient->request('POST', $this->ogBootApiUrl.'/ogboot/v1/pxes', [ 'headers' => [ 'accept' => 'application/json', + 'Content-Type' => 'application/json', ], 'json' => $data ]); } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + return new JsonResponse( data: $e->getMessage(), status: Response::HTTP_INTERNAL_SERVER_ERROR); } return json_decode($response->getContent(), true); diff --git a/src/State/Processor/PxeBootFileProcessor.php b/src/State/Processor/PxeBootFileProcessor.php index 9b03645..b53e55b 100644 --- a/src/State/Processor/PxeBootFileProcessor.php +++ b/src/State/Processor/PxeBootFileProcessor.php @@ -13,6 +13,7 @@ use App\Dto\Input\PxeBootFileInput; use App\Dto\Output\PxeBootFileOutput; use App\Repository\PxeBootFileRepository; use App\Service\OgBoot\PxeBootFile\PostService; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; readonly class PxeBootFileProcessor implements ProcessorInterface { @@ -41,6 +42,7 @@ readonly class PxeBootFileProcessor implements ProcessorInterface /** * @throws \Exception + * @throws TransportExceptionInterface */ private function processCreateOrUpdate($data, Operation $operation, array $uriVariables = [], array $context = []): PxeBootFileOutput { @@ -57,7 +59,11 @@ readonly class PxeBootFileProcessor implements ProcessorInterface $this->validator->validate($pxeTemplate); $this->bootFileRepository->save($pxeTemplate); - $this->postService->__invoke($pxeTemplate); + try { + $this->postService->__invoke($pxeTemplate); + } catch (\Exception $e) { + + } return new PxeBootFileOutput($pxeTemplate); } From 6afce69f149948ffcfb5a75092bcb33296846240 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Fri, 23 Aug 2024 09:10:15 +0200 Subject: [PATCH 09/17] refs #658. Refactor endpoints --- config/api_platform/OgLive.yaml | 1 - .../OgBoot/AbstractOgBootController.php | 56 +++++++++++++++++++ .../OgBoot/AbstractOgLiveController.php | 20 ------- src/Controller/OgBoot/OgLive/GetAction.php | 19 +++---- .../OgBoot/OgLive/GetCollectionAction.php | 19 ++----- .../OgBoot/OgLive/GetDefaultAction.php | 18 ++---- .../OgBoot/OgLive/GetIsosAction.php | 20 ++----- .../OgBoot/OgLive/InstallAction.php | 37 ++++++------ .../OgBoot/OgLive/SetDefaultAction.php | 36 ++++++------ src/Controller/OgBoot/OgLive/SyncAction.php | 56 ++++++++----------- .../OgBoot/OgLive/UninstallAction.php | 26 ++++----- .../PxeBootFile/GetCollectionAction.php | 18 ++---- .../OgBoot/PxeTemplate/DeleteAction.php | 14 +++-- .../OgBoot/PxeTemplate/GetAction.php | 4 +- .../PxeTemplate/GetCollectionAction.php | 4 +- .../OgBoot/PxeTemplate/PostAction.php | 4 +- 16 files changed, 161 insertions(+), 191 deletions(-) create mode 100644 src/Controller/OgBoot/AbstractOgBootController.php delete mode 100644 src/Controller/OgBoot/AbstractOgLiveController.php diff --git a/config/api_platform/OgLive.yaml b/config/api_platform/OgLive.yaml index d69ddad..e24c61b 100644 --- a/config/api_platform/OgLive.yaml +++ b/config/api_platform/OgLive.yaml @@ -90,7 +90,6 @@ resources: class: ApiPlatform\Metadata\Post method: POST input: false - output: false uriTemplate: /og-lives/server/{uuid}/uninstall controller: App\Controller\OgBoot\OgLive\UninstallAction diff --git a/src/Controller/OgBoot/AbstractOgBootController.php b/src/Controller/OgBoot/AbstractOgBootController.php new file mode 100644 index 0000000..7e96b1c --- /dev/null +++ b/src/Controller/OgBoot/AbstractOgBootController.php @@ -0,0 +1,56 @@ + [ + 'accept' => 'application/json', + 'Content-Type' => 'application/json' + ], + ]); + + try { + $response = $httpClient->request($method, $url, $params); + + return json_decode($response->getContent(), true); + } catch (ClientExceptionInterface | ServerExceptionInterface $e) { + $response = $e->getResponse(); + $content = json_decode($response->getContent(false), true); + throw new HttpException($response->getStatusCode(), $content['error'] ?? 'An error occurred'); + } catch (TransportExceptionInterface $e) { + throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, $e->getMessage()); + } + } +} diff --git a/src/Controller/OgBoot/AbstractOgLiveController.php b/src/Controller/OgBoot/AbstractOgLiveController.php deleted file mode 100644 index 89cbb0c..0000000 --- a/src/Controller/OgBoot/AbstractOgLiveController.php +++ /dev/null @@ -1,20 +0,0 @@ -request('GET', $this->ogBootApiUrl.'/ogboot/v1/oglives/'.$data->getChecksum(), [ - 'headers' => [ - 'accept' => 'application/json', - ], - ]); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + if (!$data->getChecksum()) { + throw new ValidatorException('Checksum is required'); } - $data = json_decode($response->getContent(), true); + $content = $this->createRequest($httpClient, 'GET', $this->ogBootApiUrl.'/ogboot/v1/oglives/'.$data->getChecksum()); - return new JsonResponse( data: $data, status: Response::HTTP_OK); + return new JsonResponse(data: $content, status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/GetCollectionAction.php b/src/Controller/OgBoot/OgLive/GetCollectionAction.php index 236a7fc..930b237 100644 --- a/src/Controller/OgBoot/OgLive/GetCollectionAction.php +++ b/src/Controller/OgBoot/OgLive/GetCollectionAction.php @@ -2,10 +2,11 @@ namespace App\Controller\OgBoot\OgLive; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; +use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; @@ -13,7 +14,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class GetCollectionAction extends AbstractOgLiveController +class GetCollectionAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -23,18 +24,8 @@ class GetCollectionAction extends AbstractOgLiveController */ public function __invoke(HttpClientInterface $httpClient): JsonResponse { - try { - $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/oglives', [ - 'headers' => [ - 'accept' => 'application/json', - ], - ]); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); - } + $content = $this->createRequest($httpClient, 'GET', $this->ogBootApiUrl.'/ogboot/v1/oglives'); - $data = json_decode($response->getContent(), true); - - return new JsonResponse( data: $data, status: Response::HTTP_OK); + return new JsonResponse(data: $content, status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/GetDefaultAction.php b/src/Controller/OgBoot/OgLive/GetDefaultAction.php index 9d0ff93..94f3456 100644 --- a/src/Controller/OgBoot/OgLive/GetDefaultAction.php +++ b/src/Controller/OgBoot/OgLive/GetDefaultAction.php @@ -2,7 +2,7 @@ namespace App\Controller\OgBoot\OgLive; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; @@ -13,7 +13,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class GetDefaultAction extends AbstractOgLiveController +class GetDefaultAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -23,18 +23,8 @@ class GetDefaultAction extends AbstractOgLiveController */ public function __invoke(HttpClientInterface $httpClient): JsonResponse { - try { - $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/oglives/default', [ - 'headers' => [ - 'accept' => 'application/json', - ], - ]); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); - } + $content = $this->createRequest($httpClient, 'GET', $this->ogBootApiUrl.'/ogboot/v1/oglives/default'); - $data = json_decode($response->getContent(), true); - - return new JsonResponse( data: $data, status: Response::HTTP_OK); + return new JsonResponse(status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/GetIsosAction.php b/src/Controller/OgBoot/OgLive/GetIsosAction.php index 2ad93b4..90ddb19 100644 --- a/src/Controller/OgBoot/OgLive/GetIsosAction.php +++ b/src/Controller/OgBoot/OgLive/GetIsosAction.php @@ -2,7 +2,7 @@ namespace App\Controller\OgBoot\OgLive; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\OgLive; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; @@ -14,7 +14,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class GetIsosAction extends AbstractOgLiveController +class GetIsosAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -24,20 +24,8 @@ class GetIsosAction extends AbstractOgLiveController */ public function __invoke(HttpClientInterface $httpClient): JsonResponse { - $ogLivesInserted = 0; + $content = $this->createRequest($httpClient, 'GET', $this->ogBootApiUrl.'/ogboot/v1/oglives/isos'); - try { - $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/oglives/isos', [ - 'headers' => [ - 'accept' => 'application/json', - ], - ]); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); - } - - $data = json_decode($response->getContent(), true); - - return new JsonResponse( data: [ 'data' => $data, 'ogLivesInserted' => $ogLivesInserted], status: Response::HTTP_OK); + return new JsonResponse(data: $content, status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/InstallAction.php b/src/Controller/OgBoot/OgLive/InstallAction.php index 7868240..e9b871c 100644 --- a/src/Controller/OgBoot/OgLive/InstallAction.php +++ b/src/Controller/OgBoot/OgLive/InstallAction.php @@ -2,12 +2,13 @@ namespace App\Controller\OgBoot\OgLive; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\OgLive; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; +use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; @@ -15,7 +16,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class InstallAction extends AbstractOgLiveController +class InstallAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -25,28 +26,22 @@ class InstallAction extends AbstractOgLiveController */ public function __invoke(OgLive $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { - try { - $response = $httpClient->request('POST', $this->ogBootApiUrl.'/ogboot/v1/oglives/install', [ - 'headers' => [ - 'accept' => 'application/json', - 'Content-Type' => 'application/json', - ], - 'json' => [ - 'url' => $data->getDownloadUrl() - ] - ]); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: $e->getMessage(), status: Response::HTTP_INTERNAL_SERVER_ERROR); + if (!$data->getDownloadUrl()) { + throw new ValidatorException('Download URL is required'); } - if ($response->getStatusCode() === Response::HTTP_OK) { - $data->setInstalled(true); - $entityManager->persist($data); - $entityManager->flush(); - } + $params = [ + 'json' => [ + 'url' => $data->getDownloadUrl() + ] + ]; - $data = json_decode($response->getContent(), true); + $content = $this->createRequest($httpClient, 'POST', $this->ogBootApiUrl.'/ogboot/v1/oglives/install', $params); - return new JsonResponse( data: $data, status: Response::HTTP_OK); + $data->setInstalled(true); + $entityManager->persist($data); + $entityManager->flush(); + + return new JsonResponse(data: $content, status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/SetDefaultAction.php b/src/Controller/OgBoot/OgLive/SetDefaultAction.php index 3864e67..b0d9698 100644 --- a/src/Controller/OgBoot/OgLive/SetDefaultAction.php +++ b/src/Controller/OgBoot/OgLive/SetDefaultAction.php @@ -2,12 +2,13 @@ namespace App\Controller\OgBoot\OgLive; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\OgLive; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; +use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; @@ -15,7 +16,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class SetDefaultAction extends AbstractOgLiveController +class SetDefaultAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -25,27 +26,22 @@ class SetDefaultAction extends AbstractOgLiveController */ public function __invoke(OgLive $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { - try { - $response = $httpClient->request('PUT', $this->ogBootApiUrl.'/ogboot/v1/oglives/default', [ - 'headers' => [ - 'accept' => 'application/json', - ], - 'json' => [ - 'checksum' => $data->getChecksum() - ] - ]); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); + if (!$data->getChecksum()) { + throw new ValidatorException('Checksum URL is required'); } - if ($response->getStatusCode() === Response::HTTP_OK) { - $data->setIsDefault(true); - $entityManager->persist($data); - $entityManager->flush(); - } + $params = [ + 'json' => [ + 'checksum' => $data->getChecksum() + ] + ]; - $data = json_decode($response->getContent(), true); + $content = $this->createRequest($httpClient, 'PUT', $this->ogBootApiUrl.'/ogboot/v1/oglives/default', $params); - return new JsonResponse( data: $data, status: Response::HTTP_OK); + $data->setIsDefault(true); + $entityManager->persist($data); + $entityManager->flush(); + + return new JsonResponse(status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/SyncAction.php b/src/Controller/OgBoot/OgLive/SyncAction.php index 6171cc8..dfabadb 100644 --- a/src/Controller/OgBoot/OgLive/SyncAction.php +++ b/src/Controller/OgBoot/OgLive/SyncAction.php @@ -2,12 +2,13 @@ namespace App\Controller\OgBoot\OgLive; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\OgLive; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; +use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; @@ -15,7 +16,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class SyncAction extends AbstractOgLiveController +class SyncAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -25,46 +26,37 @@ class SyncAction extends AbstractOgLiveController */ public function __invoke(HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { - try { - $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/oglives', [ - 'headers' => [ - 'accept' => 'application/json', - ], - ]); + $content = $this->createRequest($httpClient, 'GET', $this->ogBootApiUrl . '/ogboot/v1/oglives'); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); - } - - $data = json_decode($response->getContent(), true); - - foreach ($data['installed_ogLives'] as $ogLive) { + foreach ($content['installed_ogLives'] as $ogLive) { $ogLiveEntity = $this->entityManager->getRepository(OgLive::class)->findOneBy(['checksum' => $ogLive['id']]); if ($ogLiveEntity) { - $ogLiveEntity->setName($ogLive['filename']); - $ogLiveEntity->setInstalled(true); - $ogLiveEntity->setArchitecture($ogLive['architecture']); - $ogLiveEntity->setKernel($ogLive['kernel']); - $ogLiveEntity->setRevision($ogLive['revision']); - $ogLiveEntity->setDirectory($ogLive['directory']); - $ogLiveEntity->setChecksum($ogLive['id']); + $this->extracted($ogLiveEntity, $ogLive); $this->entityManager->persist($ogLiveEntity); } else { $ogLiveEntity = new OgLive(); - $ogLiveEntity->setName($ogLive['filename']); - $ogLiveEntity->setInstalled(true); - $ogLiveEntity->setArchitecture($ogLive['architecture']); - $ogLiveEntity->setKernel($ogLive['kernel']); - $ogLiveEntity->setRevision($ogLive['revision']); - $ogLiveEntity->setDirectory($ogLive['directory']); - $ogLiveEntity->setChecksum($ogLive['id']); + $this->extracted($ogLiveEntity, $ogLive); } $this->entityManager->persist($ogLiveEntity); - } - $this->entityManager->flush(); - return new JsonResponse( data: $data, status: Response::HTTP_OK); + return new JsonResponse(data: $content, status: Response::HTTP_OK); + } + + /** + * @param OgLive|null $ogLiveEntity + * @param mixed $ogLive + * @return void + */ + public function extracted(OgLive|null $ogLiveEntity, mixed $ogLive): void + { + $ogLiveEntity->setName($ogLive['filename']); + $ogLiveEntity->setInstalled(true); + $ogLiveEntity->setArchitecture($ogLive['architecture']); + $ogLiveEntity->setKernel($ogLive['kernel']); + $ogLiveEntity->setRevision($ogLive['revision']); + $ogLiveEntity->setDirectory($ogLive['directory']); + $ogLiveEntity->setChecksum($ogLive['id']); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/OgLive/UninstallAction.php b/src/Controller/OgBoot/OgLive/UninstallAction.php index ac9f047..d0ea542 100644 --- a/src/Controller/OgBoot/OgLive/UninstallAction.php +++ b/src/Controller/OgBoot/OgLive/UninstallAction.php @@ -2,12 +2,14 @@ namespace App\Controller\OgBoot\OgLive; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\OgLive; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; +use Symfony\Component\HttpKernel\Exception\HttpException; +use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; @@ -15,7 +17,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class UninstallAction extends AbstractOgLiveController +class UninstallAction extends AbstractOgBootController { /** * @throws ServerExceptionInterface @@ -25,22 +27,14 @@ class UninstallAction extends AbstractOgLiveController */ public function __invoke(OgLive $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { - try { - $response = $httpClient->request('DELETE', $this->ogBootApiUrl.'/ogboot/v1/oglives/'.$data->getChecksum(), [ - 'headers' => [ - 'accept' => 'application/json', - ], - ]); - - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: $e->getMessage(), status: Response::HTTP_INTERNAL_SERVER_ERROR); + if (!$data->getChecksum()) { + throw new ValidatorException('Checksum is required'); } - if ($response->getStatusCode() === Response::HTTP_OK) { - $data->setInstalled(false); - $entityManager->persist($data); - $entityManager->flush(); - } + $content = $this->createRequest($httpClient, 'DELETE', $this->ogBootApiUrl.'/ogboot/v1/oglives/'.$data->getChecksum()); + + $entityManager->remove($data); + $entityManager->flush(); return new JsonResponse(status: Response::HTTP_OK); } diff --git a/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php b/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php index f758745..f870364 100644 --- a/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php +++ b/src/Controller/OgBoot/PxeBootFile/GetCollectionAction.php @@ -2,7 +2,7 @@ namespace App\Controller\OgBoot\PxeBootFile; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\PxeBootFile; use App\Entity\PxeTemplate; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -16,7 +16,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class GetCollectionAction extends AbstractOgLiveController +class GetCollectionAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -26,18 +26,8 @@ class GetCollectionAction extends AbstractOgLiveController */ public function __invoke(HttpClientInterface $httpClient): JsonResponse { - try { - $response = $httpClient->request('GET', $this->ogBootApiUrl.'/ogboot/v1/pxes', [ - 'headers' => [ - 'accept' => 'application/json', - ], - ]); - } catch (TransportExceptionInterface $e) { - return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); - } + $content = $this->createRequest($httpClient, 'GET', $this->ogBootApiUrl.'/ogboot/v1/pxes'); - $data = json_decode($response->getContent(), true); - - return new JsonResponse( data: $data, status: Response::HTTP_OK); + return new JsonResponse(data: $content, status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/PxeTemplate/DeleteAction.php b/src/Controller/OgBoot/PxeTemplate/DeleteAction.php index 4971708..ba6c49d 100644 --- a/src/Controller/OgBoot/PxeTemplate/DeleteAction.php +++ b/src/Controller/OgBoot/PxeTemplate/DeleteAction.php @@ -2,8 +2,9 @@ namespace App\Controller\OgBoot\PxeTemplate; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\PxeTemplate; +use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; @@ -15,7 +16,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class DeleteAction extends AbstractOgLiveController +class DeleteAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface @@ -23,7 +24,7 @@ class DeleteAction extends AbstractOgLiveController * @throws RedirectionExceptionInterface * @throws ClientExceptionInterface */ - public function __invoke(PxeTemplate $data, HttpClientInterface $httpClient): JsonResponse + public function __invoke(PxeTemplate $data, HttpClientInterface $httpClient, EntityManagerInterface $entityManager): JsonResponse { try { $response = $httpClient->request('DELETE', $this->ogBootApiUrl.'/ogboot/v1/pxe-templates/'.$data->getName(), [ @@ -35,8 +36,11 @@ class DeleteAction extends AbstractOgLiveController return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR); } - $data = json_decode($response->getContent(), true); + if ($response->getStatusCode() === Response::HTTP_OK) { + $entityManager->remove($data); + $entityManager->flush(); + } - return new JsonResponse( data: $data, status: Response::HTTP_OK); + return new JsonResponse(status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Controller/OgBoot/PxeTemplate/GetAction.php b/src/Controller/OgBoot/PxeTemplate/GetAction.php index 19e91a3..5648a55 100644 --- a/src/Controller/OgBoot/PxeTemplate/GetAction.php +++ b/src/Controller/OgBoot/PxeTemplate/GetAction.php @@ -2,7 +2,7 @@ namespace App\Controller\OgBoot\PxeTemplate; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\PxeTemplate; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; @@ -15,7 +15,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class GetAction extends AbstractOgLiveController +class GetAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface diff --git a/src/Controller/OgBoot/PxeTemplate/GetCollectionAction.php b/src/Controller/OgBoot/PxeTemplate/GetCollectionAction.php index 6693311..c294cae 100644 --- a/src/Controller/OgBoot/PxeTemplate/GetCollectionAction.php +++ b/src/Controller/OgBoot/PxeTemplate/GetCollectionAction.php @@ -2,7 +2,7 @@ namespace App\Controller\OgBoot\PxeTemplate; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; @@ -14,7 +14,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class GetCollectionAction extends AbstractOgLiveController +class GetCollectionAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface diff --git a/src/Controller/OgBoot/PxeTemplate/PostAction.php b/src/Controller/OgBoot/PxeTemplate/PostAction.php index d07a016..a448bf1 100644 --- a/src/Controller/OgBoot/PxeTemplate/PostAction.php +++ b/src/Controller/OgBoot/PxeTemplate/PostAction.php @@ -2,7 +2,7 @@ namespace App\Controller\OgBoot\PxeTemplate; -use App\Controller\OgBoot\AbstractOgLiveController; +use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\PxeTemplate; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -16,7 +16,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] -class PostAction extends AbstractOgLiveController +class PostAction extends AbstractOgBootController { /** * @throws TransportExceptionInterface From ccb317fb15aac111f990ed754a3db7961943c160 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 26 Aug 2024 11:40:21 +0200 Subject: [PATCH 10/17] refs #658. Params PXE boot files POST --- src/Service/OgBoot/PxeBootFile/PostService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Service/OgBoot/PxeBootFile/PostService.php b/src/Service/OgBoot/PxeBootFile/PostService.php index e836af2..17ebe2e 100644 --- a/src/Service/OgBoot/PxeBootFile/PostService.php +++ b/src/Service/OgBoot/PxeBootFile/PostService.php @@ -41,7 +41,7 @@ readonly class PostService 'ip' => $client->getIp(), 'server_ip' => '92.168.2.1', 'router' => $client->getOrganizationalUnit()->getNetworkSettings()->getRouter(), - 'netmask' => $client->getOrganizationalUnit()->getNetworkSettings()->getNetmask(), + 'netmask' => $client->getOrganizationalUnit()->getNetworkSettings() ? $client->getOrganizationalUnit()->getNetworkSettings()->getNetmask() : '255.255.255.0', 'computer_name' => $client->getName(), 'netiface' => $client->getNetiface(), 'group' => $client->getOrganizationalUnit()->getName(), @@ -51,12 +51,12 @@ readonly class PostService 'ogshare' => '192.168.2.1', 'oglivedir' => 'ogLive', 'ogprof' => 'false', - 'hardprofile' => '', - 'ogntp' => $client->getOrganizationalUnit()->getNetworkSettings()->getNtp(), - 'ogdns' => $client->getOrganizationalUnit()->getNetworkSettings()->getDns(), - 'ogProxy' => $client->getOrganizationalUnit()->getNetworkSettings()->getProxy(), + 'hardprofile' => $client->getHardwareProfile() ? $client->getHardwareProfile()->getDescription() : 'default', + 'ogntp' => $client->getOrganizationalUnit()->getNetworkSettings()?->getNtp(), + 'ogdns' => $client->getOrganizationalUnit()->getNetworkSettings()?->getDns(), + 'ogProxy' => $client->getOrganizationalUnit()->getNetworkSettings()?->getProxy(), 'ogunit' => '', - 'resolution' => '768' + 'resolution' => '788' ]; try { From d70d2cf3f00644b7bb8a4bdce136d2c9e2dc2994 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 2 Sep 2024 10:09:36 +0200 Subject: [PATCH 11/17] Some improvements. Added filter search and refactor --- config/services/api_platform.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/config/services/api_platform.yaml b/config/services/api_platform.yaml index d8f0fa4..ee1a157 100644 --- a/config/services/api_platform.yaml +++ b/config/services/api_platform.yaml @@ -18,6 +18,18 @@ services: $orderParameterName: 'order' tags: [ 'api_platform.filter' ] + api_platform.filter.og_live.order: + parent: 'api_platform.doctrine.orm.order_filter' + arguments: + $properties: { 'id': ~, 'name': ~ } + $orderParameterName: 'order' + tags: [ 'api_platform.filter' ] + + api_platform.filter.og_live.search: + parent: 'api_platform.doctrine.orm.search_filter' + arguments: [ { 'id': 'exact', 'name': 'partial', } ] + tags: [ 'api_platform.filter' ] + api_platform.filter.hardware.search: parent: 'api_platform.doctrine.orm.search_filter' arguments: [ { 'id': 'exact', 'name': 'partial' } ] @@ -59,6 +71,18 @@ services: arguments: [ { 'id': 'exact', 'usage': 'exact', 'diskNumber': 'exact' } ] tags: [ 'api_platform.filter' ] + api_platform.filter.pxe_template.order: + parent: 'api_platform.doctrine.orm.order_filter' + arguments: + $properties: { 'id': ~, 'name': ~ } + $orderParameterName: 'order' + 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.user.order: parent: 'api_platform.doctrine.orm.order_filter' arguments: From 68b460935f9cf6e496cebc1365194d968001faee Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 2 Sep 2024 12:16:40 +0200 Subject: [PATCH 12/17] 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 From ebd3d7e539a6f00c2018a405bc8b80824fecdf15 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 4 Sep 2024 10:14:52 +0200 Subject: [PATCH 13/17] refs #658. OgBoot Webhook --- config/packages/security.yaml | 1 + .../Webhook/InstallOgLiveResponseAction.php | 36 ++++++++++ src/OpenApi/OpenApiFactory.php | 67 ++++++++++++++++++- 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 5e2315b..3bf853d 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -29,6 +29,7 @@ security: - { path: ^/$, roles: PUBLIC_ACCESS } # Allows accessing the Swagger UI - { path: ^/docs, roles: PUBLIC_ACCESS } # Allows accessing the Swagger UI docs - { path: ^/auth/login, roles: PUBLIC_ACCESS } + - { path: ^/og-lives/install/webhook, roles: PUBLIC_ACCESS } - { path: ^/auth/refresh, roles: PUBLIC_ACCESS } - { path: ^/, roles: IS_AUTHENTICATED_FULLY } diff --git a/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php new file mode 100644 index 0000000..caf97e6 --- /dev/null +++ b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php @@ -0,0 +1,36 @@ +getContent(), true); + + return new JsonResponse(data: ['hola caracola'], status: Response::HTTP_OK); + } +} \ No newline at end of file diff --git a/src/OpenApi/OpenApiFactory.php b/src/OpenApi/OpenApiFactory.php index dc755c8..7b8a744 100644 --- a/src/OpenApi/OpenApiFactory.php +++ b/src/OpenApi/OpenApiFactory.php @@ -20,7 +20,8 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface $this->addRefreshToken($openApi); $this->addSearchEndpoint($openApi); - $this->addStatusEndpoint($openApi); // Agregar el nuevo endpoint + $this->addStatusEndpoint($openApi); + $this->addInstallOgLiveWebhookEndpoint($openApi); // Añadir aquí return $openApi; } @@ -175,4 +176,68 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface ->withSummary('Get service status') )); } + + private function addInstallOgLiveWebhookEndpoint(OpenApi $openApi): void + { + $openApi + ->getPaths() + ->addPath('/og-lives/install/webhook', (new Model\PathItem())->withPost( + (new Model\Operation('postInstallOgLiveWebhook')) + ->withTags(['OgLive']) + ->withResponses([ + Response::HTTP_OK => [ + 'description' => 'Webhook installation successful', + 'content' => [ + 'application/json' => [ + 'schema' => [ + 'type' => 'object', + 'properties' => [ + 'message' => [ + 'type' => 'string', + 'example' => 'Webhook installed successfully', + ], + ], + ], + ], + ], + ], + Response::HTTP_BAD_REQUEST => [ + 'description' => 'Invalid request data', + 'content' => [ + 'application/json' => [ + 'schema' => [ + 'type' => 'object', + 'properties' => [ + 'error' => [ + 'type' => 'string', + 'example' => 'Invalid input data', + ], + ], + ], + ], + ], + ], + ]) + ->withSummary('Install a webhook for OgLive') + ->withRequestBody( + (new Model\RequestBody()) + ->withDescription('Data required for installing the webhook') + ->withContent(new \ArrayObject([ + 'application/json' => new Model\MediaType(new \ArrayObject([ + 'type' => 'object', + 'properties' => [ + 'da' => [ + 'type' => 'string', + 'description' => 'The URL to set for the webhook', + 'example' => 'https://example.com/webhook', + ], + ], + 'required' => ['url'], + ])) + ])) + ->withRequired(true) + ) + )); + } + } \ No newline at end of file From 1b4181488373cd91e336669a2da4d014126f1930 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Thu, 5 Sep 2024 10:17:10 +0200 Subject: [PATCH 14/17] refs #658. Added install fully integration --- config/services/api_platform.yaml | 2 +- migrations/Version20240905080435.php | 32 +++++++++++++++++ .../OgBoot/OgLive/InstallAction.php | 6 ++-- .../Webhook/InstallOgLiveResponseAction.php | 31 +++++++++++++++- src/Dto/Input/OgLiveInput.php | 2 ++ src/Dto/Output/OgLiveOutput.php | 4 +++ src/Entity/OgLive.php | 15 ++++++++ src/Model/OgLiveStatus.php | 36 +++++++++++++++++++ 8 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 migrations/Version20240905080435.php create mode 100644 src/Model/OgLiveStatus.php diff --git a/config/services/api_platform.yaml b/config/services/api_platform.yaml index fb2af43..00d855e 100644 --- a/config/services/api_platform.yaml +++ b/config/services/api_platform.yaml @@ -8,7 +8,7 @@ services: api_platform.filter.client.search: parent: 'api_platform.doctrine.orm.search_filter' - arguments: [ { 'id': 'exact', 'name': 'partial', 'serialNumber': 'exact', organizationalUnit.id: 'exact' } ] + arguments: [ { 'id': 'exact', 'name': 'partial', 'serialNumber': 'exact', organizationalUnit.id: 'exact', 'ip': exact, 'mac': exact } ] tags: [ 'api_platform.filter' ] api_platform.filter.hardware.order: diff --git a/migrations/Version20240905080435.php b/migrations/Version20240905080435.php new file mode 100644 index 0000000..82c72f8 --- /dev/null +++ b/migrations/Version20240905080435.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE og_live ADD status VARCHAR(255) NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE og_live DROP status'); + + } +} diff --git a/src/Controller/OgBoot/OgLive/InstallAction.php b/src/Controller/OgBoot/OgLive/InstallAction.php index e9b871c..2572499 100644 --- a/src/Controller/OgBoot/OgLive/InstallAction.php +++ b/src/Controller/OgBoot/OgLive/InstallAction.php @@ -4,6 +4,7 @@ namespace App\Controller\OgBoot\OgLive; use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\OgLive; +use App\Model\OgLiveStatus; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; @@ -32,13 +33,14 @@ class InstallAction extends AbstractOgBootController $params = [ 'json' => [ - 'url' => $data->getDownloadUrl() + 'url' => $data->getDownloadUrl(), + 'ogCoreId' => $data->getUuid() ] ]; $content = $this->createRequest($httpClient, 'POST', $this->ogBootApiUrl.'/ogboot/v1/oglives/install', $params); - $data->setInstalled(true); + $data->setStatus(OgLiveStatus::PENDING); $entityManager->persist($data); $entityManager->flush(); diff --git a/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php index caf97e6..61f185f 100644 --- a/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php +++ b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php @@ -3,6 +3,8 @@ namespace App\Controller\OgBoot\OgLive\Webhook; use App\Controller\OgBoot\AbstractOgBootController; +use App\Entity\OgLive; +use App\Model\OgLiveStatus; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; @@ -31,6 +33,33 @@ class InstallOgLiveResponseAction extends AbstractController { $data = json_decode($request->getContent(), true); - return new JsonResponse(data: ['hola caracola'], status: Response::HTTP_OK); + if ($data === null || !isset($data['message'], $data['ogCoreId'], $data['details']['result'])) { + return new JsonResponse(['error' => 'Invalid or incomplete JSON data'], Response::HTTP_BAD_REQUEST); + } + + $message = $data['message']; + $ogCoreId = $data['ogCoreId']; + $details = $data['details']; + $result = $details['result']; + + $ogLive = $this->entityManager->getRepository(OgLive::class)->findOneBy(['uuid' => $ogCoreId]); + + if (!$ogLive) { + return new JsonResponse(['error' => 'OgLive not found'], Response::HTTP_NOT_FOUND); + } + + $ogLive->setStatus($details['status'] === 'success' ? OgLiveStatus::ACTIVE : OgLiveStatus::FAILED); + $ogLive->setInstalled($details['status'] === 'success'); + $ogLive->setChecksum($result['id']); + $ogLive->setDistribution($result['distribution']); + $ogLive->setKernel($result['kernel']); + $ogLive->setArchitecture($result['architecture']); + $ogLive->setRevision($result['revision']); + $ogLive->setDirectory($result['directory']); + + $this->entityManager->persist($ogLive); + $this->entityManager->flush(); + + return new JsonResponse(data: 'Oglive updated successfully', status: Response::HTTP_OK); } } \ No newline at end of file diff --git a/src/Dto/Input/OgLiveInput.php b/src/Dto/Input/OgLiveInput.php index d9e86df..2c86228 100644 --- a/src/Dto/Input/OgLiveInput.php +++ b/src/Dto/Input/OgLiveInput.php @@ -4,6 +4,7 @@ namespace App\Dto\Input; use ApiPlatform\Metadata\ApiProperty; use App\Entity\OgLive; +use App\Model\OgLiveStatus; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -36,6 +37,7 @@ final class OgLiveInput $ogLive->setName($this->name); $ogLive->setDownloadUrl($this->downloadUrl); + $ogLive->setStatus(OgLiveStatus::INACTIVE); return $ogLive; } diff --git a/src/Dto/Output/OgLiveOutput.php b/src/Dto/Output/OgLiveOutput.php index bc9fc32..60b0d3d 100644 --- a/src/Dto/Output/OgLiveOutput.php +++ b/src/Dto/Output/OgLiveOutput.php @@ -25,6 +25,9 @@ final class OgLiveOutput extends AbstractOutput #[Groups(['og-live:read'])] public ?string $downloadUrl = ''; + #[Groups(['og-live:read'])] + public ?string $status = ''; + #[Groups(['og-live:read'])] public \DateTime $createdAt; @@ -40,6 +43,7 @@ final class OgLiveOutput extends AbstractOutput $this->installed = $ogLive->isInstalled(); $this->isDefault = $ogLive->getIsDefault(); $this->downloadUrl = $ogLive->getDownloadUrl(); + $this->status = $ogLive->getStatus(); $this->createdAt = $ogLive->getCreatedAt(); $this->createdBy = $ogLive->getCreatedBy(); } diff --git a/src/Entity/OgLive.php b/src/Entity/OgLive.php index 2983c79..df0f872 100644 --- a/src/Entity/OgLive.php +++ b/src/Entity/OgLive.php @@ -52,6 +52,9 @@ class OgLive extends AbstractEntity #[ORM\OneToMany(mappedBy: 'ogLive', targetEntity: Client::class)] private Collection $clients; + #[ORM\Column(length: 255)] + private ?string $status = null; + public function __construct() { parent::__construct(); @@ -205,4 +208,16 @@ class OgLive extends AbstractEntity return $this; } + + public function getStatus(): ?string + { + return $this->status; + } + + public function setStatus(string $status): static + { + $this->status = $status; + + return $this; + } } diff --git a/src/Model/OgLiveStatus.php b/src/Model/OgLiveStatus.php new file mode 100644 index 0000000..2b9e744 --- /dev/null +++ b/src/Model/OgLiveStatus.php @@ -0,0 +1,36 @@ + 'Pendiente', + self::ACTIVE => 'Activo', + self::INACTIVE => 'Inactivo', + self::DELETED => 'Eliminado', + self::FAILED => 'Fallido', + ]; + + public static function getOgLiveStatuses(): array + { + return self::OG_LIVE_STATUSES; + } + + public static function getOgLiveStatus(string $ogLiveStatus): ?string + { + return self::OG_LIVE_STATUSES[$ogLiveStatus] ?? null; + } + + public static function getOgLiveStatusKeys(): array + { + return array_keys(self::OG_LIVE_STATUSES); + } +} \ No newline at end of file From aa1da83a701e2fb0208eac1944a406621ec90f74 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Thu, 5 Sep 2024 18:00:44 +0200 Subject: [PATCH 15/17] refs #658. Added install fully integration --- .../OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php index 61f185f..336e957 100644 --- a/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php +++ b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php @@ -48,6 +48,10 @@ class InstallOgLiveResponseAction extends AbstractController return new JsonResponse(['error' => 'OgLive not found'], Response::HTTP_NOT_FOUND); } + if ($ogLive->getStatus() === OgLiveStatus::ACTIVE) { + return new JsonResponse(['error' => 'OgLive is already active'], Response::HTTP_BAD_REQUEST); + } + $ogLive->setStatus($details['status'] === 'success' ? OgLiveStatus::ACTIVE : OgLiveStatus::FAILED); $ogLive->setInstalled($details['status'] === 'success'); $ogLive->setChecksum($result['id']); @@ -60,6 +64,6 @@ class InstallOgLiveResponseAction extends AbstractController $this->entityManager->persist($ogLive); $this->entityManager->flush(); - return new JsonResponse(data: 'Oglive updated successfully', status: Response::HTTP_OK); + return new JsonResponse(data: sprintf('OgLive %s updated successfully', $ogLive->getChecksum()), status: Response::HTTP_OK); } } \ No newline at end of file From 8bfc47114464635b2f5d367785445630ff31ce11 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 11 Sep 2024 11:43:12 +0200 Subject: [PATCH 16/17] refs #658. Updated endpoints with failure and success logic --- .../OgBoot/OgLive/InstallAction.php | 2 +- .../Webhook/InstallOgLiveResponseAction.php | 42 +++++++++++++------ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/Controller/OgBoot/OgLive/InstallAction.php b/src/Controller/OgBoot/OgLive/InstallAction.php index 2572499..e2bbe17 100644 --- a/src/Controller/OgBoot/OgLive/InstallAction.php +++ b/src/Controller/OgBoot/OgLive/InstallAction.php @@ -34,7 +34,7 @@ class InstallAction extends AbstractOgBootController $params = [ 'json' => [ 'url' => $data->getDownloadUrl(), - 'ogCoreId' => $data->getUuid() + 'id' => $data->getUuid() ] ]; diff --git a/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php index 336e957..f5e7cbc 100644 --- a/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php +++ b/src/Controller/OgBoot/OgLive/Webhook/InstallOgLiveResponseAction.php @@ -22,6 +22,11 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; #[AsController] class InstallOgLiveResponseAction extends AbstractController { + public CONST string OG_LIVE_INSTALL_SUCCESS = 'success'; + public CONST string OG_LIVE_INSTALL_FAILED = 'failure'; + + + public function __construct( protected readonly EntityManagerInterface $entityManager ) @@ -33,14 +38,15 @@ class InstallOgLiveResponseAction extends AbstractController { $data = json_decode($request->getContent(), true); - if ($data === null || !isset($data['message'], $data['ogCoreId'], $data['details']['result'])) { + if ($data === null || !isset($data['message'], $data['ogCoreId'], $data['details'])) { return new JsonResponse(['error' => 'Invalid or incomplete JSON data'], Response::HTTP_BAD_REQUEST); } $message = $data['message']; $ogCoreId = $data['ogCoreId']; $details = $data['details']; - $result = $details['result']; + $status = $data['status']; + $result = $status === self::OG_LIVE_INSTALL_SUCCESS ? $details['result'] : []; $ogLive = $this->entityManager->getRepository(OgLive::class)->findOneBy(['uuid' => $ogCoreId]); @@ -52,18 +58,28 @@ class InstallOgLiveResponseAction extends AbstractController return new JsonResponse(['error' => 'OgLive is already active'], Response::HTTP_BAD_REQUEST); } - $ogLive->setStatus($details['status'] === 'success' ? OgLiveStatus::ACTIVE : OgLiveStatus::FAILED); - $ogLive->setInstalled($details['status'] === 'success'); - $ogLive->setChecksum($result['id']); - $ogLive->setDistribution($result['distribution']); - $ogLive->setKernel($result['kernel']); - $ogLive->setArchitecture($result['architecture']); - $ogLive->setRevision($result['revision']); - $ogLive->setDirectory($result['directory']); - - $this->entityManager->persist($ogLive); - $this->entityManager->flush(); + $this->updateOgLive($ogLive, $details, $result, $status); return new JsonResponse(data: sprintf('OgLive %s updated successfully', $ogLive->getChecksum()), status: Response::HTTP_OK); } + + private function updateOgLive (OgLive $ogLive, array $details, array $result, string $status): void + { + if ($status === self::OG_LIVE_INSTALL_SUCCESS) { + $ogLive->setInstalled(true); + $ogLive->setSynchronized(true); + $ogLive->setChecksum($result['id']); + $ogLive->setDistribution($result['distribution']); + $ogLive->setKernel($result['kernel']); + $ogLive->setArchitecture($result['architecture']); + $ogLive->setRevision($result['revision']); + $ogLive->setDirectory($result['directory']); + } + + $ogLive->setStatus($status === self::OG_LIVE_INSTALL_SUCCESS ? OgLiveStatus::ACTIVE : OgLiveStatus::FAILED); + $ogLive->setInstalled($status === self::OG_LIVE_INSTALL_SUCCESS); + + $this->entityManager->persist($ogLive); + $this->entityManager->flush(); + } } \ No newline at end of file From efdf60778a92a2548aac9e52538f4cbf60e588b5 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Fri, 13 Sep 2024 09:52:13 +0200 Subject: [PATCH 17/17] refs #658. Updated sync endpoint ogBoot --- src/Controller/OgBoot/OgLive/SyncAction.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Controller/OgBoot/OgLive/SyncAction.php b/src/Controller/OgBoot/OgLive/SyncAction.php index dfabadb..4083309 100644 --- a/src/Controller/OgBoot/OgLive/SyncAction.php +++ b/src/Controller/OgBoot/OgLive/SyncAction.php @@ -4,6 +4,7 @@ namespace App\Controller\OgBoot\OgLive; use App\Controller\OgBoot\AbstractOgBootController; use App\Entity\OgLive; +use App\Model\OgLiveStatus; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; @@ -40,6 +41,7 @@ class SyncAction extends AbstractOgBootController $this->entityManager->persist($ogLiveEntity); } $this->entityManager->flush(); + $this->serDefaultOgLive($content['default_oglive']); return new JsonResponse(data: $content, status: Response::HTTP_OK); } @@ -49,14 +51,30 @@ class SyncAction extends AbstractOgBootController * @param mixed $ogLive * @return void */ - public function extracted(OgLive|null $ogLiveEntity, mixed $ogLive): void + private function extracted(OgLive|null $ogLiveEntity, mixed $ogLive): void { $ogLiveEntity->setName($ogLive['filename']); $ogLiveEntity->setInstalled(true); $ogLiveEntity->setArchitecture($ogLive['architecture']); + $ogLiveEntity->setDistribution($ogLive['distribution']); + $ogLiveEntity->setFilename($ogLive['filename']); $ogLiveEntity->setKernel($ogLive['kernel']); $ogLiveEntity->setRevision($ogLive['revision']); $ogLiveEntity->setDirectory($ogLive['directory']); $ogLiveEntity->setChecksum($ogLive['id']); + $ogLiveEntity->setStatus(OgLiveStatus::ACTIVE); + } + + private function serDefaultOgLive(string $defaultOgLive): void + { + $ogLiveEntity = $this->entityManager->getRepository(OgLive::class)->findOneBy(['name' => $defaultOgLive]); + + if (!$ogLiveEntity) { + return; + } + + $ogLiveEntity->setIsDefault(true); + $this->entityManager->persist($ogLiveEntity); + $this->entityManager->flush(); } } \ No newline at end of file