Skip to content
Merged
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
11 changes: 11 additions & 0 deletions config/chat/routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
chat_write_message:
path: /api/chat/chats/{chatId}/write-message
methods: [POST]
controller: chat.chat-controller::writeMessageAction
defaults: { _format: json }

chat_messages:
path: /api/chat/chats/{chatId}/messages
methods: [GET]
controller: chat.chat-controller::messagesAction
defaults: { _format: json }
5 changes: 5 additions & 0 deletions config/chat/services/controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
chat.chat-controller:
class: Gaming\Chat\Presentation\Http\ChatController
arguments: ['@chat.command-bus', '@chat.query-bus', '@web-interface.security', '@gaming.usernames']
tags: ['controller.service_arguments']
24 changes: 24 additions & 0 deletions config/connect-four/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,27 @@ connect_four_challenge:
path: /challenge/{id}
methods: [GET]
controller: connect-four.challenge-controller::showAction

connect_four_abort_game:
path: /api/connect-four/games/{gameId}/abort
methods: [POST]
controller: connect-four.game-controller::abortAction
defaults: { _format: json }

connect_four_resign_game:
path: /api/connect-four/games/{gameId}/resign
methods: [POST]
controller: connect-four.game-controller::resignAction
defaults: { _format: json }

connect_four_join_game:
path: /api/connect-four/games/{gameId}/join
methods: [POST]
controller: connect-four.game-controller::joinAction
defaults: { _format: json }

connect_four_move_game:
path: /api/connect-four/games/{gameId}/move
methods: [POST]
controller: connect-four.game-controller::moveAction
defaults: { _format: json }
5 changes: 5 additions & 0 deletions config/connect-four/services/controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ services:
- '@gaming.usernames'
calls: [[setContainer, ['@Psr\Container\ContainerInterface']]]
tags: ['controller.service_arguments', 'container.service_subscriber']

connect-four.game-controller:
class: Gaming\ConnectFour\Port\Adapter\Http\GameController
arguments: ['@connect-four.command-bus', '@web-interface.security']
tags: ['controller.service_arguments']
3 changes: 3 additions & 0 deletions config/identity/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ gaming_platform_bus:
identity_command: ~
identity_query: ~

twig:
paths: { '%kernel.project_dir%/src/Identity/Port/Adapter/Http/View': identity }

doctrine:
dbal:
connections:
Expand Down
31 changes: 31 additions & 0 deletions config/identity/routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
_symfony_logout:
resource: security.route_loader.logout
type: service

identity_signup:
path: /signup
methods: [GET, POST]
controller: identity.signup-controller::indexAction

identity_signup_verify_email:
path: /signup/verify-email
methods: [GET]
controller: identity.signup-controller::verifyEmailAction

identity_signup_confirm:
path: /signup/confirm
methods: [GET, POST]
controller: identity.signup-controller::confirmAction

identity_login:
path: /login
methods: [GET, POST]
controller: identity.login-controller::indexAction

identity_login_check_inbox:
path: /login/check-inbox
methods: [GET]
controller: identity.login-controller::checkInboxAction

identity_login_check:
path: /login/check
21 changes: 21 additions & 0 deletions config/identity/services/controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
identity.signup-controller:
class: Gaming\Identity\Port\Adapter\Http\SignupController
arguments:
- '@uri_signer'
- '@web-interface.security'
- '@identity.command-bus'
- '@gaming.form-violation-mapper'
calls: [[setContainer, ['@Psr\Container\ContainerInterface']]]
tags: ['controller.service_arguments', 'container.service_subscriber']

identity.login-controller:
class: Gaming\Identity\Port\Adapter\Http\LoginController
arguments:
- '@security.authentication_utils'
- '@security.authenticator.firewall_aware_login_link_handler'
- '@uri_signer'
- '@identity.query-bus'
- '@gaming.form-violation-mapper'
calls: [[setContainer, ['@Psr\Container\ContainerInterface']]]
tags: ['controller.service_arguments', 'container.service_subscriber']
2 changes: 1 addition & 1 deletion config/web-interface/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ security:
pattern: ^/
lazy: true
login_link:
check_route: login_check
check_route: identity_login_check
signature_properties: ['userIdentifier']
logout:
path: /logout
Expand Down
80 changes: 0 additions & 80 deletions config/web-interface/routing.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
_symfony_logout:
resource: security.route_loader.logout
type: service

###############################################
# Pages #
###############################################

lobby:
path: /
methods: [GET]
Expand All @@ -26,80 +18,8 @@ game:
methods: [GET]
controller: web-interface.page-controller::gameAction

signup:
path: /signup
methods: [GET, POST]
controller: web-interface.signup-controller::indexAction

signup_verify_email:
path: /signup/verify-email
methods: [GET]
controller: web-interface.signup-controller::verifyEmailAction

signup_confirm:
path: /signup/confirm
methods: [GET, POST]
controller: web-interface.signup-controller::confirmAction

login:
path: /login
methods: [GET, POST]
controller: web-interface.login-controller::indexAction

login_check_inbox:
path: /login/check-inbox
methods: [GET]
controller: web-interface.login-controller::checkInboxAction

login_check:
path: /login/check

server_time:
path: /api/server-time
methods: [GET]
controller: web-interface.server-time-controller::serverTimeAction
defaults: { _format: json }

###############################################
# Chat Service #
###############################################

write_message:
path: /api/chat/chats/{chatId}/write-message
methods: [POST]
controller: web-interface.chat-controller::writeMessageAction
defaults: { _format: json }

