diff --git a/src/Application/Gaas.GobbletGobblers.Application/UseCases/GameRequest.cs b/src/Application/Gaas.GobbletGobblers.Application/UseCases/GameRequest.cs new file mode 100644 index 0000000..508c50f --- /dev/null +++ b/src/Application/Gaas.GobbletGobblers.Application/UseCases/GameRequest.cs @@ -0,0 +1,14 @@ +namespace Gaas.GobbletGobblers.Application.UseCases +{ + public class GameRequest + { + public List Players { get; set; } + } + + public class GamePlayer + { + public string Id { get; set; } + + public string Nickname { get; set; } + } +} \ No newline at end of file diff --git a/src/InterfaceAdapter/Gaas.GobbletGobblers.Client/wwwroot/Gobblet-Gobblers.png b/src/InterfaceAdapter/Gaas.GobbletGobblers.Client/wwwroot/Gobblet-Gobblers.png new file mode 100644 index 0000000..db5eb0b Binary files /dev/null and b/src/InterfaceAdapter/Gaas.GobbletGobblers.Client/wwwroot/Gobblet-Gobblers.png differ diff --git a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs index 2bf3348..5418856 100644 --- a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs +++ b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs @@ -21,6 +21,27 @@ public GameController(ILogger logger, IRepository repository) _repository = repository; } + [HttpPost] + [Route("~/games")] + public async Task GamesAsync(GameRequest request) + { + var createGameRequest = new CreateGameRequest + { + PlayerName = request.Players[0].Nickname + }; + + var createGameResponse = await new CreateGameUseCase().ExecuteAsync(createGameRequest, _repository); + + var joinGameRequest = new JoinGameRequest + { + Id = createGameResponse.Id, + PlayerName = request.Players[1].Nickname + }; + _ = await new JoinGameUseCase().ExecuteAsync(joinGameRequest, _repository); + + return new { url = $"https://oneheed.github.io/Gobblet-Gobblers/games/{createGameResponse.Id}" }; + } + [HttpPost] [Route("Create")] public async Task CreateAsync(CreateGameRequest request)