chg: dev: increase the minimum PHP version to the latest major - and massive refactor on back-end, like Controllers and Repositories #4
This commit is contained in:
@@ -18,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\AsController;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,7 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*/
|
||||
#[AsController]
|
||||
class MercureController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
@@ -83,6 +85,27 @@ class MercureController extends AbstractController
|
||||
return $this->json(['success' => true]);
|
||||
}
|
||||
|
||||
#[Route('/api/game/challenge/{targetGameAssoc}', name: 'MineSeekerBundle_api_game_challenge', methods: ['POST'])]
|
||||
public function challenge(string $targetGameAssoc, Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
$challengerGameAssoc = $data['challengerGameAssoc'] ?? '';
|
||||
$this->topicManager->publishChallenge($targetGameAssoc, $challengerGameAssoc);
|
||||
|
||||
return $this->json(['success' => true]);
|
||||
}
|
||||
|
||||
#[Route('/api/game/challenge/respond/{challengerGameAssoc}', name: 'MineSeekerBundle_api_game_challenge_respond', methods: ['POST'])]
|
||||
public function challengeRespond(string $challengerGameAssoc, Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->toArray();
|
||||
$accepted = (bool)($data['accepted'] ?? false);
|
||||
$targetGameAssoc = $data['targetGameAssoc'] ?? '';
|
||||
$this->topicManager->publishChallengeResponse($challengerGameAssoc, $accepted, $targetGameAssoc);
|
||||
|
||||
return $this->json(['success' => true]);
|
||||
}
|
||||
|
||||
#[Route('/api/game/waiting', name: 'MineSeekerBundle_api_game_waiting', methods: ['GET'])]
|
||||
public function waiting(PlayedGameRepository $repo): JsonResponse
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user