test small fixes

This commit is contained in:
Michele 2020-11-20 23:43:33 +00:00
parent 5551918d54
commit 3d45bc532c
12 changed files with 175 additions and 163 deletions

View file

@ -16,7 +16,7 @@ namespace Sledgemapper.Api.Handlers
public async Task Handle(DeleteOverlayNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.SessionName).DeleteOverlay(notification.Overlay);
await _hub.Clients.Groups(notification.Session.SessionName).DeleteOverlay(notification.Overlay);
}
}
}

View file

@ -16,7 +16,7 @@ namespace Sledgemapper.Api.Handlers
public async Task Handle(DeleteTileNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.SessionName).DeleteTile(notification.Tile);
await _hub.Clients.Groups(notification.Session.SessionName).DeleteTile(notification.Tile);
}
}
}

View file

@ -16,7 +16,7 @@ namespace Sledgemapper.Api.Handlers
public async Task Handle(DeleteWallNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.SessionName).DeleteWall(notification.Wall);
await _hub.Clients.Groups(notification.Session.SessionName).DeleteWall(notification.Wall);
}
}
}

View file

@ -16,7 +16,7 @@ namespace Sledgemapper.Api.Handlers
public async Task Handle(NewOverlayNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.SessionName).NewOverlay(notification.Overlay);
await _hub.Clients.Groups(notification.Session.SessionName).NewOverlay(notification.Overlay);
}
}
}

View file

@ -6,28 +6,15 @@ namespace Sledgemapper.Api.Notifications
public abstract class BaseNotification : INotification
{
public double Timestamp { get; private set; }
public string SessionName { get; private set; }
public int UserId { get; private set; }
public int SessionId { get; set; }
public Models.Session Session { get; set; }
public BaseNotification(string sessionName, int userId)
public BaseNotification(Models.Session session, int userId)
{
Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
SessionName = sessionName;
Session = session; ;
UserId = userId;
}
public BaseNotification(Models.Session session, int userId)
{
Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
Session = session;;
UserId = userId;
}
public BaseNotification(int sessionId, string sessionName, int userId) : this(sessionName, userId)
{
SessionId = sessionId;
}
}
}

View file

@ -2,8 +2,7 @@ namespace Sledgemapper.Api.Notifications
{
public class NewSessionNotification : BaseNotification
{
public NewSessionNotification(string sessionName, int userId) : base(sessionName, userId)
{}
public NewSessionNotification(string sessionName, int userId) : base(new Models.Session { SessionName = sessionName }, userId)
{ }
}
}

Binary file not shown.