really good progress, need to fix tile upload
This commit is contained in:
parent
573e9ea7bf
commit
9ef43bb9f6
25 changed files with 280 additions and 112 deletions
|
@ -1,6 +1,7 @@
|
|||
using MediatR;
|
||||
using Sledgemapper.Api.Data;
|
||||
using Sledgemapper.Shared.Entities;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -16,14 +17,16 @@ namespace Sledgemapper.Api.Handlers
|
|||
public async Task Handle(DeleteOverlayNotification notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var jsonString = JsonSerializer.Serialize<Overlay>(notification.Overlay);
|
||||
var session = _dbcontext.Sessions.First(m=>m.SessionName== notification.SessionName);
|
||||
|
||||
_dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
||||
{
|
||||
Operation = "D",
|
||||
SessionName = notification.SessionName,
|
||||
SessionId = session.SessionId,
|
||||
Type = "O",
|
||||
Timestamp = notification.Timestamp,
|
||||
Object = jsonString
|
||||
Object = jsonString,
|
||||
UserId=notification.UserId
|
||||
});
|
||||
|
||||
await _dbcontext.SaveChangesAsync();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediatR;
|
||||
using Sledgemapper.Api.Data;
|
||||
using Sledgemapper.Shared.Entities;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -16,14 +17,16 @@ namespace Sledgemapper.Api.Handlers
|
|||
public async Task Handle(DeleteTileNotification notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var jsonString = JsonSerializer.Serialize<Tile>(notification.Tile);
|
||||
var session = _dbcontext.Sessions.First(m=>m.SessionName== notification.SessionName);
|
||||
|
||||
_dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
||||
{
|
||||
Operation = "D",
|
||||
SessionName = notification.SessionName,
|
||||
SessionId = session.SessionId,
|
||||
Type = "T",
|
||||
Timestamp = notification.Timestamp,
|
||||
Object = jsonString
|
||||
Object = jsonString,
|
||||
UserId = notification.UserId
|
||||
});
|
||||
await _dbcontext.SaveChangesAsync();
|
||||
}
|
||||
|
|
|
@ -20,14 +20,16 @@ namespace Sledgemapper.Api.Handlers
|
|||
public async Task Handle(DeleteWallNotification notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var jsonString = JsonSerializer.Serialize<Wall>(notification.Wall);
|
||||
var session = _dbcontext.Sessions.First(m => m.SessionName == notification.SessionName);
|
||||
|
||||
_dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
||||
{
|
||||
Operation = "D",
|
||||
SessionName = notification.SessionName,
|
||||
SessionId = session.SessionId,
|
||||
Type = "W",
|
||||
Timestamp = notification.Timestamp,
|
||||
Object = jsonString
|
||||
Object = jsonString,
|
||||
UserId = notification.UserId
|
||||
});
|
||||
await _dbcontext.SaveChangesAsync();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediatR;
|
||||
using Sledgemapper.Api.Data;
|
||||
using Sledgemapper.Shared.Entities;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -16,14 +17,16 @@ namespace Sledgemapper.Api.Handlers
|
|||
public async Task Handle(NewOverlayNotification notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var jsonString = JsonSerializer.Serialize<Overlay>(notification.Overlay);
|
||||
var session = _dbcontext.Sessions.First(m=>m.SessionName== notification.SessionName);
|
||||
|
||||
_dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
||||
{
|
||||
Operation = "N",
|
||||
SessionName = notification.SessionName,
|
||||
SessionId = session.SessionId,
|
||||
Type = "O",
|
||||
Timestamp = notification.Timestamp,
|
||||
Object = jsonString
|
||||
Object = jsonString,
|
||||
UserId = notification.UserId
|
||||
});
|
||||
|
||||
await _dbcontext.SaveChangesAsync();
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
using MediatR;
|
||||
using Sledgemapper.Api.Data;
|
||||
using Sledgemapper.Shared.Entities;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
// using MediatR;
|
||||
// using Sledgemapper.Api.Data;
|
||||
// using Sledgemapper.Shared.Entities;
|
||||
// using System.Linq;
|
||||
// using System.Text.Json;
|
||||
// using System.Threading;
|
||||
// using System.Threading.Tasks;
|
||||
|
||||
namespace Sledgemapper.Api.Handlers
|
||||
{
|
||||
public class SaveNewTile : INotificationHandler<NewTileNotification>
|
||||
{
|
||||
private readonly MyDbContext _dbcontext;
|
||||
// namespace Sledgemapper.Api.Handlers
|
||||
// {
|
||||
// public class SaveNewTile : INotificationHandler<NewTileNotification>
|
||||
// {
|
||||
// private readonly MyDbContext _dbcontext;
|
||||
|
||||
public SaveNewTile(MyDbContext dbcontext) => _dbcontext = dbcontext;
|
||||
// public SaveNewTile(MyDbContext dbcontext) => _dbcontext = dbcontext;
|
||||
|
||||
public async Task Handle(NewTileNotification notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var jsonString = JsonSerializer.Serialize<Tile>(notification.Tile);
|
||||
// public async Task Handle(NewTileNotification notification, CancellationToken cancellationToken)
|
||||
// {
|
||||
// var jsonString = JsonSerializer.Serialize<Tile>(notification.Tile);
|
||||
// var session = _dbcontext.Sessions.First(m=>m.SessionName== notification.SessionName);
|
||||
|
||||
_dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
||||
{
|
||||
Operation = "N",
|
||||
SessionName = notification.SessionName,
|
||||
Type = "T",
|
||||
Timestamp = notification.Timestamp,
|
||||
Object = jsonString
|
||||
});
|
||||
await _dbcontext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
// _dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
||||
// {
|
||||
// Operation = "N",
|
||||
// SessionId = session.SessionId,
|
||||
// Type = "T",
|
||||
// Timestamp = notification.Timestamp,
|
||||
// Object = jsonString,
|
||||
// UserId=notification.UserId
|
||||
// });
|
||||
// await _dbcontext.SaveChangesAsync();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using MediatR;
|
||||
using Sledgemapper.Api.Data;
|
||||
using Sledgemapper.Shared.Entities;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -16,14 +17,15 @@ namespace Sledgemapper.Api.Handlers
|
|||
public async Task Handle(NewWallNotification notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var jsonString = JsonSerializer.Serialize<Wall>(notification.Wall);
|
||||
|
||||
var session = _dbcontext.Sessions.First(m=>m.SessionName== notification.SessionName);
|
||||
_dbcontext.MapLogs.Add(new Sledgemapper.Api.Models.MapLog
|
||||
{
|
||||
Operation = "N",
|
||||
SessionName = notification.SessionName,
|
||||
SessionId = session.SessionId,
|
||||
Type = "W",
|
||||
Timestamp = notification.Timestamp,
|
||||
Object = jsonString
|
||||
Object = jsonString,
|
||||
UserId = notification.UserId,
|
||||
});
|
||||
await _dbcontext.SaveChangesAsync();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue