really good progress, need to fix tile upload

This commit is contained in:
Michele Scandura 2020-11-17 00:01:21 +00:00
parent 573e9ea7bf
commit 9ef43bb9f6
25 changed files with 280 additions and 112 deletions

View file

@ -25,41 +25,53 @@ namespace Sledgemapper.Api.Controllers
return result;
}
[HttpGet]
public async Task<Session> Get(string sessionName)
{
var userId = int.Parse(HttpContext.User.Identity.Name);
var result = await _mediator.Send(new GetMapSnapshotCommand(sessionName));
return result;
}
[HttpPost("tile")]
public async Task Post(string sessionName, [FromBody] Tile tile)
{
var userId = int.Parse(HttpContext.User.Identity.Name);
await _mediator.Send(new SaveNewTileCommand(sessionName, tile, userId));
}
await _mediator.Send(new SaveNewTileCommand(sessionName, tile, userId)); }
[HttpPost("overlay")]
public async Task Post(string sessionName, [FromBody] Overlay overlay)
{
await _mediator.Publish(new NewOverlayNotification(sessionName, overlay));
var userId = int.Parse(HttpContext.User.Identity.Name);
await _mediator.Publish(new NewOverlayNotification(sessionName, overlay,userId));
}
[HttpPost("wall")]
public async Task Post(string sessionName, [FromBody] Wall wall)
{
await _mediator.Publish(new NewWallNotification(sessionName, wall));
var userId = int.Parse(HttpContext.User.Identity.Name);
await _mediator.Publish(new NewWallNotification(sessionName, wall,userId));
}
[HttpDelete("tile")]
public async Task Delete(string sessionName, [FromBody] Tile tile)
{
await _mediator.Publish(new DeleteTileNotification(sessionName, tile));
var userId = int.Parse(HttpContext.User.Identity.Name);
await _mediator.Publish(new DeleteTileNotification(sessionName, tile,userId));
}
[HttpDelete("overlay")]
public async Task Delete(string sessionName, [FromBody] Overlay overlay)
{
await _mediator.Publish(new DeleteOverlayNotification(sessionName, overlay));
var userId = int.Parse(HttpContext.User.Identity.Name);
await _mediator.Publish(new DeleteOverlayNotification(sessionName, overlay,userId));
}
[HttpDelete("wall")]
public async Task Delete(string sessionName, [FromBody] Wall wall)
{
await _mediator.Publish(new DeleteWallNotification(sessionName, wall));
var userId = int.Parse(HttpContext.User.Identity.Name);
await _mediator.Publish(new DeleteWallNotification(sessionName, wall,userId));
}