tentative campaign map management
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michele 2021-08-30 23:30:04 +01:00
parent c46e66595b
commit 4c345bd044
37 changed files with 1693 additions and 50 deletions

View File

@ -7,13 +7,22 @@ namespace Sledgemapper.Api.Commands
{
public double Timestamp { get; private set; }
public string SessionName { get; private set; }
public int UserId { get; private set; }
public string Campaign { get; private set; }
public string UserId { get; private set; }
public BaseCommand(string sessionName, int userId)
public BaseCommand(string sessionName, string userId)
{
Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
SessionName = sessionName;
UserId = userId;
}
public BaseCommand(string campaign, string sessionName, string userId)
{
Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
SessionName = sessionName;
Campaign = campaign;
UserId = userId;
}
}
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Note Note { get; private set; }
public DeleteNoteCommand(string sessionName, Note note, int userId) : base(sessionName, userId)
public DeleteNoteCommand(string sessionName, Note note, string userId) : base(sessionName, userId)
{
Note = note;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Overlay Overlay { get; private set; }
public DeleteOverlayCommand(string sessionName, Overlay overlay, int userId) : base(sessionName, userId)
public DeleteOverlayCommand(string sessionName, Overlay overlay, string userId) : base(sessionName, userId)
{
Overlay = overlay;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Tile Tile { get; private set; }
public DeleteTileCommand(string sessionName, Tile tile, int userId) : base(sessionName, userId)
public DeleteTileCommand(string sessionName, Tile tile, string userId) : base(sessionName, userId)
{
Tile = tile;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Wall Wall { get; private set; }
public DeleteWallCommand(string sessionName, Wall wall, int userId) : base(sessionName, userId)
public DeleteWallCommand(string sessionName, Wall wall, string userId) : base(sessionName, userId)
{
Wall = wall;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Line Line { get; private set; }
public NewLineCommand(string sessionName, Line line, int userId) : base(sessionName, userId)
public NewLineCommand(string sessionName, Line line, string userId) : base(sessionName, userId)
{
Line = line;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Note Note { get; private set; }
public NewNoteCommand(string sessionName, Note note, int userId) : base(sessionName, userId)
public NewNoteCommand(string sessionName, Note note, string userId) : base(sessionName, userId)
{
Note = note;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Overlay Overlay { get; private set; }
public NewOverlayCommand(string sessionName, Overlay overlay, int userId) : base(sessionName, userId)
public NewOverlayCommand(string sessionName, Overlay overlay, string userId) : base(sessionName, userId)
{
Overlay = overlay;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Room Room { get; private set; }
public NewRoomCommand(string sessionName, Room room, int userId) : base(sessionName, userId)
public NewRoomCommand(string sessionName, Room room, string userId) : base(sessionName, userId)
{
Room = room;
}

View File

@ -5,7 +5,7 @@ namespace Sledgemapper.Api.Commands
{
public class NewSessionCommand : BaseCommand<bool>
{
public NewSessionCommand(string sessionName, int userId) : base(sessionName, userId)
public NewSessionCommand(string campaign, string sessionName, string userId) : base(campaign, sessionName, userId)
{
}
}

View File

@ -5,7 +5,7 @@ namespace Sledgemapper.Api.Commands
public class NewSnapshotCommand : BaseCommand<bool>
{
public Session Session { get; private set; }
public NewSnapshotCommand(string sessionName, Session session, int userId) : base(sessionName, userId)
public NewSnapshotCommand(string sessionName, Session session, string userId) : base(sessionName, userId)
{
Session = session;
}

View File

@ -5,7 +5,7 @@ namespace Sledgemapper.Api.Commands
public class NewTileCommand : BaseCommand<bool>
{
public Tile Tile { get; private set; }
public NewTileCommand(string sessionName, Tile tile, int userId) : base(sessionName, userId)
public NewTileCommand(string sessionName, Tile tile, string userId) : base(sessionName, userId)
{
Tile = tile;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Commands
{
public Wall Wall { get; private set; }
public NewWallCommand(string sessionName, Wall wall, int userId) : base(sessionName, userId)
public NewWallCommand(string sessionName, Wall wall, string userId) : base(sessionName, userId)
{
Wall = wall;
}

View File

@ -3,83 +3,84 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Sledgemapper.Api.Commands;
using Sledgemapper.Shared.Entities;
using System.Linq;
using System.Threading.Tasks;
namespace Sledgemapper.Api.Controllers
{
[Authorize]
[Route("[controller]/{mapName}")]
[Route("[controller]/{campaign}/{mapName}")]
public class MapController : ControllerBase
{
private readonly IMediator _mediator;
private int UserId => int.Parse(HttpContext.User.Identity.Name);
private string UserId => HttpContext.User.Claims.FirstOrDefault(m => m.Type == "Id").Value;
public MapController(IMediator mediator) => _mediator = mediator;
[HttpPost]
public async Task<bool> Post(string mapName)
public async Task<bool> Post(string campaign, string mapName)
{
var result = await _mediator.Send(new NewSessionCommand(mapName, UserId));
var result = await _mediator.Send(new NewSessionCommand(campaign, mapName, UserId));
return result;
}
[HttpGet]
public async Task<Session> Get(string mapName)
public async Task<Session> Get(string campaign, string mapName)
{
var result = await _mediator.Send(new GetMapSnapshotCommand(mapName));
return result;
}
[HttpPost("snapshot")]
public async Task Post(string mapName, [FromBody] Session session)
public async Task Post(string campaign, string mapName, [FromBody] Session session)
{
await _mediator.Send(new NewSnapshotCommand(mapName, session, UserId));
}
[HttpPost("overlay")]
public async Task Post(string mapName, [FromBody] Overlay overlay)
public async Task Post(string campaign, string mapName, [FromBody] Overlay overlay)
{
await _mediator.Send(new NewOverlayCommand(mapName, overlay, UserId));
}
[HttpPost("wall")]
public async Task Post(string mapName, [FromBody] Wall wall)
public async Task Post(string campaign, string mapName, [FromBody] Wall wall)
{
await _mediator.Send(new NewWallCommand(mapName, wall, UserId));
}
[HttpPost("note")]
public async Task Post(string mapName, [FromBody] Note note)
public async Task Post(string campaign, string mapName, [FromBody] Note note)
{
await _mediator.Send(new NewNoteCommand(mapName, note, UserId));
}
[HttpPost("room")]
public async Task Post(string mapName, [FromBody] Room room)
public async Task Post(string campaign, string mapName, [FromBody] Room room)
{
await _mediator.Send(new NewRoomCommand(mapName, room, UserId));
}
[HttpPost("line")]
public async Task Post(string mapName, [FromBody] Line line)
public async Task Post(string campaign, string mapName, [FromBody] Line line)
{
await _mediator.Send(new NewLineCommand(mapName, line, UserId));
}
[HttpDelete("overlay")]
public async Task Delete(string mapName, [FromBody] Overlay overlay)
public async Task Delete(string campaign, string mapName, [FromBody] Overlay overlay)
{
await _mediator.Send(new DeleteOverlayCommand(mapName, overlay, UserId));
}
[HttpDelete("wall")]
public async Task Delete(string mapName, [FromBody] Wall wall)
public async Task Delete(string campaign, string mapName, [FromBody] Wall wall)
{
await _mediator.Send(new DeleteWallCommand(mapName, wall, UserId));
}
[HttpDelete("note")]
public async Task Delete(string mapName, [FromBody] Note note)
public async Task Delete(string campaign, string mapName, [FromBody] Note note)
{
await _mediator.Send(new DeleteNoteCommand(mapName, note, UserId));
}

View File

@ -9,7 +9,7 @@ namespace Sledgemapper.Api.Models
public int MapLogId { get; set; }
[Required]
public int UserId{get;set;}
public string UserId{get;set;}
[Required]
public int SessionId { get; set; }

View File

@ -1,3 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Sledgemapper.Api.Models
@ -7,10 +8,13 @@ namespace Sledgemapper.Api.Models
[Key]
public int SessionId { get; set; }
[Required]
public Guid CampaignId { get; set; }
[Required]
public string SessionName { get; set; }
[Required]
public int OwnerUserId { get; set; }
public string OwnerUserId { get; set; }
}
}

View File

@ -28,10 +28,10 @@ namespace Sledgemapper.Api.Handlers
{
var user = await _dbcontext.Users.FindAsync(command.UserId);
_dbcontext.Attach(user);
var campaigns = _dbcontext.Campaigns.Include(c => c.InvitedUsers).Include(c => c.Owner).Where(campaign => campaign.OwnerId == command.UserId || campaign.InvitedUsers.Contains(user));
var campaigns = _dbcontext.Campaigns.Include(c => c.InvitedUsers).Include(c => c.Maps).Include(c => c.Owner).Where(campaign => campaign.OwnerId == command.UserId || campaign.InvitedUsers.Contains(user));
return campaigns.
Select(c => new Shared.Entities.Campaign { Id = c.CampaignId, Name = c.CampaignName, Maps = c.Maps.Select(m => new Shared.Entities.Map { SessionName = m.MapName }).ToList()})
Select(c => new Shared.Entities.Campaign { Id = c.CampaignId, Name = c.CampaignName, Maps = c.Maps.Select(m => new Shared.Entities.Map { SessionName = m.MapName }).ToList() })
.ToList();
}
catch (Exception ex)

View File

@ -2,6 +2,7 @@ using MediatR;
using Sledgemapper.Api.Commands;
using Sledgemapper.Api.Infrastructure.Data;
using Sledgemapper.Api.Models;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -20,10 +21,14 @@ namespace Sledgemapper.Api.Handlers
public async Task<bool> Handle(NewSessionCommand notification, CancellationToken cancellationToken)
{
var campaign = _dbcontext.Campaigns.First(c => c.CampaignName == notification.Campaign && c.OwnerId == notification.UserId.ToString());
_dbcontext.Sessions.Add(new Session
{
SessionName = notification.SessionName,
OwnerUserId = notification.UserId
OwnerUserId = notification.UserId,
CampaignId = campaign.CampaignId
});
await _dbcontext.SaveChangesAsync();
return true;

View File

@ -0,0 +1,506 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Sledgemapper.Api.Infrastructure.Data;
namespace Sledgemapper.Api.Migrations
{
[DbContext(typeof(SledgemapperDbContext))]
[Migration("20210830220131_AddCampaignToMap")]
partial class AddCampaignToMap
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.6");
modelBuilder.Entity("CampaignUser", b =>
{
b.Property<Guid>("CampaignsCampaignId")
.HasColumnType("TEXT");
b.Property<string>("InvitedUsersId")
.HasColumnType("TEXT");
b.HasKey("CampaignsCampaignId", "InvitedUsersId");
b.HasIndex("InvitedUsersId");
b.ToTable("CampaignUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Property<Guid>("CampaignId")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CampaignName")
.HasColumnType("TEXT");
b.Property<string>("OwnerId")
.HasColumnType("TEXT");
b.HasKey("CampaignId");
b.HasIndex("OwnerId");
b.HasIndex("CampaignName", "OwnerId")
.IsUnique();
b.ToTable("Campaigns");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.Property<int>("MapId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CampaignId")
.HasColumnType("INTEGER");
b.Property<Guid?>("CampaignId1")
.HasColumnType("TEXT");
b.Property<string>("MapName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MapId");
b.HasIndex("CampaignId1");
b.ToTable("Maps");
});
modelBuilder.Entity("Sledgemapper.Api.Models.MapLog", b =>
{
b.Property<int>("MapLogId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Object")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("Operation")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("TEXT");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<double>("Timestamp")
.HasColumnType("REAL");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("MapLogId");
b.ToTable("MapLogs");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Session", b =>
{
b.Property<int>("SessionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CampaignId")
.HasColumnType("INTEGER");
b.Property<int>("OwnerUserId")
.HasColumnType("INTEGER");
b.Property<string>("SessionName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("SessionId");
b.ToTable("Sessions");
});
modelBuilder.Entity("Sledgemapper.Api.Models.SessionUser", b =>
{
b.Property<int>("SessionUserId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("SessionUserId");
b.ToTable("SessionUsers");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Snapshot", b =>
{
b.Property<int>("SnapshotId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Object")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<double>("Timestamp")
.HasColumnType("REAL");
b.HasKey("SnapshotId");
b.ToTable("Snapshots");
});
modelBuilder.Entity("Sledgemapper.Api.Models.UserConnection", b =>
{
b.Property<int>("UserConnectionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ConnectionId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("UserConnectionId");
b.ToTable("UserConnections");
});
modelBuilder.Entity("Sledgemapper.Entities.User", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<string>("FirstName")
.HasColumnType("TEXT");
b.Property<string>("Initials")
.HasColumnType("TEXT");
b.Property<string>("LastName")
.HasColumnType("TEXT");
b.Property<byte[]>("PasswordSalt")
.HasColumnType("BLOB");
b.ToTable("Users");
});
modelBuilder.Entity("CampaignUser", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany()
.HasForeignKey("CampaignsCampaignId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Sledgemapper.Entities.User", null)
.WithMany()
.HasForeignKey("InvitedUsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.HasOne("Sledgemapper.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId");
b.Navigation("Owner");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany("Maps")
.HasForeignKey("CampaignId1");
});
modelBuilder.Entity("Sledgemapper.Entities.User", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithOne()
.HasForeignKey("Sledgemapper.Entities.User", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Navigation("Maps");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Sledgemapper.Api.Migrations
{
public partial class AddCampaignToMap : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CampaignId",
table: "Sessions",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CampaignId",
table: "Sessions");
}
}
}

View File

@ -0,0 +1,506 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Sledgemapper.Api.Infrastructure.Data;
namespace Sledgemapper.Api.Migrations
{
[DbContext(typeof(SledgemapperDbContext))]
[Migration("20210830220730_AddCampaignToMapGuid")]
partial class AddCampaignToMapGuid
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.6");
modelBuilder.Entity("CampaignUser", b =>
{
b.Property<Guid>("CampaignsCampaignId")
.HasColumnType("TEXT");
b.Property<string>("InvitedUsersId")
.HasColumnType("TEXT");
b.HasKey("CampaignsCampaignId", "InvitedUsersId");
b.HasIndex("InvitedUsersId");
b.ToTable("CampaignUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Property<Guid>("CampaignId")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CampaignName")
.HasColumnType("TEXT");
b.Property<string>("OwnerId")
.HasColumnType("TEXT");
b.HasKey("CampaignId");
b.HasIndex("OwnerId");
b.HasIndex("CampaignName", "OwnerId")
.IsUnique();
b.ToTable("Campaigns");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.Property<int>("MapId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CampaignId")
.HasColumnType("INTEGER");
b.Property<Guid?>("CampaignId1")
.HasColumnType("TEXT");
b.Property<string>("MapName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MapId");
b.HasIndex("CampaignId1");
b.ToTable("Maps");
});
modelBuilder.Entity("Sledgemapper.Api.Models.MapLog", b =>
{
b.Property<int>("MapLogId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Object")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("Operation")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("TEXT");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<double>("Timestamp")
.HasColumnType("REAL");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("MapLogId");
b.ToTable("MapLogs");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Session", b =>
{
b.Property<int>("SessionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid>("CampaignId")
.HasColumnType("TEXT");
b.Property<int>("OwnerUserId")
.HasColumnType("INTEGER");
b.Property<string>("SessionName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("SessionId");
b.ToTable("Sessions");
});
modelBuilder.Entity("Sledgemapper.Api.Models.SessionUser", b =>
{
b.Property<int>("SessionUserId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("SessionUserId");
b.ToTable("SessionUsers");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Snapshot", b =>
{
b.Property<int>("SnapshotId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Object")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<double>("Timestamp")
.HasColumnType("REAL");
b.HasKey("SnapshotId");
b.ToTable("Snapshots");
});
modelBuilder.Entity("Sledgemapper.Api.Models.UserConnection", b =>
{
b.Property<int>("UserConnectionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ConnectionId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("UserConnectionId");
b.ToTable("UserConnections");
});
modelBuilder.Entity("Sledgemapper.Entities.User", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<string>("FirstName")
.HasColumnType("TEXT");
b.Property<string>("Initials")
.HasColumnType("TEXT");
b.Property<string>("LastName")
.HasColumnType("TEXT");
b.Property<byte[]>("PasswordSalt")
.HasColumnType("BLOB");
b.ToTable("Users");
});
modelBuilder.Entity("CampaignUser", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany()
.HasForeignKey("CampaignsCampaignId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Sledgemapper.Entities.User", null)
.WithMany()
.HasForeignKey("InvitedUsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.HasOne("Sledgemapper.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId");
b.Navigation("Owner");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany("Maps")
.HasForeignKey("CampaignId1");
});
modelBuilder.Entity("Sledgemapper.Entities.User", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithOne()
.HasForeignKey("Sledgemapper.Entities.User", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Navigation("Maps");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Sledgemapper.Api.Migrations
{
public partial class AddCampaignToMapGuid : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<Guid>(
name: "CampaignId",
table: "Sessions",
type: "TEXT",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "CampaignId",
table: "Sessions",
type: "INTEGER",
nullable: false,
oldClrType: typeof(Guid),
oldType: "TEXT");
}
}
}

View File

@ -0,0 +1,508 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Sledgemapper.Api.Infrastructure.Data;
namespace Sledgemapper.Api.Migrations
{
[DbContext(typeof(SledgemapperDbContext))]
[Migration("20210830222316_StringUserId")]
partial class StringUserId
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.6");
modelBuilder.Entity("CampaignUser", b =>
{
b.Property<Guid>("CampaignsCampaignId")
.HasColumnType("TEXT");
b.Property<string>("InvitedUsersId")
.HasColumnType("TEXT");
b.HasKey("CampaignsCampaignId", "InvitedUsersId");
b.HasIndex("InvitedUsersId");
b.ToTable("CampaignUser");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Property<Guid>("CampaignId")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("CampaignName")
.HasColumnType("TEXT");
b.Property<string>("OwnerId")
.HasColumnType("TEXT");
b.HasKey("CampaignId");
b.HasIndex("OwnerId");
b.HasIndex("CampaignName", "OwnerId")
.IsUnique();
b.ToTable("Campaigns");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.Property<int>("MapId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CampaignId")
.HasColumnType("INTEGER");
b.Property<Guid?>("CampaignId1")
.HasColumnType("TEXT");
b.Property<string>("MapName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MapId");
b.HasIndex("CampaignId1");
b.ToTable("Maps");
});
modelBuilder.Entity("Sledgemapper.Api.Models.MapLog", b =>
{
b.Property<int>("MapLogId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Object")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("Operation")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("TEXT");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<double>("Timestamp")
.HasColumnType("REAL");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MapLogId");
b.ToTable("MapLogs");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Session", b =>
{
b.Property<int>("SessionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid>("CampaignId")
.HasColumnType("TEXT");
b.Property<string>("OwnerUserId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SessionName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("SessionId");
b.ToTable("Sessions");
});
modelBuilder.Entity("Sledgemapper.Api.Models.SessionUser", b =>
{
b.Property<int>("SessionUserId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("SessionUserId");
b.ToTable("SessionUsers");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Snapshot", b =>
{
b.Property<int>("SnapshotId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Object")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("SessionId")
.HasColumnType("INTEGER");
b.Property<double>("Timestamp")
.HasColumnType("REAL");
b.HasKey("SnapshotId");
b.ToTable("Snapshots");
});
modelBuilder.Entity("Sledgemapper.Api.Models.UserConnection", b =>
{
b.Property<int>("UserConnectionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ConnectionId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("UserConnectionId");
b.ToTable("UserConnections");
});
modelBuilder.Entity("Sledgemapper.Entities.User", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<string>("FirstName")
.HasColumnType("TEXT");
b.Property<string>("Initials")
.HasColumnType("TEXT");
b.Property<string>("LastName")
.HasColumnType("TEXT");
b.Property<byte[]>("PasswordSalt")
.HasColumnType("BLOB");
b.ToTable("Users");
});
modelBuilder.Entity("CampaignUser", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany()
.HasForeignKey("CampaignsCampaignId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Sledgemapper.Entities.User", null)
.WithMany()
.HasForeignKey("InvitedUsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.HasOne("Sledgemapper.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId");
b.Navigation("Owner");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany("Maps")
.HasForeignKey("CampaignId1");
});
modelBuilder.Entity("Sledgemapper.Entities.User", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithOne()
.HasForeignKey("Sledgemapper.Entities.User", "Id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Navigation("Maps");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Sledgemapper.Api.Migrations
{
public partial class StringUserId : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "OwnerUserId",
table: "Sessions",
type: "TEXT",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AlterColumn<string>(
name: "UserId",
table: "MapLogs",
type: "TEXT",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "OwnerUserId",
table: "Sessions",
type: "INTEGER",
nullable: false,
oldClrType: typeof(string),
oldType: "TEXT");
migrationBuilder.AlterColumn<int>(
name: "UserId",
table: "MapLogs",
type: "INTEGER",
nullable: false,
oldClrType: typeof(string),
oldType: "TEXT");
}
}
}

View File

@ -299,8 +299,9 @@ namespace Sledgemapper.Api.Migrations
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MapLogId");
@ -313,8 +314,12 @@ namespace Sledgemapper.Api.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("OwnerUserId")
.HasColumnType("INTEGER");
b.Property<Guid>("CampaignId")
.HasColumnType("TEXT");
b.Property<string>("OwnerUserId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SessionName")
.IsRequired()

View File

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

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Note Note { get; private set; }
public DeleteNoteNotification(Models.Session session, Note note, int userId) : base(session, userId)
public DeleteNoteNotification(Models.Session session, Note note, string userId) : base(session, userId)
{
Note = note;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Overlay Overlay { get; private set; }
public DeleteOverlayNotification(Models.Session session, Overlay overlay, int userId) : base(session, userId)
public DeleteOverlayNotification(Models.Session session, Overlay overlay, string userId) : base(session, userId)
{
Overlay = overlay;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Tile Tile { get; private set; }
public DeleteTileNotification(Models.Session session, Tile tile, int userId) : base(session, userId)
public DeleteTileNotification(Models.Session session, Tile tile, string userId) : base(session, userId)
{
Tile = tile;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Wall Wall { get; private set; }
public DeleteWallNotification(Models.Session session, Wall wall, int userId) : base(session, userId)
public DeleteWallNotification(Models.Session session, Wall wall, string userId) : base(session, userId)
{
Wall = wall;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Line Line { get; private set; }
public NewLineNotification(Models.Session session, Line line, int userId) : base(session, userId)
public NewLineNotification(Models.Session session, Line line, string userId) : base(session, userId)
{
Line = line;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Note Note { get; private set; }
public NewNoteNotification(Models.Session session, Note note, int userId) : base(session, userId)
public NewNoteNotification(Models.Session session, Note note, string userId) : base(session, userId)
{
Note = note;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Overlay Overlay { get; private set; }
public NewOverlayNotification(Models.Session session, Overlay overlay, int userId) : base(session, userId)
public NewOverlayNotification(Models.Session session, Overlay overlay, string userId) : base(session, userId)
{
Overlay = overlay;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Room Room { get; private set; }
public NewRoomNotification(Models.Session session, Room room, int userId) : base(session, userId)
public NewRoomNotification(Models.Session session, Room room, string userId) : base(session, userId)
{
Room = room;
}

View File

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

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Tile Tile { get; private set; }
public NewTileNotification(Models.Session session, Tile tile, int userId) : base(session, userId)
public NewTileNotification(Models.Session session, Tile tile, string userId) : base(session, userId)
{
Tile = tile;
}

View File

@ -6,7 +6,7 @@ namespace Sledgemapper.Api.Notifications
{
public Wall Wall { get; private set; }
public NewWallNotification(Models.Session session, Wall wall, int userId) : base(session, userId)
public NewWallNotification(Models.Session session, Wall wall, string userId) : base(session, userId)
{
Wall = wall;
}