From 7b2d10da745062a238048b8c01291b5c49997e6c Mon Sep 17 00:00:00 2001 From: GrapeHuang Date: Sun, 17 Sep 2023 13:03:07 +0800 Subject: [PATCH] Fixed Create Player --- .../Controllers/GameController.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs index 1bf91a7..c710767 100644 --- a/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs +++ b/src/InterfaceAdapter/Gaas.GobbletGobblers.Core.WebApi/Controllers/GameController.cs @@ -25,6 +25,11 @@ public GameController(ILogger logger, IRepository repository) [Route("~/games")] public async Task GamesAsync(GameRequest request) { + if (request.Players.Count != 2) + { + throw new Exception("Requires at least two players to play"); + } + var createGameRequest = new CreateGameRequest { PlayerId = new Guid(Convert.FromBase64String(request.Players[0].Id).Take(16).ToArray()),