diff --git a/Controllers/LocationController.cs b/Controllers/LocationController.cs index 4d586a7..de07d16 100644 --- a/Controllers/LocationController.cs +++ b/Controllers/LocationController.cs @@ -45,6 +45,32 @@ public class LocationController : ControllerBase return Ok(newLoc); } + [HttpPost("inventory")] + [Authorize(Roles = "SUPER")] + public async Task CreateInventory() + { + var inventoryLocation = new Location + { + LocationType = "Inventory", + X = null, + Y = null, + Z = null, + N = null, + NE = null, + E = null, + SE = null, + S = null, + SW = null, + W = null, + NW = null, + Players = new List() + }; + + await _locationService.CreateAsync(inventoryLocation); + + return Ok(inventoryLocation); + } + [HttpPut("{id}")] [Authorize(Roles = "SUPER")] public async Task Update(string id, [FromBody] UpdateLocationRequest req) diff --git a/GameAuthApi.Tests/LocationControllerTests.cs b/GameAuthApi.Tests/LocationControllerTests.cs index 81413be..c03e272 100644 --- a/GameAuthApi.Tests/LocationControllerTests.cs +++ b/GameAuthApi.Tests/LocationControllerTests.cs @@ -26,6 +26,19 @@ public class LocationControllerTests mockLoc.Verify(); } + [Fact] + public async Task CreateInventory_ReturnsOk() + { + var mockLoc = new Mock(config); + mockLoc.Setup(l => l.CreateAsync(It.IsAny())).Returns(Task.CompletedTask).Verifiable(); + var controller = new LocationController(mockLoc.Object, new Mock(config).Object); + + var result = await controller.CreateInventory(); + + Assert.IsType(result); + mockLoc.Verify(); + } + [Fact] public async Task GetById_NotFound() {