From 28dfa38a330c24ec9a0d7d0589cf85309caf46da Mon Sep 17 00:00:00 2001 From: 3Mydlo3 Date: Thu, 9 Jan 2025 23:00:47 +0100 Subject: [PATCH 1/2] Change Arma 3 mentions to include Arma Reforger --- templates/shared/base.html.twig | 2 +- templates/shared/home/index/_partial/pl/_about_us.html.twig | 2 +- templates/shared/home/join_us/join_us.html.twig | 4 ++-- translations/messages.pl.yaml | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/shared/base.html.twig b/templates/shared/base.html.twig index e08b9985..ef1e3d11 100644 --- a/templates/shared/base.html.twig +++ b/templates/shared/base.html.twig @@ -1,4 +1,4 @@ -{%- set title = global.app.organization ~ ' - ' ~ title ?? 'Polish Arma 3 group'|trans -%} +{%- set title = global.app.organization ~ ' - ' ~ title ?? 'Polish Arma group'|trans -%} {%- set description = description ?? include([ 'shared/home/index/_partial/' ~ get_current_locale() ~ '/_about_us.html.twig', diff --git a/templates/shared/home/index/_partial/pl/_about_us.html.twig b/templates/shared/home/index/_partial/pl/_about_us.html.twig index 85b703b6..4d863b0c 100644 --- a/templates/shared/home/index/_partial/pl/_about_us.html.twig +++ b/templates/shared/home/index/_partial/pl/_about_us.html.twig @@ -1,5 +1,5 @@ ArmaForces to społeczność skupiająca zarówno cichych pasjonatów milsimu, śmieszków poza kontrolo, -jak i miłośników specyfiki Arma 3, których łączy chęć tworzenia zgranej grupy. +jak i miłośników specyfiki Arma, których łączy chęć tworzenia zgranej grupy.
Nasze misje zwykle są nastawione na dużo akcji, bez zbędnego gadania i recytowania regulaminu z pamięci. diff --git a/templates/shared/home/join_us/join_us.html.twig b/templates/shared/home/join_us/join_us.html.twig index 4a437b5e..b3096c68 100644 --- a/templates/shared/home/join_us/join_us.html.twig +++ b/templates/shared/home/join_us/join_us.html.twig @@ -1,4 +1,4 @@ -{% set title = 'Join polish Arma 3 clan'|trans %} +{% set title = 'Join polish Arma clan'|trans %} {% extends 'shared/container_fluid.html.twig' %} @@ -35,7 +35,7 @@
{{ 'What do we require to from recruits'|trans }}
diff --git a/translations/messages.pl.yaml b/translations/messages.pl.yaml index 8965042f..ca2ea4e9 100644 --- a/translations/messages.pl.yaml +++ b/translations/messages.pl.yaml @@ -1,6 +1,6 @@ # Title -Polish Arma 3 group: Polska grupa Arma 3 -Join polish Arma 3 clan: Dołącz do polskiego klanu Arma 3 +Polish Arma group: Polska grupa Arma +Join polish Arma clan: Dołącz do polskiego klanu Arma # Navbar Homepage: Strona główna @@ -40,7 +40,7 @@ Access denied: Odmowa dostępu # Join us Join ArmaForces: Dołącz do ArmaForces What do we require to from recruits: Czego wymagamy od rekrutów -Base Arma 3 game: Podstawowej wersji Arma 3 +Base Arma 3 or Arma Reforger game: Podstawowej wersji Arma 3 lub Arma Reforger At least 16 years old: Co najmniej 16 lat # Missions From 575fb0898858ea022f785958450c4d076375d177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Skowro=C5=84ski?= Date: Thu, 13 Feb 2025 17:34:35 +0100 Subject: [PATCH 2/2] Include external mod lists in API --- ...ndardModList.yaml => AbstractModList.yaml} | 2 +- .../ModList/GetModListByNameOperation.php | 6 +-- .../ModListDetailsOutputDataTransformer.php | 51 ++++++++++++++----- .../ModList/ModListOutputDataTransformer.php | 20 +++++--- .../Output/ModList/ModListDetailsOutput.php | 11 ++-- src/Mods/Api/Output/ModList/ModListOutput.php | 2 +- .../Mods/Api/ModList/ListModListsCest.php | 20 +++++++- 7 files changed, 79 insertions(+), 33 deletions(-) rename config/api_platform/mods/resources/{StandardModList.yaml => AbstractModList.yaml} (96%) diff --git a/config/api_platform/mods/resources/StandardModList.yaml b/config/api_platform/mods/resources/AbstractModList.yaml similarity index 96% rename from config/api_platform/mods/resources/StandardModList.yaml rename to config/api_platform/mods/resources/AbstractModList.yaml index 446a5d94..bc2fe2cb 100644 --- a/config/api_platform/mods/resources/StandardModList.yaml +++ b/config/api_platform/mods/resources/AbstractModList.yaml @@ -1,5 +1,5 @@ resources: - App\Mods\Entity\ModList\StandardModList: + App\Mods\Entity\ModList\AbstractModList: operations: ApiPlatform\Metadata\GetCollection: provider: 'App\Mods\Api\Provider\ModList\ModListDataProvider' diff --git a/src/Mods/Api/Controller/ModList/GetModListByNameOperation.php b/src/Mods/Api/Controller/ModList/GetModListByNameOperation.php index 550937e4..bc05c5eb 100644 --- a/src/Mods/Api/Controller/ModList/GetModListByNameOperation.php +++ b/src/Mods/Api/Controller/ModList/GetModListByNameOperation.php @@ -6,7 +6,7 @@ use App\Mods\Api\DataTransformer\ModList\ModListDetailsOutputDataTransformer; use App\Mods\Api\Output\ModList\ModListOutput; -use App\Mods\Repository\ModList\StandardModListRepository; +use App\Mods\Repository\ModList\ModListRepository; use Symfony\Component\HttpKernel\Attribute\AsController; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -14,14 +14,14 @@ class GetModListByNameOperation { public function __construct( - private StandardModListRepository $standardModListRepository, + private ModListRepository $modListRepository, private ModListDetailsOutputDataTransformer $modListDetailsOutputDataTransformer, ) { } public function __invoke(string $name): ?ModListOutput { - $standardModList = $this->standardModListRepository->findOneByName($name); + $standardModList = $this->modListRepository->findOneByName($name); if (!$standardModList) { throw new NotFoundHttpException('Not Found'); diff --git a/src/Mods/Api/DataTransformer/ModList/ModListDetailsOutputDataTransformer.php b/src/Mods/Api/DataTransformer/ModList/ModListDetailsOutputDataTransformer.php index 9207a12c..8c853d8d 100644 --- a/src/Mods/Api/DataTransformer/ModList/ModListDetailsOutputDataTransformer.php +++ b/src/Mods/Api/DataTransformer/ModList/ModListDetailsOutputDataTransformer.php @@ -10,6 +10,8 @@ use App\Mods\Api\Output\ModList\ModListOutput; use App\Mods\Entity\Dlc\Dlc; use App\Mods\Entity\Mod\AbstractMod; +use App\Mods\Entity\ModList\AbstractModList; +use App\Mods\Entity\ModList\ExternalModList; use App\Mods\Entity\ModList\StandardModList; use App\Mods\Repository\Mod\ModRepository; @@ -22,23 +24,44 @@ public function __construct( ) { } - public function transform(StandardModList $standardModList): ModListOutput + public function transform(AbstractModList $modList): ModListOutput { - return new ModListDetailsOutput( - $standardModList->getId()->toString(), - $standardModList->getName(), - $standardModList->isActive(), - $standardModList->isApproved(), - $standardModList->getCreatedAt(), - $standardModList->getLastUpdatedAt(), - array_map( + $isApproved = null; + if ($modList instanceof StandardModList) { + $isApproved = $modList->isApproved(); + } + + $mods = []; + if ($modList instanceof StandardModList) { + $mods = array_map( fn (AbstractMod $mod) => $this->modOutputDataTransformer->transform($mod), - $this->modRepository->findIncludedMods($standardModList) - ), - array_map( + $this->modRepository->findIncludedMods($modList) + ); + } + + $dlcs = []; + if ($modList instanceof StandardModList) { + $dlcs = array_map( fn (Dlc $dlc) => $this->dlcOutputDataTransformer->transform($dlc), - $standardModList->getDlcs() - ), + $modList->getDlcs() + ); + } + + $url = null; + if ($modList instanceof ExternalModList) { + $url = $modList->getUrl(); + } + + return new ModListDetailsOutput( + $modList->getId()->toString(), + $modList->getName(), + $modList->isActive(), + $modList->getCreatedAt(), + $modList->getLastUpdatedAt(), + $isApproved, + $mods, + $dlcs, + $url ); } } diff --git a/src/Mods/Api/DataTransformer/ModList/ModListOutputDataTransformer.php b/src/Mods/Api/DataTransformer/ModList/ModListOutputDataTransformer.php index cc504662..705db628 100644 --- a/src/Mods/Api/DataTransformer/ModList/ModListOutputDataTransformer.php +++ b/src/Mods/Api/DataTransformer/ModList/ModListOutputDataTransformer.php @@ -5,19 +5,25 @@ namespace App\Mods\Api\DataTransformer\ModList; use App\Mods\Api\Output\ModList\ModListOutput; +use App\Mods\Entity\ModList\AbstractModList; use App\Mods\Entity\ModList\StandardModList; class ModListOutputDataTransformer { - public function transform(StandardModList $standardModList): ModListOutput + public function transform(AbstractModList $modList): ModListOutput { + $isApproved = null; + if ($modList instanceof StandardModList) { + $isApproved = $modList->isApproved(); + } + return new ModListOutput( - $standardModList->getId()->toString(), - $standardModList->getName(), - $standardModList->isActive(), - $standardModList->isApproved(), - $standardModList->getCreatedAt(), - $standardModList->getLastUpdatedAt(), + $modList->getId()->toString(), + $modList->getName(), + $modList->isActive(), + $modList->getCreatedAt(), + $modList->getLastUpdatedAt(), + $isApproved, ); } } diff --git a/src/Mods/Api/Output/ModList/ModListDetailsOutput.php b/src/Mods/Api/Output/ModList/ModListDetailsOutput.php index 28d9f70c..0843a9ba 100644 --- a/src/Mods/Api/Output/ModList/ModListDetailsOutput.php +++ b/src/Mods/Api/Output/ModList/ModListDetailsOutput.php @@ -16,20 +16,21 @@ class ModListDetailsOutput extends ModListOutput public function __construct( string $id, string $name, - bool $active, - bool $approved, + ?bool $active, \DateTimeInterface $createdAt, ?\DateTimeInterface $lastUpdatedAt, + ?bool $approved, public array $mods, - public array $dlcs + public array $dlcs, + public ?string $url ) { parent::__construct( $id, $name, $active, - $approved, $createdAt, - $lastUpdatedAt + $lastUpdatedAt, + $approved, ); } } diff --git a/src/Mods/Api/Output/ModList/ModListOutput.php b/src/Mods/Api/Output/ModList/ModListOutput.php index 0ee0b3a7..f707611c 100644 --- a/src/Mods/Api/Output/ModList/ModListOutput.php +++ b/src/Mods/Api/Output/ModList/ModListOutput.php @@ -10,9 +10,9 @@ public function __construct( public string $id, public string $name, public bool $active, - public bool $approved, public \DateTimeInterface $createdAt, public ?\DateTimeInterface $lastUpdatedAt, + public ?bool $approved, ) { } } diff --git a/tests/functional/Mods/Api/ModList/ListModListsCest.php b/tests/functional/Mods/Api/ModList/ListModListsCest.php index b79a9cce..05608182 100644 --- a/tests/functional/Mods/Api/ModList/ListModListsCest.php +++ b/tests/functional/Mods/Api/ModList/ListModListsCest.php @@ -69,6 +69,22 @@ private function getExpectedPayload(): array 'createdAt' => '2020-01-01T00:00:00+00:00', 'lastUpdatedAt' => null, ], + [ + 'id' => '296cc791-c73f-4978-b377-da1d3aa28cfb', + 'name' => 'Google', + 'active' => false, + 'approved' => null, + 'createdAt' => '2020-01-01T00:00:00+00:00', + 'lastUpdatedAt' => null, + ], + [ + 'id' => '4900fe5f-3902-424f-bcc8-e92adbda4df5', + 'name' => 'Localhost', + 'active' => true, + 'approved' => null, + 'createdAt' => '2020-01-01T00:00:00+00:00', + 'lastUpdatedAt' => null, + ], [ 'id' => 'c3b11c2f-9254-4262-bfde-3605df0149d4', 'name' => 'RHS', @@ -78,8 +94,8 @@ private function getExpectedPayload(): array 'lastUpdatedAt' => null, ], ], - 'items' => 3, - 'totalItems' => 3.0, + 'items' => 5, + 'totalItems' => 5.0, 'currentPage' => 1.0, 'lastPage' => 1.0, 'itemsPerPage' => 30.0,