messages:
path: /api/chat/chats/{chatId}/messages
methods: [GET]
controller: web-interface.chat-controller::messagesAction
defaults: { _format: json }

###############################################
# Connect Four Service #
###############################################

abort:
path: /api/connect-four/games/{gameId}/abort
methods: [POST]
controller: web-interface.connect-four-controller::abortAction
defaults: { _format: json }

resign:
path: /api/connect-four/games/{gameId}/resign
methods: [POST]
controller: web-interface.connect-four-controller::resignAction
defaults: { _format: json }

join:
path: /api/connect-four/games/{gameId}/join
methods: [POST]
controller: web-interface.connect-four-controller::joinAction
defaults: { _format: json }

move:
path: /api/connect-four/games/{gameId}/move
methods: [POST]
controller: web-interface.connect-four-controller::moveAction
defaults: { _format: json }
31 changes: 0 additions & 31 deletions config/web-interface/services/controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,6 @@ services:
calls: [[setContainer, ['@Psr\Container\ContainerInterface']]]
tags: ['controller.service_arguments', 'container.service_subscriber']

web-interface.signup-controller:
class: Gaming\WebInterface\Presentation\Http\SignupController
arguments:
- '@uri_signer'
- '@web-interface.security'
- '@identity.command-bus'
- '@gaming.form-violation-mapper'
calls: [[setContainer, ['@Psr\Container\ContainerInterface']]]
tags: ['controller.service_arguments', 'container.service_subscriber']

web-interface.login-controller:
class: Gaming\WebInterface\Presentation\Http\LoginController
arguments:
- '@security.authentication_utils'
- '@security.authenticator.firewall_aware_login_link_handler'
- '@uri_signer'
- '@identity.query-bus'
- '@gaming.form-violation-mapper'
calls: [[setContainer, ['@Psr\Container\ContainerInterface']]]
tags: ['controller.service_arguments', 'container.service_subscriber']

web-interface.chat-controller:
class: Gaming\WebInterface\Presentation\Http\ChatController
arguments: ['@chat.command-bus', '@chat.query-bus', '@web-interface.security', '@gaming.usernames']
tags: ['controller.service_arguments']

web-interface.connect-four-controller:
class: Gaming\WebInterface\Presentation\Http\ConnectFourController
arguments: ['@connect-four.command-bus', '@web-interface.security']
tags: ['controller.service_arguments']

web-interface.server-time-controller:
class: Gaming\WebInterface\Presentation\Http\ServerTimeController
tags: ['controller.service_arguments']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Gaming\WebInterface\Presentation\Http;
namespace Gaming\Chat\Presentation\Http;

use Gaming\Chat\Application\Command\WriteMessageCommand;
use Gaming\Chat\Application\Query\MessagesQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Gaming\WebInterface\Presentation\Http;
namespace Gaming\ConnectFour\Port\Adapter\Http;

use Gaming\Common\Bus\Bus;
use Gaming\ConnectFour\Application\Game\Command\AbortCommand;
Expand All @@ -13,7 +13,7 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

final class ConnectFourController
final class GameController
{
public function __construct(
private readonly Bus $connectFourCommandBus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Gaming\WebInterface\Presentation\Http\Form;
namespace Gaming\Identity\Port\Adapter\Http\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Gaming\WebInterface\Presentation\Http\Form;
namespace Gaming\Identity\Port\Adapter\Http\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace Gaming\WebInterface\Presentation\Http;
namespace Gaming\Identity\Port\Adapter\Http;

use Gaming\Common\Bus\Bus;
use Gaming\Common\Domain\Exception\DomainException;
use Gaming\Common\Domain\Integration\FormViolationMapper;
use Gaming\Identity\Application\User\Query\UserByEmailQuery;
use Gaming\Identity\Port\Adapter\Http\Form\LoginType;
use Gaming\WebInterface\Infrastructure\Security\User;
use Gaming\WebInterface\Presentation\Http\Form\LoginType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -44,20 +44,24 @@ public function indexAction(#[CurrentUser] ?User $user, Request $request): Respo
$email = (string)$form->get('email')->getData();
$user = $this->identityQueryBus->handle(new UserByEmailQuery($email));

return $this->redirectToRoute('login_check_inbox', [
return $this->redirectToRoute('identity_login_check_inbox', [
'loginUrl' => $user === null ? null : $this->loginLinkHandler->createLoginLink(
new User($user->userId)
),
'signupUrl' => $user !== null ? null : $this->uriSigner->sign(
$this->generateUrl('signup_confirm', ['email' => $email], UrlGeneratorInterface::ABSOLUTE_URL)
$this->generateUrl(
'identity_signup_confirm',
['email' => $email],
UrlGeneratorInterface::ABSOLUTE_URL
)
)
]);
} catch (DomainException $e) {
$this->formViolationMapper->mapViolations($form, $e->violations);
}
}

return $this->render('@web-interface/login/index.html.twig', [
return $this->render('@identity/login/index.html.twig', [
'form' => $form,
'lastAuthenticationError' => $this->authenticationUtils->getLastAuthenticationError()
]);
Expand All @@ -69,6 +73,6 @@ public function checkInboxAction(#[CurrentUser] ?User $user): Response
return $this->redirectToRoute('lobby');
}

return $this->render('@web-interface/login/check-inbox.html.twig');
return $this->render('@identity/login/check-inbox.html.twig');
}
}
Loading