Skip to content
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
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@ EXPO_DSN=expo://TOKEN@default
###< symfony/expo-notifier ###

###> sentry/sentry-symfony ###
SENTRY_DSN=https://[email protected].sentry.io/4510172011626496
SENTRY_DSN=sentry-dsn
###< sentry/sentry-symfony ###

OPENROUTER_API_KEY=open-router-api-key
OPENROUTER_MODEL=openai/gpt-oss-20b:free
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ phpstan.neon
###< phpstan/phpstan ###

/deploy-instruction.md
/.claude/
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^2.3",
"sentry/sentry-symfony": "^5.6",
"symfony/ai-agent": "dev-main",
"symfony/console": "^7.3",
"symfony/dotenv": "^7.3",
"symfony/expo-notifier": "7.3.*",
Expand Down
275 changes: 274 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/Api/Controller/HealthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ class HealthController extends AbstractController implements LoggerAwareInterfac
{
use LoggerAwareTrait;

public function __construct()
{
}

#[Route('/', name: 'health', methods: [Request::METHOD_GET])]
public function health(): JsonResponse
{
Expand Down
21 changes: 13 additions & 8 deletions src/Api/Controller/MissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace App\Api\Controller;

use App\Api\Exception\KillerBadRequestHttpException;
use App\Application\UseCase\Mission\CreateMissionUseCase;
use App\Domain\KillerSerializerInterface;
use App\Domain\KillerValidatorInterface;
use App\Domain\Mission\Entity\Mission;
Expand All @@ -19,6 +19,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
Expand All @@ -32,26 +33,30 @@ public function __construct(
private readonly SseInterface $hub,
private readonly KillerSerializerInterface $serializer,
private readonly KillerValidatorInterface $validator,
private readonly CreateMissionUseCase $createMissionUseCase,
) {
}

#[Route(name: 'create_mission', methods: [Request::METHOD_POST])]
#[IsGranted(MissionVoter::CREATE_MISSION, message: 'KILLER_CREATE_MISSION_UNAUTHORIZED')]
public function createMission(
#[MapRequestPayload(serializationContext: [AbstractNormalizer::GROUPS => 'post-mission'])] Mission $mission,
#[MapRequestPayload(serializationContext: [AbstractNormalizer::GROUPS => 'post-mission'])] Mission $missionDto,
): JsonResponse {
/** @var Player $player */
$player = $this->getUser();
$room = $player->getRoom();

if (!$room || $room->getStatus() !== Room::PENDING) {
throw new KillerBadRequestHttpException('CAN_NOT_ADD_MISSIONS');
$content = $missionDto->getContent();
if ($content === null) {
throw new BadRequestHttpException('Mission content is required');
}

$player->addAuthoredMission($mission);
$mission = $this->createMissionUseCase->execute($content, $player);

$this->missionRepository->store($mission);
$this->persistenceAdapter->flush();
$room = $player->getRoom();

if ($room === null) {
throw new BadRequestHttpException('Player must be in a room');
}

$this->hub->publish(
sprintf('room/%s', $room),
Expand Down
Loading
Loading