smal fixes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michele Scandura 2021-09-23 15:43:27 +01:00
parent 6c167ed4de
commit a4eb4d2b88
5 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,4 @@
using System;
using Sledgemapper.Shared.Entities;
namespace Sledgemapper.Api.Commands
@ -6,7 +7,7 @@ namespace Sledgemapper.Api.Commands
{
public Tile Tile { get; private set; }
public DeleteTileCommand(string sessionName, Tile tile, string userId) : base(sessionName, userId)
public DeleteTileCommand(Guid campaign, Guid mapName, Tile tile, string userId) : base(campaign, mapName, userId)
{
Tile = tile;
}

View File

@ -40,6 +40,13 @@ namespace Sledgemapper.Api.Controllers
await _mediator.Send(new DeleteNoteCommand(campaign, mapName, note, UserId));
}
[HttpDelete("tile")]
public async Task Delete(Guid campaign, Guid mapName, [FromBody] Tile tile)
{
await _mediator.Send(new DeleteTileCommand(campaign, mapName, tile, UserId));
}
[HttpGet]
public async Task<Session> Get(Guid campaign, Guid mapName)
{

View File

@ -166,9 +166,21 @@ namespace Sledgemapper.Api.Hubs
foreach (var userSession in userSessions)
{
var session = _dbContext.Sessions.FirstOrDefault(m => m.SessionId == userSession.SessionId);
if (session != null)
{
try
{
await Clients.Group(session.SessionId.ToString()).RemovePlayer(new Player { UserId = userId }); //send remove player
}
catch (Exception e)
{
Console.WriteLine(e);
}
_dbContext.SessionUsers.Remove(userSession);
}
await Clients.Group(session.SessionName).RemovePlayer(new Player { UserId = userId }); //send remove player
_dbContext.SessionUsers.Remove(userSession);
}
}
await _dbContext.SaveChangesAsync();

View File

@ -35,7 +35,7 @@ namespace Sledgemapper
_queue = new ChannelsQueue(Messenger);
#if DEBUG
var baseAddress = "http://localhost:5000";
baseAddress = "http://hub.michelescandura.com:5001";
//baseAddress = "http://hub.michelescandura.com:5001";
#else
var baseAddress = "http://hub.michelescandura.com:5001";
#endif

View File

@ -21,7 +21,7 @@ namespace Sledgemapper.UI
_messenger = messenger;
#if DEBUG
TxtEmail.Text = "michele.scandura@sloutlook.com";
TxtEmail.Text = "michele.scandura@outlook.com";
TxtPassword.Text = "slePharland!79";
#endif