small fixes
This commit is contained in:
parent
22233f8c6e
commit
acc9fbeeb7
1 changed files with 11 additions and 19 deletions
|
@ -12,21 +12,20 @@ namespace Sledgemapper.Api.Controllers
|
|||
public class SessionController : ControllerBase
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public SessionController(IMediator mediator) { _mediator = mediator; }
|
||||
private int UserId => int.Parse(HttpContext.User.Identity.Name);
|
||||
|
||||
public SessionController(IMediator mediator) => _mediator = mediator;
|
||||
|
||||
[HttpPost]
|
||||
public async Task<bool> Post(string sessionName)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
var result = await _mediator.Send(new NewSessionCommand(sessionName, userId));
|
||||
var result = await _mediator.Send(new NewSessionCommand(sessionName, UserId));
|
||||
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;
|
||||
}
|
||||
|
@ -34,50 +33,43 @@ namespace Sledgemapper.Api.Controllers
|
|||
[HttpPost("snapshot")]
|
||||
public async Task Post(string sessionName, [FromBody] Session session)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
await _mediator.Send(new NewSnapshotCommand(sessionName, session, userId));
|
||||
await _mediator.Send(new NewSnapshotCommand(sessionName, session, UserId));
|
||||
}
|
||||
|
||||
[HttpPost("tile")]
|
||||
public async Task Post(string sessionName, [FromBody] Tile tile)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
await _mediator.Send(new NewTileCommand(sessionName, tile, userId));
|
||||
await _mediator.Send(new NewTileCommand(sessionName, tile, UserId));
|
||||
}
|
||||
|
||||
[HttpPost("overlay")]
|
||||
public async Task Post(string sessionName, [FromBody] Overlay overlay)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
await _mediator.Send(new NewOverlayCommand(sessionName, overlay, userId));
|
||||
await _mediator.Send(new NewOverlayCommand(sessionName, overlay, UserId));
|
||||
}
|
||||
|
||||
[HttpPost("wall")]
|
||||
public async Task Post(string sessionName, [FromBody] Wall wall)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
await _mediator.Send(new NewWallCommand(sessionName, wall, userId));
|
||||
await _mediator.Send(new NewWallCommand(sessionName, wall, UserId));
|
||||
}
|
||||
|
||||
[HttpDelete("tile")]
|
||||
public async Task Delete(string sessionName, [FromBody] Tile tile)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
await _mediator.Send(new DeleteTileCommand(sessionName, tile, userId));
|
||||
await _mediator.Send(new DeleteTileCommand(sessionName, tile, UserId));
|
||||
}
|
||||
|
||||
[HttpDelete("overlay")]
|
||||
public async Task Delete(string sessionName, [FromBody] Overlay overlay)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
await _mediator.Send(new DeleteOverlayCommand(sessionName, overlay, userId));
|
||||
await _mediator.Send(new DeleteOverlayCommand(sessionName, overlay, UserId));
|
||||
}
|
||||
|
||||
[HttpDelete("wall")]
|
||||
public async Task Delete(string sessionName, [FromBody] Wall wall)
|
||||
{
|
||||
var userId = int.Parse(HttpContext.User.Identity.Name);
|
||||
await _mediator.Send(new DeleteWallCommand(sessionName, wall, userId));
|
||||
await _mediator.Send(new DeleteWallCommand(sessionName, wall, UserId));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue