Compare commits

...

3 Commits

Author SHA1 Message Date
496c221fba Merge pull request 'campaign' (#3) from campaign into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #3
2021-09-23 14:47:44 +00:00
Michele Scandura
4d59131905 another small fix
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-09-23 15:44:56 +01:00
Michele Scandura
a4eb4d2b88 smal fixes
All checks were successful
continuous-integration/drone/push Build is passing
2021-09-23 15:43:27 +01:00
5 changed files with 24 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,20 @@ 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.GroupExcept(session.SessionId.ToString(), new List<string> { Context.ConnectionId }).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