Skip to content

Release 1.18.1 #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

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;

#[AsController]
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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
}
11 changes: 6 additions & 5 deletions src/Mods/Api/Output/ModList/ModListDetailsOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
}
2 changes: 1 addition & 1 deletion src/Mods/Api/Output/ModList/ModListOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}
}
2 changes: 1 addition & 1 deletion templates/shared/base.html.twig
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
<br/>
Nasze misje zwykle są nastawione na dużo akcji,
bez zbędnego gadania i recytowania regulaminu z pamięci.
4 changes: 2 additions & 2 deletions templates/shared/home/join_us/join_us.html.twig
Original file line number Diff line number Diff line change
@@ -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' %}

Expand Down Expand Up @@ -35,7 +35,7 @@
<section class="text-left">
<h5>{{ 'What do we require to from recruits'|trans }}</h5>
<ul>
<li>{{ 'Base Arma 3 game'|trans }}.</li>
<li>{{ 'Base Arma 3 or Arma Reforger game'|trans }}.</li>
<li>{{ 'At least 16 years old'|trans }}.</li>
</ul>
</section>
Expand Down
20 changes: 18 additions & 2 deletions tests/functional/Mods/Api/ModList/ListModListsCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions translations/messages.pl.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down