This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Stat entity to get the count of games creations by days on a period
- Loading branch information
1 parent
b391718
commit d5923ef
Showing
10 changed files
with
159 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { RaRecord } from 'react-admin'; | ||
|
||
export interface Stat_Game extends RaRecord { | ||
nbrGames?: number; | ||
date?: Date; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\State; | ||
|
||
use ApiPlatform\Metadata\Operation; | ||
use ApiPlatform\State\ProviderInterface; | ||
use App\Entity\Stat; | ||
use App\Repository\GameRepository; | ||
use DateTime; | ||
use Exception; | ||
use Psr\Log\LoggerInterface; | ||
use RuntimeException; | ||
use Symfony\Component\Serializer\SerializerInterface; | ||
|
||
final class StatGamesCountProvider implements ProviderInterface | ||
{ | ||
public function __construct(private readonly GameRepository $gameRepository, private readonly LoggerInterface $logger, private readonly SerializerInterface $serializer) | ||
{ | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* @throws Exception | ||
*/ | ||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): array | ||
{ | ||
return $this->serializer->denormalize($this->gameRepository->getDaysCount(new DateTime($uriVariables['id'])), Stat::class . '[]'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters