From efe9f9b8c3da677b1ac87f79de8bde905601f44b Mon Sep 17 00:00:00 2001 From: Tomasi - Developing Date: Thu, 16 Jan 2025 16:25:21 +0100 Subject: [PATCH] Dismiss player function --- Api/Controllers/v1/PlayersController.cs | 72 +- .../Player/DismissPlayerDto.cs | 14 + .../DataTransferObjects/Player/PlayerDto.cs | 10 +- .../Player/ReactivatePlayerDto.cs | 9 + Application/Interfaces/IPlayerRepository.cs | 6 + Application/Profiles/PlayerProfile.cs | 1 + Application/Repositories/PlayerRepository.cs | 82 ++ .../Configurations/PlayerConfiguration.cs | 5 + Database/Entities/Player.cs | 6 + ...50116122344_AddDismissToPlayer.Designer.cs | 1182 +++++++++++++++++ .../20250116122344_AddDismissToPlayer.cs | 88 ++ .../ApplicationContextModelSnapshot.cs | 18 +- Ui/src/app/app-routing.module.ts | 2 + Ui/src/app/app.module.ts | 4 +- .../app/navigation/navigation.component.html | 5 + .../dismiss-player.component.css | 0 .../dismiss-player.component.html | 5 + .../dismiss-player.component.ts | 10 + Ui/src/app/pages/player/player.component.html | 2 +- Ui/src/app/pages/player/player.component.ts | 23 +- Ui/src/app/services/player.service.ts | 8 + 21 files changed, 1533 insertions(+), 19 deletions(-) create mode 100644 Application/DataTransferObjects/Player/DismissPlayerDto.cs create mode 100644 Application/DataTransferObjects/Player/ReactivatePlayerDto.cs create mode 100644 Database/Migrations/20250116122344_AddDismissToPlayer.Designer.cs create mode 100644 Database/Migrations/20250116122344_AddDismissToPlayer.cs create mode 100644 Ui/src/app/pages/dismiss-player/dismiss-player.component.css create mode 100644 Ui/src/app/pages/dismiss-player/dismiss-player.component.html create mode 100644 Ui/src/app/pages/dismiss-player/dismiss-player.component.ts diff --git a/Api/Controllers/v1/PlayersController.cs b/Api/Controllers/v1/PlayersController.cs index 70f7c28..fa5ca23 100644 --- a/Api/Controllers/v1/PlayersController.cs +++ b/Api/Controllers/v1/PlayersController.cs @@ -33,8 +33,7 @@ namespace Api.Controllers.v1 } [HttpGet("Alliance/{allianceId:guid}")] - public async Task>> GetAlliancePlayers(Guid allianceId, - CancellationToken cancellationToken) + public async Task>> GetAlliancePlayers(Guid allianceId, CancellationToken cancellationToken) { try { @@ -54,6 +53,27 @@ namespace Api.Controllers.v1 } } + [HttpGet("Alliance/dismiss/{allianceId:guid}")] + public async Task>> GetAllianceDismissPlayers(Guid allianceId, CancellationToken cancellationToken) + { + try + { + var allianceDismissPlayersResult = + await playerRepository.GetAllianceDismissPlayersAsync(allianceId, cancellationToken); + + if (allianceDismissPlayersResult.IsFailure) return BadRequest(allianceDismissPlayersResult.Error); + + return allianceDismissPlayersResult.Value.Count > 0 + ? Ok(allianceDismissPlayersResult.Value) + : NoContent(); + } + catch (Exception e) + { + logger.LogError(e, e.Message); + return StatusCode(StatusCodes.Status500InternalServerError); + } + } + [AllowAnonymous] [HttpGet("[action]/{allianceId:guid}")] public async Task>> GetAllianceMvpPlayers(Guid allianceId, @@ -101,8 +121,7 @@ namespace Api.Controllers.v1 } [HttpPost] - public async Task> CreatePlayer(CreatePlayerDto createPlayerDto, - CancellationToken cancellationToken) + public async Task> CreatePlayer(CreatePlayerDto createPlayerDto, CancellationToken cancellationToken) { try { @@ -143,6 +162,51 @@ namespace Api.Controllers.v1 } } + [HttpPut("{playerId:guid}/dismiss")] + public async Task> DismissPlayer(Guid playerId, DismissPlayerDto dismissPlayerDto, + CancellationToken cancellationToken) + { + try + { + if (!ModelState.IsValid) return UnprocessableEntity(ModelState); + + if (playerId != dismissPlayerDto.Id) return Conflict(PlayerErrors.IdConflict); + + var dismissResult = await playerRepository.DismissPlayerAsync(dismissPlayerDto, claimTypeService.GetFullName(User), cancellationToken); + + return dismissResult.IsFailure + ? BadRequest(dismissResult.Error) + : Ok(dismissResult.Value); + } + catch (Exception e) + { + logger.LogError(e, e.Message); + return StatusCode(StatusCodes.Status500InternalServerError); + } + } + + [HttpPut("{playerId:guid}/reactive")] + public async Task> ReactivePlayer(Guid playerId, ReactivatePlayerDto reactivatePlayerDto, CancellationToken cancellationToken) + { + try + { + if (!ModelState.IsValid) return UnprocessableEntity(ModelState); + + if (playerId != reactivatePlayerDto.Id) return Conflict(PlayerErrors.IdConflict); + + var reactiveResult = await playerRepository.ReactivatePlayerAsync(reactivatePlayerDto, claimTypeService.GetFullName(User), cancellationToken); + + return reactiveResult.IsFailure + ? BadRequest(reactiveResult.Error) + : Ok(reactiveResult.Value); + } + catch (Exception e) + { + logger.LogError(e, e.Message); + return StatusCode(StatusCodes.Status500InternalServerError); + } + } + [HttpDelete("{playerId:guid}")] public async Task> DeletePlayer(Guid playerId, CancellationToken cancellationToken) { diff --git a/Application/DataTransferObjects/Player/DismissPlayerDto.cs b/Application/DataTransferObjects/Player/DismissPlayerDto.cs new file mode 100644 index 0000000..01213b2 --- /dev/null +++ b/Application/DataTransferObjects/Player/DismissPlayerDto.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace Application.DataTransferObjects.Player; + +public class DismissPlayerDto +{ + [Required] + public Guid Id { get; set; } + + [Required] + [MaxLength(255)] + public required string DismissalReason { get; set; } + +} \ No newline at end of file diff --git a/Application/DataTransferObjects/Player/PlayerDto.cs b/Application/DataTransferObjects/Player/PlayerDto.cs index 99980cb..a40f334 100644 --- a/Application/DataTransferObjects/Player/PlayerDto.cs +++ b/Application/DataTransferObjects/Player/PlayerDto.cs @@ -1,6 +1,4 @@ -using System.Runtime.InteropServices.JavaScript; - -namespace Application.DataTransferObjects.Player; +namespace Application.DataTransferObjects.Player; public class PlayerDto { @@ -27,4 +25,10 @@ public class PlayerDto public DateTime? ModifiedOn { get; set; } public string? ModifiedBy { get; set; } + + public bool IsDismissed { get; set; } + + public DateTime? DismissedAt { get; set; } + + public string? DismissalReason { get; set; } } \ No newline at end of file diff --git a/Application/DataTransferObjects/Player/ReactivatePlayerDto.cs b/Application/DataTransferObjects/Player/ReactivatePlayerDto.cs new file mode 100644 index 0000000..f6159c1 --- /dev/null +++ b/Application/DataTransferObjects/Player/ReactivatePlayerDto.cs @@ -0,0 +1,9 @@ +using System.ComponentModel.DataAnnotations; + +namespace Application.DataTransferObjects.Player; + +public class ReactivatePlayerDto +{ + [Required] + public Guid Id { get; set; } +} \ No newline at end of file diff --git a/Application/Interfaces/IPlayerRepository.cs b/Application/Interfaces/IPlayerRepository.cs index 8b3a7b9..d9d3c80 100644 --- a/Application/Interfaces/IPlayerRepository.cs +++ b/Application/Interfaces/IPlayerRepository.cs @@ -9,6 +9,8 @@ public interface IPlayerRepository Task>> GetAlliancePlayersAsync(Guid allianceId, CancellationToken cancellationToken); + Task>> GetAllianceDismissPlayersAsync(Guid allianceId, CancellationToken cancellationToken); + Task>> GetAlliancePlayersMvp(Guid allianceId, CancellationToken cancellationToken); Task>> GetAllianceLeadershipMvp(Guid allianceId, CancellationToken cancellationToken); @@ -17,5 +19,9 @@ public interface IPlayerRepository Task> UpdatePlayerAsync(UpdatePlayerDto updatePlayerDto, string modifiedBy, CancellationToken cancellationToken); + Task> DismissPlayerAsync(DismissPlayerDto dismissPlayerDto, string modifiedBy, CancellationToken cancellationToken); + + Task> ReactivatePlayerAsync(ReactivatePlayerDto reactivatePlayerDto, string modifiedBy, CancellationToken cancellationToken); + Task> DeletePlayerAsync(Guid playerIId, CancellationToken cancellationToken); } \ No newline at end of file diff --git a/Application/Profiles/PlayerProfile.cs b/Application/Profiles/PlayerProfile.cs index a37ffd9..ade9c03 100644 --- a/Application/Profiles/PlayerProfile.cs +++ b/Application/Profiles/PlayerProfile.cs @@ -15,6 +15,7 @@ public class PlayerProfile : Profile CreateMap() .ForMember(des => des.Id, opt => opt.MapFrom(src => Guid.CreateVersion7())) + .ForMember(des => des.IsDismissed, opt => opt.MapFrom(src => false)) .ForMember(des => des.CreatedOn, opt => opt.MapFrom(src => DateTime.Now)); CreateMap() diff --git a/Application/Repositories/PlayerRepository.cs b/Application/Repositories/PlayerRepository.cs index bd5168a..189a507 100644 --- a/Application/Repositories/PlayerRepository.cs +++ b/Application/Repositories/PlayerRepository.cs @@ -36,6 +36,18 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge return Result.Success(alliancePlayers); } + public async Task>> GetAllianceDismissPlayersAsync(Guid allianceId, CancellationToken cancellationToken) + { + var dismissAlliancePlayers = await context.Players + .IgnoreQueryFilters() + .ProjectTo(mapper.ConfigurationProvider) + .AsNoTracking() + .Where(player => player.AllianceId == allianceId && player.IsDismissed) + .ToListAsync(cancellationToken); + + return Result.Success(dismissAlliancePlayers); + } + public async Task>> GetAlliancePlayersMvp(Guid allianceId, CancellationToken cancellationToken) { var currentDate = DateTime.Now; @@ -133,6 +145,7 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge return playerMvps; } + public async Task> CreatePlayerAsync(CreatePlayerDto createPlayerDto, string createdBy, CancellationToken cancellationToken) { var newPlayer = mapper.Map(createPlayerDto); @@ -174,9 +187,78 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge } } + public async Task> DismissPlayerAsync(DismissPlayerDto dismissPlayerDto, string modifiedBy, CancellationToken cancellationToken) + { + var playerToDismiss = await context.Players + .FirstOrDefaultAsync(player => player.Id == dismissPlayerDto.Id, cancellationToken); + + if (playerToDismiss is null) return Result.Failure(PlayerErrors.NotFound); + + playerToDismiss.IsDismissed = true; + playerToDismiss.DismissedAt = DateTime.Now; + playerToDismiss.DismissalReason = dismissPlayerDto.DismissalReason; + playerToDismiss.ModifiedOn = DateTime.Now; + playerToDismiss.ModifiedBy = modifiedBy; + + playerToDismiss.Admonitions.Add(new Admonition() + { + CreatedBy = modifiedBy, + Reason = $"Player was dismiss from the alliance by {modifiedBy}. Reason: {dismissPlayerDto.DismissalReason}", + CreatedOn = DateTime.Now, + PlayerId = playerToDismiss.Id, + Id = Guid.CreateVersion7() + }); + + try + { + await context.SaveChangesAsync(cancellationToken); + return Result.Success(mapper.Map(playerToDismiss)); + } + catch (Exception e) + { + logger.LogError(e, e.Message); + return Result.Failure(GeneralErrors.DatabaseError); + } + } + + public async Task> ReactivatePlayerAsync(ReactivatePlayerDto reactivatePlayerDto, string modifiedBy, CancellationToken cancellationToken) + { + var playerToReactivate = await context.Players + .IgnoreQueryFilters() + .FirstOrDefaultAsync(player => player.Id == reactivatePlayerDto.Id, cancellationToken); + + if (playerToReactivate is null) return Result.Failure(PlayerErrors.NotFound); + + playerToReactivate.IsDismissed = false; + playerToReactivate.DismissedAt = null; + playerToReactivate.DismissalReason = null; + playerToReactivate.ModifiedOn = DateTime.Now; + playerToReactivate.ModifiedBy = modifiedBy; + + playerToReactivate.Notes.Add(new Note() + { + CreatedBy = modifiedBy, + PlayerNote = $"Player was accepted back into the alliance by {modifiedBy}", + CreatedOn = DateTime.Now, + Id = Guid.CreateVersion7() + }); + + try + { + await context.SaveChangesAsync(cancellationToken); + return Result.Success(mapper.Map(playerToReactivate)); + } + catch (Exception e) + { + logger.LogError(e, e.Message); + return Result.Failure(GeneralErrors.DatabaseError); + } + } + public async Task> DeletePlayerAsync(Guid playerIId, CancellationToken cancellationToken) { var playerToDelete = await context.Players + .IgnoreQueryFilters() .FirstOrDefaultAsync(player => player.Id == playerIId, cancellationToken); if (playerToDelete is null) return Result.Failure(PlayerErrors.NotFound); diff --git a/Database/Configurations/PlayerConfiguration.cs b/Database/Configurations/PlayerConfiguration.cs index c341d29..db5d02c 100644 --- a/Database/Configurations/PlayerConfiguration.cs +++ b/Database/Configurations/PlayerConfiguration.cs @@ -17,6 +17,11 @@ public class PlayerConfiguration : IEntityTypeConfiguration builder.Property(player => player.CreatedBy).IsRequired().HasMaxLength(150); builder.Property(player => player.ModifiedOn).IsRequired(false); builder.Property(player => player.ModifiedBy).IsRequired(false).HasMaxLength(150); + builder.Property(player => player.IsDismissed).IsRequired().HasDefaultValue(false); + builder.Property(player => player.DismissedAt).IsRequired(false); + builder.Property(player => player.DismissalReason).IsRequired(false).HasMaxLength(255); + + builder.HasQueryFilter(player => !player.IsDismissed); builder.HasOne(player => player.Alliance) .WithMany(alliance => alliance.Players) diff --git a/Database/Entities/Player.cs b/Database/Entities/Player.cs index 5f319b6..e09e6aa 100644 --- a/Database/Entities/Player.cs +++ b/Database/Entities/Player.cs @@ -22,6 +22,12 @@ public class Player : BaseEntity public string? ModifiedBy { get; set; } + public bool IsDismissed { get; set; } + + public DateTime? DismissedAt { get; set; } + + public string? DismissalReason { get; set; } + public ICollection DesertStormParticipants { get; set; } = []; public ICollection VsDuelParticipants { get; set; } = []; diff --git a/Database/Migrations/20250116122344_AddDismissToPlayer.Designer.cs b/Database/Migrations/20250116122344_AddDismissToPlayer.Designer.cs new file mode 100644 index 0000000..39cc282 --- /dev/null +++ b/Database/Migrations/20250116122344_AddDismissToPlayer.Designer.cs @@ -0,0 +1,1182 @@ +// +using System; +using Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Database.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20250116122344_AddDismissToPlayer")] + partial class AddDismissToPlayer + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("dbo") + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Database.Entities.Admonition", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("PlayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Reason") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("Id"); + + b.HasIndex("PlayerId"); + + b.ToTable("Admonitions", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.Alliance", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Abbreviation") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Server") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Alliances", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.CustomEvent", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("EventDate") + .HasColumnType("datetime2"); + + b.Property("IsInProgress") + .HasColumnType("bit"); + + b.Property("IsParticipationEvent") + .HasColumnType("bit"); + + b.Property("IsPointsEvent") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.ToTable("CustomEvents", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.CustomEventParticipant", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AchievedPoints") + .HasColumnType("bigint"); + + b.Property("CustomEventId") + .HasColumnType("uniqueidentifier"); + + b.Property("Participated") + .HasColumnType("bit"); + + b.Property("PlayerId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CustomEventId"); + + b.HasIndex("PlayerId"); + + b.ToTable("CustomEventParticipants", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.DesertStorm", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("EventDate") + .HasColumnType("datetime2"); + + b.Property("IsInProgress") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("OpponentName") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("OpponentServer") + .HasColumnType("int"); + + b.Property("OpposingParticipants") + .HasColumnType("int"); + + b.Property("Won") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.ToTable("DesertStorms", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.DesertStormParticipant", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DesertStormId") + .HasColumnType("uniqueidentifier"); + + b.Property("Participated") + .HasColumnType("bit"); + + b.Property("PlayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Registered") + .HasColumnType("bit"); + + b.Property("StartPlayer") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("DesertStormId"); + + b.HasIndex("PlayerId"); + + b.ToTable("DesertStormParticipants", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.MarshalGuard", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceId") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceSize") + .HasColumnType("int"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("EventDate") + .HasColumnType("datetime2"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("RewardPhase") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.ToTable("MarshalGuards", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.MarshalGuardParticipant", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("MarshalGuardId") + .HasColumnType("uniqueidentifier"); + + b.Property("Participated") + .HasColumnType("bit"); + + b.Property("PlayerId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("MarshalGuardId"); + + b.HasIndex("PlayerId"); + + b.ToTable("MarshalGuardParticipants", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.Note", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("PlayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("PlayerNote") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("PlayerId"); + + b.ToTable("Notes", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.Player", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("CreatedOn") + .HasColumnType("datetime2"); + + b.Property("DismissalReason") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DismissedAt") + .HasColumnType("datetime2"); + + b.Property("IsDismissed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("PlayerName") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("RankId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("RankId"); + + b.ToTable("Players", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.Rank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.HasKey("Id"); + + b.ToTable("Ranks", "dbo"); + + b.HasData( + new + { + Id = new Guid("b1c10a1c-5cf3-4e22-9fc1-d9b165b85dd3"), + Name = "R5" + }, + new + { + Id = new Guid("0fc2f68a-0a4d-4922-981e-c624e4c39024"), + Name = "R4" + }, + new + { + Id = new Guid("4970e1f5-f7f5-43e8-88cc-7f8fc4075418"), + Name = "R3" + }, + new + { + Id = new Guid("d8d0c587-f269-45ff-b13e-4631298bf0af"), + Name = "R2" + }, + new + { + Id = new Guid("326edef0-5074-43a5-9db9-edc71221a0f7"), + Name = "R1" + }); + }); + + modelBuilder.Entity("Database.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("AllianceId") + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("PlayerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.ToTable("Users", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.VsDuel", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("EventDate") + .HasColumnType("datetime2"); + + b.Property("IsInProgress") + .HasColumnType("bit"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.Property("OpponentName") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("OpponentPower") + .HasColumnType("bigint"); + + b.Property("OpponentServer") + .HasColumnType("int"); + + b.Property("OpponentSize") + .HasColumnType("int"); + + b.Property("VsDuelLeagueId") + .HasColumnType("uniqueidentifier"); + + b.Property("Won") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("VsDuelLeagueId"); + + b.ToTable("VsDuels", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.VsDuelLeague", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.HasKey("Id"); + + b.ToTable("VsDuelLeagues", "dbo"); + + b.HasData( + new + { + Id = new Guid("01946f11-c5f1-771e-8600-331582290457"), + Code = 1, + Name = "Silver League" + }, + new + { + Id = new Guid("01946f11-c5f1-7576-b861-14df423f92f2"), + Code = 2, + Name = "Gold League" + }, + new + { + Id = new Guid("01946f11-c5f1-750f-b3f5-61ec7a00f837"), + Code = 3, + Name = "Diamond League" + }); + }); + + modelBuilder.Entity("Database.Entities.VsDuelParticipant", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("PlayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("VsDuelId") + .HasColumnType("uniqueidentifier"); + + b.Property("WeeklyPoints") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("PlayerId"); + + b.HasIndex("VsDuelId"); + + b.ToTable("VsDuelParticipants", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.ZombieSiege", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceId") + .HasColumnType("uniqueidentifier"); + + b.Property("AllianceSize") + .HasColumnType("int"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("EventDate") + .HasColumnType("datetime2"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("ModifiedBy") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ModifiedOn") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.ToTable("ZombieSieges", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.ZombieSiegeParticipant", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("PlayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SurvivedWaves") + .HasColumnType("int"); + + b.Property("ZombieSiegeId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PlayerId"); + + b.HasIndex("ZombieSiegeId"); + + b.ToTable("ZombieSiegeParticipants", "dbo"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("Roles", "dbo"); + + b.HasData( + new + { + Id = new Guid("d8b9f882-95f0-4ba0-80ed-9c22c27ac88a"), + Name = "SystemAdministrator", + NormalizedName = "SYSTEMADMINISTRATOR" + }, + new + { + Id = new Guid("47de05ba-ff1e-46b6-9995-269084006c24"), + Name = "Administrator", + NormalizedName = "ADMINISTRATOR" + }, + new + { + Id = new Guid("5cc27946-5601-4a25-b9a9-75b8a11c0cf4"), + Name = "User", + NormalizedName = "USER" + }, + new + { + Id = new Guid("207bb0a3-ad50-49bb-bc41-b266fce66529"), + Name = "ReadOnly", + NormalizedName = "READONLY" + }); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "dbo"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserClaims", "dbo"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("UserLogins", "dbo"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "dbo"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("UserTokens", "dbo"); + }); + + modelBuilder.Entity("Database.Entities.Admonition", b => + { + b.HasOne("Database.Entities.Player", "Player") + .WithMany("Admonitions") + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("Database.Entities.CustomEvent", b => + { + b.HasOne("Database.Entities.Alliance", "Alliance") + .WithMany("CustomEvents") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + }); + + modelBuilder.Entity("Database.Entities.CustomEventParticipant", b => + { + b.HasOne("Database.Entities.CustomEvent", "CustomEvent") + .WithMany("CustomEventParticipants") + .HasForeignKey("CustomEventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Database.Entities.Player", "Player") + .WithMany("CustomEventParticipants") + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CustomEvent"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("Database.Entities.DesertStorm", b => + { + b.HasOne("Database.Entities.Alliance", "Alliance") + .WithMany("DesertStorms") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + }); + + modelBuilder.Entity("Database.Entities.DesertStormParticipant", b => + { + b.HasOne("Database.Entities.DesertStorm", "DesertStorm") + .WithMany("DesertStormParticipants") + .HasForeignKey("DesertStormId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Database.Entities.Player", "Player") + .WithMany("DesertStormParticipants") + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DesertStorm"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("Database.Entities.MarshalGuard", b => + { + b.HasOne("Database.Entities.Alliance", "Alliance") + .WithMany("MarshalGuards") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + }); + + modelBuilder.Entity("Database.Entities.MarshalGuardParticipant", b => + { + b.HasOne("Database.Entities.MarshalGuard", "MarshalGuard") + .WithMany("MarshalGuardParticipants") + .HasForeignKey("MarshalGuardId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Database.Entities.Player", "Player") + .WithMany("MarshalGuardParticipants") + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("MarshalGuard"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("Database.Entities.Note", b => + { + b.HasOne("Database.Entities.Player", "Player") + .WithMany("Notes") + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("Database.Entities.Player", b => + { + b.HasOne("Database.Entities.Alliance", "Alliance") + .WithMany("Players") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Database.Entities.Rank", "Rank") + .WithMany("Players") + .HasForeignKey("RankId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("Rank"); + }); + + modelBuilder.Entity("Database.Entities.User", b => + { + b.HasOne("Database.Entities.Alliance", "Alliance") + .WithMany("Users") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Alliance"); + }); + + modelBuilder.Entity("Database.Entities.VsDuel", b => + { + b.HasOne("Database.Entities.Alliance", "Alliance") + .WithMany("VsDuels") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Database.Entities.VsDuelLeague", "VsDuelLeague") + .WithMany("VsDuels") + .HasForeignKey("VsDuelLeagueId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Alliance"); + + b.Navigation("VsDuelLeague"); + }); + + modelBuilder.Entity("Database.Entities.VsDuelParticipant", b => + { + b.HasOne("Database.Entities.Player", "Player") + .WithMany("VsDuelParticipants") + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Database.Entities.VsDuel", "VsDuel") + .WithMany("VsDuelParticipants") + .HasForeignKey("VsDuelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Player"); + + b.Navigation("VsDuel"); + }); + + modelBuilder.Entity("Database.Entities.ZombieSiege", b => + { + b.HasOne("Database.Entities.Alliance", "Alliance") + .WithMany("ZombieSieges") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + }); + + modelBuilder.Entity("Database.Entities.ZombieSiegeParticipant", b => + { + b.HasOne("Database.Entities.Player", "Player") + .WithMany("ZombieSiegeParticipants") + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Database.Entities.ZombieSiege", "ZombieSiege") + .WithMany("ZombieSiegeParticipants") + .HasForeignKey("ZombieSiegeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Player"); + + b.Navigation("ZombieSiege"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Database.Entities.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Database.Entities.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Database.Entities.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Database.Entities.User", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Database.Entities.Alliance", b => + { + b.Navigation("CustomEvents"); + + b.Navigation("DesertStorms"); + + b.Navigation("MarshalGuards"); + + b.Navigation("Players"); + + b.Navigation("Users"); + + b.Navigation("VsDuels"); + + b.Navigation("ZombieSieges"); + }); + + modelBuilder.Entity("Database.Entities.CustomEvent", b => + { + b.Navigation("CustomEventParticipants"); + }); + + modelBuilder.Entity("Database.Entities.DesertStorm", b => + { + b.Navigation("DesertStormParticipants"); + }); + + modelBuilder.Entity("Database.Entities.MarshalGuard", b => + { + b.Navigation("MarshalGuardParticipants"); + }); + + modelBuilder.Entity("Database.Entities.Player", b => + { + b.Navigation("Admonitions"); + + b.Navigation("CustomEventParticipants"); + + b.Navigation("DesertStormParticipants"); + + b.Navigation("MarshalGuardParticipants"); + + b.Navigation("Notes"); + + b.Navigation("VsDuelParticipants"); + + b.Navigation("ZombieSiegeParticipants"); + }); + + modelBuilder.Entity("Database.Entities.Rank", b => + { + b.Navigation("Players"); + }); + + modelBuilder.Entity("Database.Entities.VsDuel", b => + { + b.Navigation("VsDuelParticipants"); + }); + + modelBuilder.Entity("Database.Entities.VsDuelLeague", b => + { + b.Navigation("VsDuels"); + }); + + modelBuilder.Entity("Database.Entities.ZombieSiege", b => + { + b.Navigation("ZombieSiegeParticipants"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Database/Migrations/20250116122344_AddDismissToPlayer.cs b/Database/Migrations/20250116122344_AddDismissToPlayer.cs new file mode 100644 index 0000000..766e64e --- /dev/null +++ b/Database/Migrations/20250116122344_AddDismissToPlayer.cs @@ -0,0 +1,88 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Database.Migrations +{ + /// + public partial class AddDismissToPlayer : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DismissalReason", + schema: "dbo", + table: "Players", + type: "nvarchar(255)", + maxLength: 255, + nullable: true); + + migrationBuilder.AddColumn( + name: "DismissedAt", + schema: "dbo", + table: "Players", + type: "datetime2", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsDismissed", + schema: "dbo", + table: "Players", + type: "bit", + nullable: false, + defaultValue: false); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + schema: "dbo", + table: "VsDuelLeagues", + keyColumn: "Id", + keyValue: new Guid("01946f11-c5f1-750f-b3f5-61ec7a00f837")); + + migrationBuilder.DeleteData( + schema: "dbo", + table: "VsDuelLeagues", + keyColumn: "Id", + keyValue: new Guid("01946f11-c5f1-7576-b861-14df423f92f2")); + + migrationBuilder.DeleteData( + schema: "dbo", + table: "VsDuelLeagues", + keyColumn: "Id", + keyValue: new Guid("01946f11-c5f1-771e-8600-331582290457")); + + migrationBuilder.DropColumn( + name: "DismissalReason", + schema: "dbo", + table: "Players"); + + migrationBuilder.DropColumn( + name: "DismissedAt", + schema: "dbo", + table: "Players"); + + migrationBuilder.DropColumn( + name: "IsDismissed", + schema: "dbo", + table: "Players"); + + migrationBuilder.InsertData( + schema: "dbo", + table: "VsDuelLeagues", + columns: new[] { "Id", "Code", "Name" }, + values: new object[,] + { + { new Guid("01938bf2-cf1b-742f-b3d6-824dbed7bf25"), 1, "Silver League" }, + { new Guid("01938bf2-cf1b-7a69-8607-87b1987a19b0"), 2, "Gold League" }, + { new Guid("01938bf2-cf1b-7cde-961e-e8cb35890551"), 3, "Diamond League" } + }); + } + } +} diff --git a/Database/Migrations/ApplicationContextModelSnapshot.cs b/Database/Migrations/ApplicationContextModelSnapshot.cs index b67e8dd..ac2b5ea 100644 --- a/Database/Migrations/ApplicationContextModelSnapshot.cs +++ b/Database/Migrations/ApplicationContextModelSnapshot.cs @@ -355,6 +355,18 @@ namespace Database.Migrations b.Property("CreatedOn") .HasColumnType("datetime2"); + b.Property("DismissalReason") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("DismissedAt") + .HasColumnType("datetime2"); + + b.Property("IsDismissed") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + b.Property("Level") .HasColumnType("int"); @@ -576,19 +588,19 @@ namespace Database.Migrations b.HasData( new { - Id = new Guid("01938bf2-cf1b-742f-b3d6-824dbed7bf25"), + Id = new Guid("01946f11-c5f1-771e-8600-331582290457"), Code = 1, Name = "Silver League" }, new { - Id = new Guid("01938bf2-cf1b-7a69-8607-87b1987a19b0"), + Id = new Guid("01946f11-c5f1-7576-b861-14df423f92f2"), Code = 2, Name = "Gold League" }, new { - Id = new Guid("01938bf2-cf1b-7cde-961e-e8cb35890551"), + Id = new Guid("01946f11-c5f1-750f-b3f5-61ec7a00f837"), Code = 3, Name = "Diamond League" }); diff --git a/Ui/src/app/app-routing.module.ts b/Ui/src/app/app-routing.module.ts index 11d8e13..f70d3a2 100644 --- a/Ui/src/app/app-routing.module.ts +++ b/Ui/src/app/app-routing.module.ts @@ -22,9 +22,11 @@ import {CustomEventComponent} from "./pages/custom-event/custom-event.component" import {ZombieSiegeComponent} from "./pages/zombie-siege/zombie-siege.component"; import {ZombieSiegeDetailComponent} from "./pages/zombie-siege/zombie-siege-detail/zombie-siege-detail.component"; import {CustomEventDetailComponent} from "./pages/custom-event/custom-event-detail/custom-event-detail.component"; +import {DismissPlayerComponent} from "./pages/dismiss-player/dismiss-player.component"; const routes: Routes = [ {path: 'players', component: PlayerComponent, canActivate: [authGuard]}, + {path: 'dismiss-players', component: DismissPlayerComponent, canActivate: [authGuard]}, {path: 'player-information/:id', component: PlayerInformationComponent, canActivate: [authGuard]}, {path: 'marshal-guard', component: MarshalGuardComponent, canActivate: [authGuard]}, {path: 'marshal-guard-detail/:id', component: MarshalGuardDetailComponent, canActivate: [authGuard]}, diff --git a/Ui/src/app/app.module.ts b/Ui/src/app/app.module.ts index 2bb8d6c..5aa3429 100644 --- a/Ui/src/app/app.module.ts +++ b/Ui/src/app/app.module.ts @@ -52,6 +52,7 @@ import { ZombieSiegeParticipantsModalComponent } from './modals/zombie-siege-par import { ZombieSiegeDetailComponent } from './pages/zombie-siege/zombie-siege-detail/zombie-siege-detail.component'; import { CustomEventParticipantsModelComponent } from './modals/custom-event-participants-model/custom-event-participants-model.component'; import { CustomEventDetailComponent } from './pages/custom-event/custom-event-detail/custom-event-detail.component'; +import { DismissPlayerComponent } from './pages/dismiss-player/dismiss-player.component'; @NgModule({ declarations: [ @@ -94,7 +95,8 @@ import { CustomEventDetailComponent } from './pages/custom-event/custom-event-de ZombieSiegeParticipantsModalComponent, ZombieSiegeDetailComponent, CustomEventParticipantsModelComponent, - CustomEventDetailComponent + CustomEventDetailComponent, + DismissPlayerComponent ], imports: [ BrowserModule, diff --git a/Ui/src/app/navigation/navigation.component.html b/Ui/src/app/navigation/navigation.component.html index 88b0dd3..c242dda 100644 --- a/Ui/src/app/navigation/navigation.component.html +++ b/Ui/src/app/navigation/navigation.component.html @@ -25,6 +25,11 @@ + +