mirror of
https://github.com/TomasiDeveloping/PlayerManagement.git
synced 2026-04-16 17:22:21 +00:00
..
This commit is contained in:
parent
98f772e5d5
commit
a8a032c1d7
59
Api/Configurations/ServiceExtensions.cs
Normal file
59
Api/Configurations/ServiceExtensions.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
using System.Text;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Database;
|
||||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
|
namespace Api.Configurations;
|
||||||
|
|
||||||
|
public static class ServiceExtensions
|
||||||
|
{
|
||||||
|
public static void ConfigureAndAddCors(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddPolicy("AllowAll", p => p
|
||||||
|
.AllowAnyHeader()
|
||||||
|
.AllowAnyMethod()
|
||||||
|
.AllowAnyOrigin());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ConfigureAndApiVersioning(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddApiVersioning(options =>
|
||||||
|
{
|
||||||
|
options.DefaultApiVersion = new ApiVersion(1, 0);
|
||||||
|
options.AssumeDefaultVersionWhenUnspecified = true;
|
||||||
|
options.ReportApiVersions = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ConfigureAndAddHealthChecks(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.AddHealthChecks()
|
||||||
|
.AddSqlServer(configuration.GetConnectionString("ApplicationDbConnection")!)
|
||||||
|
.AddDbContextCheck<ApplicationContext>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ConfigureAndAddAuthentication(this IServiceCollection services, IConfigurationSection jwtSection)
|
||||||
|
{
|
||||||
|
services.AddAuthentication(options =>
|
||||||
|
{
|
||||||
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
|
}).AddJwtBearer(options =>
|
||||||
|
{
|
||||||
|
options.TokenValidationParameters = new TokenValidationParameters()
|
||||||
|
{
|
||||||
|
ValidateIssuer = true,
|
||||||
|
ValidateAudience = true,
|
||||||
|
ValidateLifetime = true,
|
||||||
|
ValidateIssuerSigningKey = true,
|
||||||
|
ValidIssuer = jwtSection["Issuer"],
|
||||||
|
ValidAudience = jwtSection["Audience"],
|
||||||
|
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSection["Key"]!))
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
63
Api/Configurations/SwaggerExtension.cs
Normal file
63
Api/Configurations/SwaggerExtension.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
|
namespace Api.Configurations;
|
||||||
|
|
||||||
|
public static class SwaggerExtension
|
||||||
|
{
|
||||||
|
// Configures Swagger for API documentation
|
||||||
|
public static void ConfigureAndAddSwagger(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSwaggerGen(options =>
|
||||||
|
{
|
||||||
|
// Defines API documentation details for version 1
|
||||||
|
options.SwaggerDoc("v1", new OpenApiInfo
|
||||||
|
{
|
||||||
|
Title = "Last War Player Management API",
|
||||||
|
Description = "API for Last War Player Management",
|
||||||
|
Version = "v1",
|
||||||
|
License = new OpenApiLicense
|
||||||
|
{
|
||||||
|
Name = "MIT License"
|
||||||
|
},
|
||||||
|
Contact = new OpenApiContact
|
||||||
|
{
|
||||||
|
Name = "TomasiDeveloping",
|
||||||
|
Email = "info@tomasi-developing.ch",
|
||||||
|
Url = new Uri("https://tomasi-developing.ch")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Configures Bearer token authentication for Swagger
|
||||||
|
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Description = @"JWT Authorization header using the Bearer scheme.
|
||||||
|
Enter 'Bearer' [space] and then your token in the text input below.
|
||||||
|
Example: 'Bearer 12345abcdef'",
|
||||||
|
Name = "Authorization",
|
||||||
|
In = ParameterLocation.Header,
|
||||||
|
Type = SecuritySchemeType.ApiKey,
|
||||||
|
Scheme = JwtBearerDefaults.AuthenticationScheme
|
||||||
|
});
|
||||||
|
|
||||||
|
// Adds security requirements for Bearer token authentication
|
||||||
|
options.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
|
{
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Reference = new OpenApiReference
|
||||||
|
{
|
||||||
|
Type = ReferenceType.SecurityScheme,
|
||||||
|
Id = JwtBearerDefaults.AuthenticationScheme
|
||||||
|
},
|
||||||
|
Scheme = "Oauth2",
|
||||||
|
Name = JwtBearerDefaults.AuthenticationScheme,
|
||||||
|
In = ParameterLocation.Header
|
||||||
|
},
|
||||||
|
new List<string>()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
138
Api/Controllers/v1/AdmonitionsController.cs
Normal file
138
Api/Controllers/v1/AdmonitionsController.cs
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
using Application.DataTransferObjects.Admonition;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
//[Authorize]
|
||||||
|
public class AdmonitionsController(IAdmonitionRepository admonitionRepository, ILogger<AdmonitionsController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<ActionResult<List<AdmonitionDto>>> GetAdmonitions(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var admonitionsResult = await admonitionRepository.GetAdmonitionsAsync(cancellationToken);
|
||||||
|
|
||||||
|
if (admonitionsResult.IsFailure) return BadRequest(admonitionsResult.Error);
|
||||||
|
|
||||||
|
return admonitionsResult.Value.Count > 0
|
||||||
|
? Ok(admonitionsResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{admonitionId:guid}")]
|
||||||
|
public async Task<ActionResult<AdmonitionDto>> GetAdmonition(Guid admonitionId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var admonitionResult = await admonitionRepository.GetAdmonitionAsync(admonitionId, cancellationToken);
|
||||||
|
|
||||||
|
return admonitionResult.IsFailure
|
||||||
|
? BadRequest(admonitionResult.Error)
|
||||||
|
: Ok(admonitionResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Player/{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<List<AdmonitionDto>>> GetPlayerAdmonitions(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var playerAdmonitionsResult = await admonitionRepository.GetPlayerAdmonitionsAsync(playerId, cancellationToken);
|
||||||
|
|
||||||
|
if (playerAdmonitionsResult.IsFailure) return BadRequest(playerAdmonitionsResult.Error);
|
||||||
|
|
||||||
|
return playerAdmonitionsResult.Value.Count > 0
|
||||||
|
? Ok(playerAdmonitionsResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<AdmonitionDto>> CreateAdmonition(CreateAdmonitionDto createAdmonitionDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var createResult =
|
||||||
|
await admonitionRepository.CreateAdmonitionAsync(createAdmonitionDto, cancellationToken);
|
||||||
|
|
||||||
|
return createResult.IsFailure
|
||||||
|
? BadRequest(createResult.Error)
|
||||||
|
: CreatedAtAction(nameof(GetAdmonition), new { admonitionId = createResult.Value.Id }, createResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{admonitionId:guid}")]
|
||||||
|
public async Task<ActionResult<AdmonitionDto>> UpdateAdmonition(Guid admonitionId,
|
||||||
|
UpdateAdmonitionDto updateAdmonitionDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
if (admonitionId != updateAdmonitionDto.Id) return Conflict(AdmonitionErrors.IdConflict);
|
||||||
|
|
||||||
|
var updateResult =
|
||||||
|
await admonitionRepository.UpdateAdmonitionAsync(updateAdmonitionDto, cancellationToken);
|
||||||
|
|
||||||
|
return updateResult.IsFailure
|
||||||
|
? BadRequest(updateResult.Error)
|
||||||
|
: Ok(updateResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{admonitionId:guid}")]
|
||||||
|
public async Task<ActionResult<bool>> DeleteAdmonition(Guid admonitionId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteResult = await admonitionRepository.DeleteAdmonitionAsync(admonitionId, cancellationToken);
|
||||||
|
|
||||||
|
return deleteResult.IsFailure
|
||||||
|
? BadRequest(deleteResult.Error)
|
||||||
|
: Ok(deleteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
116
Api/Controllers/v1/AlliancesController.cs
Normal file
116
Api/Controllers/v1/AlliancesController.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using Application.DataTransferObjects.Alliance;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
[Authorize]
|
||||||
|
public class AlliancesController(IAllianceRepository allianceRepository, ILogger<AlliancesController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<ActionResult<List<AllianceDto>>> GetAlliances(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var alliancesResult = await allianceRepository.GetAlliancesAsync(cancellationToken);
|
||||||
|
|
||||||
|
if (alliancesResult.IsFailure) return BadRequest(alliancesResult.Error);
|
||||||
|
|
||||||
|
return alliancesResult.Value.Count > 0
|
||||||
|
? Ok(alliancesResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{allianceId:guid}")]
|
||||||
|
public async Task<ActionResult<AllianceDto>> GetAlliance(Guid allianceId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var allianceResult = await allianceRepository.GetAllianceAsync(allianceId, cancellationToken);
|
||||||
|
|
||||||
|
return allianceResult.IsFailure
|
||||||
|
? BadRequest(allianceResult.Error)
|
||||||
|
: Ok(allianceResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<AllianceDto>> CreateAlliance(CreateAllianceDto createAllianceDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var createResult = await allianceRepository.CreateAllianceAsync(createAllianceDto, cancellationToken);
|
||||||
|
|
||||||
|
return createResult.IsFailure
|
||||||
|
? BadRequest(createResult.Error)
|
||||||
|
: CreatedAtAction(nameof(GetAlliance), new { allianceId = createResult.Value.Id }, createResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{allianceId:guid}")]
|
||||||
|
public async Task<ActionResult<AllianceDto>> UpdateAlliance(Guid allianceId, UpdateAllianceDto updateAllianceDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
if (allianceId != updateAllianceDto.Id) return Conflict(AllianceErrors.IdConflict);
|
||||||
|
|
||||||
|
var updateResult = await allianceRepository.UpdateAllianceAsync(updateAllianceDto, cancellationToken);
|
||||||
|
|
||||||
|
return updateResult.IsFailure
|
||||||
|
? BadRequest(updateResult.Error)
|
||||||
|
: Ok(updateResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{allianceId:guid}")]
|
||||||
|
public async Task<ActionResult<bool>> DeleteAlliance(Guid allianceId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteResult = await allianceRepository.DeleteAllianceAsync(allianceId, cancellationToken);
|
||||||
|
|
||||||
|
return deleteResult.IsFailure
|
||||||
|
? BadRequest(deleteResult.Error)
|
||||||
|
: Ok(deleteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
58
Api/Controllers/v1/AuthenticationsController.cs
Normal file
58
Api/Controllers/v1/AuthenticationsController.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using Application.DataTransferObjects.Authentication;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
[Authorize]
|
||||||
|
public class AuthenticationsController(IAuthenticationRepository authenticationRepository, ILogger<AuthenticationsController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("[action]")]
|
||||||
|
public async Task<ActionResult<LoginResponseDto>> Register(RegisterRequestDto registerRequestDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var registerResult =
|
||||||
|
await authenticationRepository.RegisterToApplicationAsync(registerRequestDto, cancellationToken);
|
||||||
|
|
||||||
|
return registerResult.IsFailure
|
||||||
|
? BadRequest(registerResult.Error)
|
||||||
|
: Ok(registerResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("[action]")]
|
||||||
|
public async Task<ActionResult<LoginResponseDto>> Login(LoginRequestDto loginRequestDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var loginResult = await authenticationRepository.LoginAsync(loginRequestDto, cancellationToken);
|
||||||
|
|
||||||
|
return loginResult.IsFailure
|
||||||
|
? Unauthorized(loginResult.Error)
|
||||||
|
: Ok(loginResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
122
Api/Controllers/v1/DesertStormsController.cs
Normal file
122
Api/Controllers/v1/DesertStormsController.cs
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
using Application.DataTransferObjects.DesertStorm;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
//[Authorize]
|
||||||
|
public class DesertStormsController(IDesertStormRepository desertStormRepository, ILogger<DesertStormsController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet("{desertStormId:guid}")]
|
||||||
|
public async Task<ActionResult<DesertStormDto>> GetDesertStorm(Guid desertStormId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var desertStormResult =
|
||||||
|
await desertStormRepository.GetDesertStormAsync(desertStormId, cancellationToken);
|
||||||
|
|
||||||
|
return desertStormResult.IsFailure
|
||||||
|
? BadRequest(desertStormResult.Error)
|
||||||
|
: Ok(desertStormResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Player/{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<List<DesertStormDto>>> GetPlayerDesertStorms(Guid playerId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var playerDesertStormsResult =
|
||||||
|
await desertStormRepository.GetPlayerDesertStormsAsync(playerId, cancellationToken);
|
||||||
|
|
||||||
|
if (playerDesertStormsResult.IsFailure) return BadRequest(playerDesertStormsResult.Error);
|
||||||
|
|
||||||
|
return playerDesertStormsResult.Value.Count > 0
|
||||||
|
? Ok(playerDesertStormsResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<DesertStormDto>> CreateDesertStorm(CreateDesertStormDto createDesertStormDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var createResult =
|
||||||
|
await desertStormRepository.CreateDesertStormAsync(createDesertStormDto, cancellationToken);
|
||||||
|
|
||||||
|
return createResult.IsFailure
|
||||||
|
? BadRequest(createResult.Error)
|
||||||
|
: CreatedAtAction(nameof(GetDesertStorm), new { desertStormId = createResult.Value.Id },
|
||||||
|
createResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{desertStormId:guid}")]
|
||||||
|
public async Task<ActionResult<DesertStormDto>> UpdateDesertStorm(Guid desertStormId,
|
||||||
|
UpdateDesertStormDto updateDesertStormDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
if (desertStormId != updateDesertStormDto.Id) return Conflict(DesertStormErrors.IdConflict);
|
||||||
|
|
||||||
|
var updateResult =
|
||||||
|
await desertStormRepository.UpdateDesertStormAsync(updateDesertStormDto, cancellationToken);
|
||||||
|
|
||||||
|
return updateResult.IsFailure
|
||||||
|
? BadRequest(updateResult.Error)
|
||||||
|
: Ok(updateResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{desertStormId:guid}")]
|
||||||
|
public async Task<ActionResult<bool>> DeleteDesertStorm(Guid desertStormId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteResult = await desertStormRepository.DeleteDesertStormAsync(desertStormId, cancellationToken);
|
||||||
|
|
||||||
|
return deleteResult.IsFailure
|
||||||
|
? BadRequest(deleteResult.Error)
|
||||||
|
: Ok(deleteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
125
Api/Controllers/v1/MarshalGuardsController.cs
Normal file
125
Api/Controllers/v1/MarshalGuardsController.cs
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
using Application.DataTransferObjects.MarshalGuard;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
//[Authorize]
|
||||||
|
public class MarshalGuardsController(IMarshalGuardRepository marshalGuardRepository, ILogger<MarshalGuardsController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet("{marshalGuardId:guid}")]
|
||||||
|
public async Task<ActionResult<MarshalGuardDto>> GetMarshalGuard(Guid marshalGuardId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var marshalGuardResult =
|
||||||
|
await marshalGuardRepository.GetMarshalGuardAsync(marshalGuardId, cancellationToken);
|
||||||
|
|
||||||
|
return marshalGuardResult.IsFailure
|
||||||
|
? BadRequest(marshalGuardResult.Error)
|
||||||
|
: Ok(marshalGuardResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Player/{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<List<MarshalGuardDto>>> GetPlayerMarshalGuards(Guid playerId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var playerMarshalGuardsResult =
|
||||||
|
await marshalGuardRepository.GetPlayerMarshalGuardsAsync(playerId, cancellationToken);
|
||||||
|
|
||||||
|
if (playerMarshalGuardsResult.IsFailure) return BadRequest(playerMarshalGuardsResult.Error);
|
||||||
|
|
||||||
|
return playerMarshalGuardsResult.Value.Count > 0
|
||||||
|
? Ok(playerMarshalGuardsResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<MarshalGuardDto>> CreateMarshalGuard(CreateMarshalGuardDto createMarshalGuardDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var createResult =
|
||||||
|
await marshalGuardRepository.CreateMarshalGuardAsync(createMarshalGuardDto, cancellationToken);
|
||||||
|
|
||||||
|
return createResult.IsFailure
|
||||||
|
? BadRequest(createResult.Error)
|
||||||
|
: CreatedAtAction(nameof(GetMarshalGuard), new { marshalGuardId = createResult.Value.Id },
|
||||||
|
createResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError); ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{marshalGuardId:guid}")]
|
||||||
|
public async Task<ActionResult<MarshalGuardDto>> UpdateMarshalGuard(Guid marshalGuardId,
|
||||||
|
UpdateMarshalGuardDto updateMarshalGuardDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
if (marshalGuardId != updateMarshalGuardDto.Id) return Conflict(MarshalGuardErrors.IdConflict);
|
||||||
|
|
||||||
|
var updateResult =
|
||||||
|
await marshalGuardRepository.UpdateMarshalGuardAsync(updateMarshalGuardDto, cancellationToken);
|
||||||
|
|
||||||
|
return updateResult.IsFailure
|
||||||
|
? BadRequest(updateResult.Error)
|
||||||
|
: Ok(updateResult.Value);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{marshalGuardId:guid}")]
|
||||||
|
public async Task<ActionResult<bool>> DeleteMarshalGuard(Guid marshalGuardId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteResult =
|
||||||
|
await marshalGuardRepository.DeleteMarshalGuardAsync(marshalGuardId, cancellationToken);
|
||||||
|
|
||||||
|
return deleteResult.IsFailure
|
||||||
|
? BadRequest(deleteResult.Error)
|
||||||
|
: Ok(deleteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
116
Api/Controllers/v1/NotesController.cs
Normal file
116
Api/Controllers/v1/NotesController.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using Application.DataTransferObjects.Note;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
//[Authorize]
|
||||||
|
public class NotesController(INoteRepository noteRepository, ILogger<NotesController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet("{noteId:guid}")]
|
||||||
|
public async Task<ActionResult<NoteDto>> GetNote(Guid noteId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var noteResult = await noteRepository.GetNoteAsync(noteId, cancellationToken);
|
||||||
|
|
||||||
|
return noteResult.IsFailure
|
||||||
|
? BadRequest(noteResult.Error)
|
||||||
|
: Ok(noteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Player/{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<List<NoteDto>>> GetPlayerNotes(Guid playerId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var playerNotesResult = await noteRepository.GetPlayerNotesAsync(playerId, cancellationToken);
|
||||||
|
|
||||||
|
if (playerNotesResult.IsFailure) return BadRequest(playerNotesResult.Error);
|
||||||
|
|
||||||
|
return playerNotesResult.Value.Count > 0
|
||||||
|
? Ok(playerNotesResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<NoteDto>> CreateNote(CreateNoteDto createNoteDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var createResult = await noteRepository.CreateNoteAsync(createNoteDto, cancellationToken);
|
||||||
|
|
||||||
|
return createResult.IsFailure
|
||||||
|
? BadRequest(createResult.Error)
|
||||||
|
: CreatedAtAction(nameof(GetNote), new { noteId = createResult.Value.Id }, createResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{noteId:guid}")]
|
||||||
|
public async Task<ActionResult<NoteDto>> UpdateNote(Guid noteId, UpdateNoteDto updateNoteDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
if (noteId != updateNoteDto.Id) return Conflict(NoteErrors.IdConflict);
|
||||||
|
|
||||||
|
var updateResult = await noteRepository.UpdateNoteAsync(updateNoteDto, cancellationToken);
|
||||||
|
|
||||||
|
return updateResult.IsFailure
|
||||||
|
? BadRequest(updateResult.Error)
|
||||||
|
: Ok(updateResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{noteId:guid}")]
|
||||||
|
public async Task<ActionResult<bool>> DeleteNote(Guid noteId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteResult = await noteRepository.DeleteNoteAsync(noteId, cancellationToken);
|
||||||
|
|
||||||
|
return deleteResult.IsFailure
|
||||||
|
? BadRequest(deleteResult.Error)
|
||||||
|
: Ok(deleteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
Api/Controllers/v1/PlayersController.cs
Normal file
117
Api/Controllers/v1/PlayersController.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
using Application.DataTransferObjects.Player;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
//[Authorize]
|
||||||
|
public class PlayersController(IPlayerRepository playerRepository, ILogger<PlayersController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet("{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<PlayerDto>> GetPlayer(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var playerResult = await playerRepository.GetPlayerAsync(playerId, cancellationToken);
|
||||||
|
|
||||||
|
return playerResult.IsFailure
|
||||||
|
? BadRequest(playerResult.Error)
|
||||||
|
: Ok(playerResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Alliance/{allianceId:guid}")]
|
||||||
|
public async Task<ActionResult<List<PlayerDto>>> GetAlliancePlayers(Guid allianceId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var alliancePlayersResult =
|
||||||
|
await playerRepository.GetAlliancePlayersAsync(allianceId, cancellationToken);
|
||||||
|
|
||||||
|
if (alliancePlayersResult.IsFailure) return BadRequest(alliancePlayersResult.Error);
|
||||||
|
|
||||||
|
return alliancePlayersResult.Value.Count > 0
|
||||||
|
? Ok(alliancePlayersResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<PlayerDto>> CreatePlayer(CreatePlayerDto createPlayerDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var createResult = await playerRepository.CreatePlayerAsync(createPlayerDto, cancellationToken);
|
||||||
|
|
||||||
|
return createResult.IsFailure
|
||||||
|
? BadRequest(createResult.Error)
|
||||||
|
: CreatedAtAction(nameof(GetPlayer), new { playerId = createResult.Value.Id }, createResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<PlayerDto>> UpdatePlayer(Guid playerId, UpdatePlayerDto updatePlayerDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
if (playerId != updatePlayerDto.Id) return Conflict(PlayerErrors.IdConflict);
|
||||||
|
|
||||||
|
var updateResult = await playerRepository.UpdatePlayerAsync(updatePlayerDto, cancellationToken);
|
||||||
|
|
||||||
|
return updateResult.IsFailure
|
||||||
|
? BadRequest(updateResult.Error)
|
||||||
|
: Ok(updateResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<bool>> DeletePlayer(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteResult = await playerRepository.DeletePlayerAsync(playerId, cancellationToken);
|
||||||
|
|
||||||
|
return deleteResult.IsFailure
|
||||||
|
? BadRequest(deleteResult.Error)
|
||||||
|
: Ok(deleteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
116
Api/Controllers/v1/VsDuelsController.cs
Normal file
116
Api/Controllers/v1/VsDuelsController.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
using Application.DataTransferObjects.VsDuel;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Asp.Versioning;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Api.Controllers.v1
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
//[Authorize]
|
||||||
|
public class VsDuelsController(IVsDuelRepository vsDuelRepository, ILogger<VsDuelsController> logger) : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet("{vsDuelId:guid}")]
|
||||||
|
public async Task<ActionResult<VsDuelDto>> GetVsDuel(Guid vsDuelId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var vsDuelResult = await vsDuelRepository.GetVsDuelAsync(vsDuelId, cancellationToken);
|
||||||
|
|
||||||
|
return vsDuelResult.IsFailure
|
||||||
|
? BadRequest(vsDuelResult.Error)
|
||||||
|
: Ok(vsDuelResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Player/{playerId:guid}")]
|
||||||
|
public async Task<ActionResult<List<VsDuelDto>>> GetPlayerVsDuels(Guid playerId,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var playerVsDuelsResult = await vsDuelRepository.GetPlayerVsDuelsAsync(playerId, cancellationToken);
|
||||||
|
|
||||||
|
if (playerVsDuelsResult.IsFailure) return BadRequest(playerVsDuelsResult.Error);
|
||||||
|
|
||||||
|
return playerVsDuelsResult.Value.Count > 0
|
||||||
|
? Ok(playerVsDuelsResult.Value)
|
||||||
|
: NoContent();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ActionResult<VsDuelDto>> CreateVsDuel(CreateVsDuelDto createVsDuelDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
var createResult = await vsDuelRepository.CreateVsDuelAsync(createVsDuelDto, cancellationToken);
|
||||||
|
|
||||||
|
return createResult.IsFailure
|
||||||
|
? BadRequest(createResult.Error)
|
||||||
|
: CreatedAtAction(nameof(GetVsDuel), new { vsDuelId = createResult.Value.Id }, createResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{vsDuelId:guid}")]
|
||||||
|
public async Task<ActionResult<VsDuelDto>> UpdateVsDuel(Guid vsDuelId, UpdateVsDuelDto updateVsDuelDto,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid) return UnprocessableEntity(ModelState);
|
||||||
|
|
||||||
|
if (vsDuelId != updateVsDuelDto.Id) return Conflict(VsDuelErrors.IdConflict);
|
||||||
|
|
||||||
|
var updateResult = await vsDuelRepository.UpdateVsDuelAsync(updateVsDuelDto, cancellationToken);
|
||||||
|
|
||||||
|
return updateResult.IsFailure
|
||||||
|
? BadRequest(updateResult.Error)
|
||||||
|
: Ok(updateResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{vsDuelId:guid}")]
|
||||||
|
public async Task<ActionResult<bool>> DeleteVsDuel(Guid vsDuelId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deleteResult = await vsDuelRepository.DeleteVsDuelAsync(vsDuelId, cancellationToken);
|
||||||
|
|
||||||
|
return deleteResult.IsFailure
|
||||||
|
? BadRequest(deleteResult.Error)
|
||||||
|
: Ok(deleteResult.Value);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Application/Application.csproj
Normal file
24
Application/Application.csproj
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="DataTransferObjects\Alliance\" />
|
||||||
|
<Folder Include="Classes\" />
|
||||||
|
<Folder Include="DataTransferObjects\Note\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Database\Database.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
28
Application/ApplicationDependencyInjection.cs
Normal file
28
Application/ApplicationDependencyInjection.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Application.Repositories;
|
||||||
|
using Application.Services;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Application;
|
||||||
|
|
||||||
|
public static class ApplicationDependencyInjection
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddApplication(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddAutoMapper(Assembly.GetExecutingAssembly());
|
||||||
|
|
||||||
|
services.AddScoped<IAllianceRepository, AllianceRepository>();
|
||||||
|
services.AddScoped<IAdmonitionRepository, AdmonitionRepository>();
|
||||||
|
services.AddScoped<IDesertStormRepository, DesertStormRepository>();
|
||||||
|
services.AddScoped<IMarshalGuardRepository, MarshalGuardRepository>();
|
||||||
|
services.AddScoped<INoteRepository, NoteRepository>();
|
||||||
|
services.AddScoped<IPlayerRepository, PlayerRepository>();
|
||||||
|
services.AddScoped<IVsDuelRepository, VsDuelRepository>();
|
||||||
|
services.AddScoped<IAuthenticationRepository, AuthenticationRepository>();
|
||||||
|
|
||||||
|
services.AddTransient<IJwtService, JwtService>();
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Application/Classes/Error.cs
Normal file
12
Application/Classes/Error.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
public record Error(string Code, string Name)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a common error for null values.
|
||||||
|
/// </summary>
|
||||||
|
public static Error NullValue = new("Error.NullValue", "Null value was provided");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a default error with an empty code and name.
|
||||||
|
/// </summary>
|
||||||
|
public static Error None => new(string.Empty, string.Empty);
|
||||||
|
}
|
||||||
85
Application/Classes/Result.cs
Normal file
85
Application/Classes/Result.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Application.Classes;
|
||||||
|
|
||||||
|
public class Result
|
||||||
|
{
|
||||||
|
// Constructor for internal use only
|
||||||
|
protected internal Result(bool isSuccess, Error error)
|
||||||
|
{
|
||||||
|
// Check for invalid combinations of isSuccess and error
|
||||||
|
switch (isSuccess)
|
||||||
|
{
|
||||||
|
case true when error != Error.None:
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
case false when error == Error.None:
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
default:
|
||||||
|
IsSuccess = isSuccess;
|
||||||
|
Error = error;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indicates if the operation was successful
|
||||||
|
public bool IsSuccess { get; }
|
||||||
|
|
||||||
|
// Indicates if the operation failed
|
||||||
|
public bool IsFailure => !IsSuccess;
|
||||||
|
|
||||||
|
// The error associated with a failure
|
||||||
|
public Error Error { get; }
|
||||||
|
|
||||||
|
// Factory method for creating a successful result without data
|
||||||
|
public static Result Success()
|
||||||
|
{
|
||||||
|
return new Result(true, Error.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Factory method for creating a failure result with an error
|
||||||
|
public static Result Failure(Error error)
|
||||||
|
{
|
||||||
|
return new Result(false, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Factory method for creating a successful result with data
|
||||||
|
public static Result<TValue> Success<TValue>(TValue value)
|
||||||
|
{
|
||||||
|
return new Result<TValue>(value, true, Error.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Factory method for creating a failure result with an error and no data
|
||||||
|
public static Result<TValue> Failure<TValue>(Error error)
|
||||||
|
{
|
||||||
|
return new Result<TValue>(default, false, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Factory method for creating a result based on whether the value is null or not
|
||||||
|
public static Result<TValue> Create<TValue>(TValue? value)
|
||||||
|
{
|
||||||
|
return value is not null ? Success(value) : Failure<TValue>(Error.NullValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Result<TValue> : Result
|
||||||
|
{
|
||||||
|
private readonly TValue? _value;
|
||||||
|
|
||||||
|
// Constructor for internal use only
|
||||||
|
protected internal Result(TValue? value, bool isSuccess, Error error) : base(isSuccess, error)
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the value if the operation was successful
|
||||||
|
[NotNull]
|
||||||
|
public TValue Value => IsSuccess
|
||||||
|
? _value!
|
||||||
|
: throw new InvalidOperationException("The value of a failure result can not be accessed.");
|
||||||
|
|
||||||
|
public static implicit operator Result<TValue>(TValue? value)
|
||||||
|
{
|
||||||
|
return Create(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Application/DataTransferObjects/Admonition/AdmonitionDto.cs
Normal file
10
Application/DataTransferObjects/Admonition/AdmonitionDto.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Application.DataTransferObjects.Admonition;
|
||||||
|
|
||||||
|
public class AdmonitionDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public required string Reason { get; set; }
|
||||||
|
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Admonition;
|
||||||
|
|
||||||
|
public class CreateAdmonitionDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
[MaxLength(250)]
|
||||||
|
public required string Reason { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Admonition;
|
||||||
|
|
||||||
|
public class UpdateAdmonitionDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(250)]
|
||||||
|
public required string Reason { get; set; }
|
||||||
|
}
|
||||||
12
Application/DataTransferObjects/Alliance/AllianceDto.cs
Normal file
12
Application/DataTransferObjects/Alliance/AllianceDto.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Application.DataTransferObjects.Alliance;
|
||||||
|
|
||||||
|
public class AllianceDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public int Server { get; set; }
|
||||||
|
|
||||||
|
public required string Name { get; set; }
|
||||||
|
|
||||||
|
public required string Abbreviation { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Alliance;
|
||||||
|
|
||||||
|
public class CreateAllianceDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public int Server { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(200)]
|
||||||
|
public required string Name { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(5)]
|
||||||
|
public required string Abbreviation { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Alliance;
|
||||||
|
|
||||||
|
public class UpdateAllianceDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(200)]
|
||||||
|
public required string Name { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(5)]
|
||||||
|
public required string Abbreviation { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Authentication;
|
||||||
|
|
||||||
|
public class LoginRequestDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
[EmailAddress]
|
||||||
|
public required string Email { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public required string Password { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
namespace Application.DataTransferObjects.Authentication;
|
||||||
|
|
||||||
|
public class LoginResponseDto
|
||||||
|
{
|
||||||
|
public required string Token { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Authentication;
|
||||||
|
|
||||||
|
public class RegisterRequestDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
[EmailAddress]
|
||||||
|
public required string Email { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(200)]
|
||||||
|
public required string PlayerName { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public required string Password { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int AllianceServer { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(200)]
|
||||||
|
public required string AllianceName { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(5)]
|
||||||
|
public required string AllianceAbbreviation { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
namespace Application.DataTransferObjects.DesertStorm;
|
||||||
|
|
||||||
|
public class CreateDesertStormDto
|
||||||
|
{
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
public bool Registered { get; set; }
|
||||||
|
|
||||||
|
public bool Participated { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
namespace Application.DataTransferObjects.DesertStorm;
|
||||||
|
|
||||||
|
public class DesertStormDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public bool Registered { get; set; }
|
||||||
|
|
||||||
|
public bool Participated { get; set; }
|
||||||
|
|
||||||
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
public int CalendarWeek { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
namespace Application.DataTransferObjects.DesertStorm;
|
||||||
|
|
||||||
|
public class UpdateDesertStormDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
public bool Registered { get; set; }
|
||||||
|
|
||||||
|
public bool Participated { get; set; }
|
||||||
|
|
||||||
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
public int CalendarWeek { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.MarshalGuard;
|
||||||
|
|
||||||
|
public class CreateMarshalGuardDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public bool Participated { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
namespace Application.DataTransferObjects.MarshalGuard;
|
||||||
|
|
||||||
|
public class MarshalGuardDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public bool Participated { get; set; }
|
||||||
|
|
||||||
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
public int Month { get; set; }
|
||||||
|
|
||||||
|
public int Day { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.MarshalGuard;
|
||||||
|
|
||||||
|
public class UpdateMarshalGuardDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public bool Participated { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int Month { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int Day { get; set; }
|
||||||
|
}
|
||||||
13
Application/DataTransferObjects/Note/CreateNoteDto.cs
Normal file
13
Application/DataTransferObjects/Note/CreateNoteDto.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Note;
|
||||||
|
|
||||||
|
public class CreateNoteDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(500)]
|
||||||
|
public required string PlayerNote { get; set; }
|
||||||
|
}
|
||||||
8
Application/DataTransferObjects/Note/NoteDto.cs
Normal file
8
Application/DataTransferObjects/Note/NoteDto.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Application.DataTransferObjects.Note;
|
||||||
|
|
||||||
|
public class NoteDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public required string PlayerNote { get; set; }
|
||||||
|
}
|
||||||
16
Application/DataTransferObjects/Note/UpdateNoteDto.cs
Normal file
16
Application/DataTransferObjects/Note/UpdateNoteDto.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Note;
|
||||||
|
|
||||||
|
public class UpdateNoteDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(500)]
|
||||||
|
public required string PlayerNote { get; set; }
|
||||||
|
}
|
||||||
20
Application/DataTransferObjects/Player/CreatePlayerDto.cs
Normal file
20
Application/DataTransferObjects/Player/CreatePlayerDto.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Player;
|
||||||
|
|
||||||
|
public class CreatePlayerDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
[MaxLength(250)]
|
||||||
|
public required string PlayerName { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Guid RankId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Guid AllianceId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(3)]
|
||||||
|
public required string Level { get; set; }
|
||||||
|
}
|
||||||
12
Application/DataTransferObjects/Player/PlayerDto.cs
Normal file
12
Application/DataTransferObjects/Player/PlayerDto.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Application.DataTransferObjects.Player;
|
||||||
|
|
||||||
|
public class PlayerDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public required string PlayerName { get; set; }
|
||||||
|
|
||||||
|
public required string Level { get; set; }
|
||||||
|
|
||||||
|
public required string RankName { get; set; }
|
||||||
|
}
|
||||||
18
Application/DataTransferObjects/Player/UpdatePlayerDto.cs
Normal file
18
Application/DataTransferObjects/Player/UpdatePlayerDto.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.Player;
|
||||||
|
|
||||||
|
public class UpdatePlayerDto
|
||||||
|
{
|
||||||
|
public Guid Id{ get; set; }
|
||||||
|
[Required]
|
||||||
|
[MaxLength(250)]
|
||||||
|
public required string PlayerName { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Guid RankId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[MaxLength(3)]
|
||||||
|
public required string Level { get; set; }
|
||||||
|
}
|
||||||
13
Application/DataTransferObjects/VsDuel/CreateVsDuelDto.cs
Normal file
13
Application/DataTransferObjects/VsDuel/CreateVsDuelDto.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.VsDuel;
|
||||||
|
|
||||||
|
public class CreateVsDuelDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int WeeklyPoints { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
21
Application/DataTransferObjects/VsDuel/UpdateVsDuelDto.cs
Normal file
21
Application/DataTransferObjects/VsDuel/UpdateVsDuelDto.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Application.DataTransferObjects.VsDuel;
|
||||||
|
|
||||||
|
public class UpdateVsDuelDto
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public Guid PlayerId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int WeeklyPoints { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int CalendarWeek { get; set; }
|
||||||
|
}
|
||||||
13
Application/DataTransferObjects/VsDuel/VsDuelDto.cs
Normal file
13
Application/DataTransferObjects/VsDuel/VsDuelDto.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace Application.DataTransferObjects.VsDuel;
|
||||||
|
|
||||||
|
public class VsDuelDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public int WeeklyPoints { get; set; }
|
||||||
|
|
||||||
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
public int CalendarWeek { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
9
Application/Errors/AdmonitionErrors.cs
Normal file
9
Application/Errors/AdmonitionErrors.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class AdmonitionErrors
|
||||||
|
{
|
||||||
|
public static readonly Error NotFound = new("Error.Admonition.NotFound",
|
||||||
|
"The Admonition with the specified identifier was not found");
|
||||||
|
|
||||||
|
public static readonly Error IdConflict = new("Error.Admonition.IdConflict", "There is a conflict with the id's");
|
||||||
|
}
|
||||||
9
Application/Errors/AllianceErrors.cs
Normal file
9
Application/Errors/AllianceErrors.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class AllianceErrors
|
||||||
|
{
|
||||||
|
public static readonly Error NotFound = new("Error.Alliance.NotFound",
|
||||||
|
"The alliance with the specified identifier was not found");
|
||||||
|
|
||||||
|
public static readonly Error IdConflict = new("Error.Alliance.IdConflict", "There is a conflict with the id's");
|
||||||
|
}
|
||||||
12
Application/Errors/AuthenticationErrors.cs
Normal file
12
Application/Errors/AuthenticationErrors.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class AuthenticationErrors
|
||||||
|
{
|
||||||
|
public static readonly Error LoginFailed = new("Error.Authentication.LoginFailed", "Email or password incorrect");
|
||||||
|
|
||||||
|
public static readonly Error RegisterFailed =
|
||||||
|
new("Error.Authentication.RegisterFailed", "Could not create an account");
|
||||||
|
|
||||||
|
public static readonly Error AllianceAlreadyExists =
|
||||||
|
new("Error.Authentication.AllianceAlreadyExists", "Alliance already exists");
|
||||||
|
}
|
||||||
9
Application/Errors/DesertStormErrors.cs
Normal file
9
Application/Errors/DesertStormErrors.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class DesertStormErrors
|
||||||
|
{
|
||||||
|
public static readonly Error NotFound = new("Error.DesertStorm.NotFound",
|
||||||
|
"The Desert Storm with the specified identifier was not found");
|
||||||
|
|
||||||
|
public static readonly Error IdConflict = new("Error.DesertStorm.IdConflict", "There is a conflict with the id's");
|
||||||
|
}
|
||||||
7
Application/Errors/GeneralErrors.cs
Normal file
7
Application/Errors/GeneralErrors.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class GeneralErrors
|
||||||
|
{
|
||||||
|
public static readonly Error DatabaseError =
|
||||||
|
new("Error.DatabaseError", "An error occurred when saving to the database");
|
||||||
|
}
|
||||||
9
Application/Errors/MarshalGuardErrors.cs
Normal file
9
Application/Errors/MarshalGuardErrors.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class MarshalGuardErrors
|
||||||
|
{
|
||||||
|
public static readonly Error NotFound = new("Error.MarshalGuard.NotFound",
|
||||||
|
"The marshal guard with the specified identifier was not found");
|
||||||
|
|
||||||
|
public static readonly Error IdConflict = new("Error.MarshalGuard.IdConflict", "There is a conflict with the id's");
|
||||||
|
}
|
||||||
9
Application/Errors/NoteErrors.cs
Normal file
9
Application/Errors/NoteErrors.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class NoteErrors
|
||||||
|
{
|
||||||
|
public static readonly Error NotFound = new("Error.Note.NotFound",
|
||||||
|
"The note with the specified identifier was not found");
|
||||||
|
|
||||||
|
public static readonly Error IdConflict = new("Error.Note.IdConflict", "There is a conflict with the id's");
|
||||||
|
}
|
||||||
9
Application/Errors/PlayerErrors.cs
Normal file
9
Application/Errors/PlayerErrors.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public static class PlayerErrors
|
||||||
|
{
|
||||||
|
public static readonly Error NotFound = new("Error.Player.NotFound",
|
||||||
|
"The player with the specified identifier was not found");
|
||||||
|
|
||||||
|
public static readonly Error IdConflict = new("Error.Player.IdConflict", "There is a conflict with the id's");
|
||||||
|
}
|
||||||
9
Application/Errors/VsDuelErrors.cs
Normal file
9
Application/Errors/VsDuelErrors.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Application.Errors;
|
||||||
|
|
||||||
|
public class VsDuelErrors
|
||||||
|
{
|
||||||
|
public static readonly Error NotFound = new("Error.VsDuel.NotFound",
|
||||||
|
"The Vs Duel with the specified identifier was not found");
|
||||||
|
|
||||||
|
public static readonly Error IdConflict = new("Error.VsDuel.IdConflict", "There is a conflict with the id's");
|
||||||
|
}
|
||||||
19
Application/Interfaces/IAdmonitionRepository.cs
Normal file
19
Application/Interfaces/IAdmonitionRepository.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Admonition;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IAdmonitionRepository
|
||||||
|
{
|
||||||
|
Task<Result<List<AdmonitionDto>>> GetAdmonitionsAsync(CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<List<AdmonitionDto>>> GetPlayerAdmonitionsAsync(Guid playerId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<AdmonitionDto>> GetAdmonitionAsync(Guid admonitionId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<AdmonitionDto>> CreateAdmonitionAsync(CreateAdmonitionDto createAdmonitionDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<AdmonitionDto>> UpdateAdmonitionAsync(UpdateAdmonitionDto updateAdmonitionDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<bool>> DeleteAdmonitionAsync(Guid admonitionId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
17
Application/Interfaces/IAllianceRepository.cs
Normal file
17
Application/Interfaces/IAllianceRepository.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Alliance;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IAllianceRepository
|
||||||
|
{
|
||||||
|
Task<Result<List<AllianceDto>>> GetAlliancesAsync(CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<AllianceDto>> GetAllianceAsync(Guid allianceId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<AllianceDto>> CreateAllianceAsync(CreateAllianceDto createAllianceDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<AllianceDto>> UpdateAllianceAsync(UpdateAllianceDto updateAllianceDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<bool>> DeleteAllianceAsync(Guid allianceId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
11
Application/Interfaces/IAuthenticationRepository.cs
Normal file
11
Application/Interfaces/IAuthenticationRepository.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Authentication;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IAuthenticationRepository
|
||||||
|
{
|
||||||
|
Task<Result<LoginResponseDto>> LoginAsync(LoginRequestDto loginRequestDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<LoginResponseDto>> RegisterToApplicationAsync(RegisterRequestDto registerRequestDto, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
17
Application/Interfaces/IDesertStormRepository.cs
Normal file
17
Application/Interfaces/IDesertStormRepository.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.DesertStorm;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IDesertStormRepository
|
||||||
|
{
|
||||||
|
Task<Result<DesertStormDto>> GetDesertStormAsync(Guid desertStormId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<List<DesertStormDto>>> GetPlayerDesertStormsAsync(Guid playerId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<DesertStormDto>> CreateDesertStormAsync(CreateDesertStormDto createDesertStormDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<DesertStormDto>> UpdateDesertStormAsync(UpdateDesertStormDto updateDesertStormDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<bool>> DeleteDesertStormAsync(Guid desertStormId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
15
Application/Interfaces/IJwtService.cs
Normal file
15
Application/Interfaces/IJwtService.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IJwtService
|
||||||
|
{
|
||||||
|
SigningCredentials GetSigningCredentials();
|
||||||
|
|
||||||
|
Task<List<Claim>> GetClaimsAsync(User user);
|
||||||
|
|
||||||
|
JwtSecurityToken GenerateTokenOptions(SigningCredentials signingCredentials, List<Claim> claims);
|
||||||
|
}
|
||||||
17
Application/Interfaces/IMarshalGuardRepository.cs
Normal file
17
Application/Interfaces/IMarshalGuardRepository.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.MarshalGuard;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IMarshalGuardRepository
|
||||||
|
{
|
||||||
|
Task<Result<MarshalGuardDto>> GetMarshalGuardAsync(Guid marshalGuardId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<List<MarshalGuardDto>>> GetPlayerMarshalGuardsAsync(Guid playerId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<MarshalGuardDto>> CreateMarshalGuardAsync(CreateMarshalGuardDto createMarshalGuardDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<MarshalGuardDto>> UpdateMarshalGuardAsync(UpdateMarshalGuardDto updateMarshalGuardDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<bool>> DeleteMarshalGuardAsync(Guid marshalGuardId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
17
Application/Interfaces/INoteRepository.cs
Normal file
17
Application/Interfaces/INoteRepository.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Note;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface INoteRepository
|
||||||
|
{
|
||||||
|
Task<Result<NoteDto>> GetNoteAsync(Guid noteId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<List<NoteDto>>> GetPlayerNotesAsync(Guid playerId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<NoteDto>> CreateNoteAsync(CreateNoteDto createNoteDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<NoteDto>> UpdateNoteAsync(UpdateNoteDto updateNoteDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<bool>> DeleteNoteAsync(Guid noteId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
17
Application/Interfaces/IPlayerRepository.cs
Normal file
17
Application/Interfaces/IPlayerRepository.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Player;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IPlayerRepository
|
||||||
|
{
|
||||||
|
Task<Result<PlayerDto>> GetPlayerAsync(Guid playerId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<List<PlayerDto>>> GetAlliancePlayersAsync(Guid allianceId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<PlayerDto>> CreatePlayerAsync(CreatePlayerDto createPlayerDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<PlayerDto>> UpdatePlayerAsync(UpdatePlayerDto updatePlayerDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<bool>> DeletePlayerAsync(Guid playerIId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
17
Application/Interfaces/IVsDuelRepository.cs
Normal file
17
Application/Interfaces/IVsDuelRepository.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.VsDuel;
|
||||||
|
|
||||||
|
namespace Application.Interfaces;
|
||||||
|
|
||||||
|
public interface IVsDuelRepository
|
||||||
|
{
|
||||||
|
Task<Result<VsDuelDto>> GetVsDuelAsync(Guid vsDuelId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<List<VsDuelDto>>> GetPlayerVsDuelsAsync(Guid playerId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<VsDuelDto>> CreateVsDuelAsync(CreateVsDuelDto createVsDuelDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<VsDuelDto>> UpdateVsDuelAsync(UpdateVsDuelDto updateVsDuelDto, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task<Result<bool>> DeleteVsDuelAsync(Guid vsDuelId, CancellationToken cancellationToken);
|
||||||
|
}
|
||||||
17
Application/Profiles/AdmonitionProfile.cs
Normal file
17
Application/Profiles/AdmonitionProfile.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.DataTransferObjects.Admonition;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class AdmonitionProfile : Profile
|
||||||
|
{
|
||||||
|
public AdmonitionProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Admonition, AdmonitionDto>();
|
||||||
|
|
||||||
|
CreateMap<CreateAdmonitionDto, Admonition>();
|
||||||
|
|
||||||
|
CreateMap<UpdateAdmonitionDto, Admonition>();
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Application/Profiles/AllianceProfile.cs
Normal file
23
Application/Profiles/AllianceProfile.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using Application.DataTransferObjects.Alliance;
|
||||||
|
using Application.DataTransferObjects.Authentication;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class AllianceProfile : Profile
|
||||||
|
{
|
||||||
|
public AllianceProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Alliance, AllianceDto>();
|
||||||
|
|
||||||
|
CreateMap<CreateAllianceDto, Alliance>();
|
||||||
|
|
||||||
|
CreateMap<UpdateAllianceDto, Alliance>();
|
||||||
|
|
||||||
|
CreateMap<RegisterRequestDto, Alliance>()
|
||||||
|
.ForMember(des => des.Name, opt => opt.MapFrom(src => src.AllianceName))
|
||||||
|
.ForMember(des => des.Abbreviation, opt => opt.MapFrom(src => src.AllianceAbbreviation))
|
||||||
|
.ForMember(des => des.Server, opt => opt.MapFrom(src => src.AllianceServer));
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Application/Profiles/AuthenticationProfile.cs
Normal file
15
Application/Profiles/AuthenticationProfile.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using Application.DataTransferObjects.Authentication;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class AuthenticationProfile : Profile
|
||||||
|
{
|
||||||
|
public AuthenticationProfile()
|
||||||
|
{
|
||||||
|
CreateMap<RegisterRequestDto, User>()
|
||||||
|
.ForMember(des => des.UserName, opt => opt.MapFrom(src => src.Email))
|
||||||
|
.ForMember(des => des.NormalizedEmail, opt => opt.MapFrom(src => src.Email.ToUpper()));
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Application/Profiles/DesertStormProfile.cs
Normal file
19
Application/Profiles/DesertStormProfile.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Application.DataTransferObjects.DesertStorm;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class DesertStormProfile : Profile
|
||||||
|
{
|
||||||
|
public DesertStormProfile()
|
||||||
|
{
|
||||||
|
CreateMap<DesertStorm, DesertStormDto>();
|
||||||
|
|
||||||
|
CreateMap<UpdateDesertStormDto, DesertStorm>();
|
||||||
|
|
||||||
|
CreateMap<CreateDesertStormDto, DesertStorm>()
|
||||||
|
.ForMember(des => des.Year, opt => opt.MapFrom(src => DateTime.Now.Year))
|
||||||
|
.ForMember(des => des.CalendarWeek, opt => opt.MapFrom(src => DateTime.Now.DayOfWeek));
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Application/Profiles/MarshalGuardProfile.cs
Normal file
20
Application/Profiles/MarshalGuardProfile.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using Application.DataTransferObjects.MarshalGuard;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class MarshalGuardProfile : Profile
|
||||||
|
{
|
||||||
|
public MarshalGuardProfile()
|
||||||
|
{
|
||||||
|
CreateMap<MarshalGuard, MarshalGuardDto>();
|
||||||
|
|
||||||
|
CreateMap<UpdateMarshalGuardDto, MarshalGuard>();
|
||||||
|
|
||||||
|
CreateMap<CreateMarshalGuardDto, MarshalGuard>()
|
||||||
|
.ForMember(des => des.Year, opt => opt.MapFrom(src => DateTime.Now.Year))
|
||||||
|
.ForMember(des => des.Month, opt => opt.MapFrom(src => DateTime.Now.Month))
|
||||||
|
.ForMember(des => des.Day, opt => opt.MapFrom(src => DateTime.Now.Day));
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Application/Profiles/NoteProfile.cs
Normal file
17
Application/Profiles/NoteProfile.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Application.DataTransferObjects.Note;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class NoteProfile : Profile
|
||||||
|
{
|
||||||
|
public NoteProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Note, NoteDto>();
|
||||||
|
|
||||||
|
CreateMap<UpdateNoteDto, Note>();
|
||||||
|
|
||||||
|
CreateMap<CreateNoteDto, Note>();
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Application/Profiles/PlayerProfile.cs
Normal file
18
Application/Profiles/PlayerProfile.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using Application.DataTransferObjects.Player;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class PlayerProfile : Profile
|
||||||
|
{
|
||||||
|
public PlayerProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Player, PlayerDto>()
|
||||||
|
.ForMember(des => des.RankName, opt => opt.MapFrom(src => src.Rank.Name));
|
||||||
|
|
||||||
|
CreateMap<CreatePlayerDto, Player>();
|
||||||
|
|
||||||
|
CreateMap<UpdatePlayerDto, Player>();
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Application/Profiles/VsDuelProfile.cs
Normal file
19
Application/Profiles/VsDuelProfile.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Application.DataTransferObjects.VsDuel;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database.Entities;
|
||||||
|
|
||||||
|
namespace Application.Profiles;
|
||||||
|
|
||||||
|
public class VsDuelProfile : Profile
|
||||||
|
{
|
||||||
|
public VsDuelProfile()
|
||||||
|
{
|
||||||
|
CreateMap<VsDuel, VsDuelDto>();
|
||||||
|
|
||||||
|
CreateMap<UpdateVsDuelDto, VsDuel>();
|
||||||
|
|
||||||
|
CreateMap<CreateVsDuelDto, VsDuel>()
|
||||||
|
.ForMember(des => des.Year, opt => opt.MapFrom(src => DateTime.Now.Year))
|
||||||
|
.ForMember(des => des.CalendarWeek, opt => opt.MapFrom(src => DateTime.Now.DayOfWeek));
|
||||||
|
}
|
||||||
|
}
|
||||||
109
Application/Repositories/AdmonitionRepository.cs
Normal file
109
Application/Repositories/AdmonitionRepository.cs
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Admonition;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class AdmonitionRepository(ApplicationContext context, IMapper mapper, ILogger<AdmonitionRepository> logger) : IAdmonitionRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<List<AdmonitionDto>>> GetAdmonitionsAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var admonitions = await context.Admonitions
|
||||||
|
.ProjectTo<AdmonitionDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(admonitions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<List<AdmonitionDto>>> GetPlayerAdmonitionsAsync(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerAdmonitions = await context.Admonitions
|
||||||
|
.Where(admonition => admonition.PlayerId == playerId)
|
||||||
|
.ProjectTo<AdmonitionDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(playerAdmonitions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<AdmonitionDto>> GetAdmonitionAsync(Guid admonitionId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var admonitionById = await context.Admonitions
|
||||||
|
.ProjectTo<AdmonitionDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(admonition => admonition.Id == admonitionId, cancellationToken);
|
||||||
|
|
||||||
|
return admonitionById is null
|
||||||
|
? Result.Failure<AdmonitionDto>(AdmonitionErrors.NotFound)
|
||||||
|
: Result.Success(admonitionById);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<AdmonitionDto>> CreateAdmonitionAsync(CreateAdmonitionDto createAdmonitionDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newAdmonition = mapper.Map<Admonition>(createAdmonitionDto);
|
||||||
|
|
||||||
|
await context.Admonitions.AddAsync(newAdmonition, cancellationToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(mapper.Map<AdmonitionDto>(newAdmonition));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<AdmonitionDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<AdmonitionDto>> UpdateAdmonitionAsync(UpdateAdmonitionDto updateAdmonitionDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var admonitionToUpdate = await context.Admonitions
|
||||||
|
.FirstOrDefaultAsync(admonition => admonition.Id == updateAdmonitionDto.Id, cancellationToken);
|
||||||
|
|
||||||
|
if (admonitionToUpdate is null) return Result.Failure<AdmonitionDto>(AdmonitionErrors.NotFound);
|
||||||
|
|
||||||
|
mapper.Map(updateAdmonitionDto, admonitionToUpdate);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<AdmonitionDto>(admonitionToUpdate));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<AdmonitionDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<bool>> DeleteAdmonitionAsync(Guid admonitionId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var admonitionToDelete = await context.Admonitions
|
||||||
|
.FirstOrDefaultAsync(admonition => admonition.Id == admonitionId, cancellationToken);
|
||||||
|
|
||||||
|
if (admonitionToDelete is null) return Result.Failure<bool>(AdmonitionErrors.NotFound);
|
||||||
|
|
||||||
|
context.Admonitions.Remove(admonitionToDelete);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<bool>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
73
Application/Repositories/AllianceRepository.cs
Normal file
73
Application/Repositories/AllianceRepository.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Alliance;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class AllianceRepository(ApplicationContext context, IMapper mapper) : IAllianceRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<List<AllianceDto>>> GetAlliancesAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var alliances = await context.Alliances
|
||||||
|
.ProjectTo<AllianceDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(alliances);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<AllianceDto>> GetAllianceAsync(Guid allianceId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var allianceById = await context.Alliances
|
||||||
|
.ProjectTo<AllianceDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(alliance => alliance.Id == allianceId, cancellationToken);
|
||||||
|
|
||||||
|
return allianceById is null
|
||||||
|
? Result.Failure<AllianceDto>(AllianceErrors.NotFound)
|
||||||
|
: Result.Success(allianceById);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<AllianceDto>> CreateAllianceAsync(CreateAllianceDto createAllianceDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newAlliance = mapper.Map<Alliance>(createAllianceDto);
|
||||||
|
|
||||||
|
await context.Alliances.AddAsync(newAlliance, cancellationToken);
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(mapper.Map<AllianceDto>(newAlliance));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<AllianceDto>> UpdateAllianceAsync(UpdateAllianceDto updateAllianceDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var allianceToUpdate = await context.Alliances
|
||||||
|
.FirstOrDefaultAsync(alliance => alliance.Id == updateAllianceDto.Id, cancellationToken);
|
||||||
|
|
||||||
|
if (allianceToUpdate is null) return Result.Failure<AllianceDto>(AllianceErrors.NotFound);
|
||||||
|
|
||||||
|
mapper.Map(updateAllianceDto, allianceToUpdate);
|
||||||
|
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(mapper.Map<AllianceDto>(allianceToUpdate));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<bool>> DeleteAllianceAsync(Guid allianceId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var allianceToDelete =
|
||||||
|
await context.Alliances.FirstOrDefaultAsync(alliance => alliance.Id == allianceId, cancellationToken);
|
||||||
|
|
||||||
|
if (allianceToDelete is null) return Result.Failure<bool>(AllianceErrors.NotFound);
|
||||||
|
|
||||||
|
context.Alliances.Remove(allianceToDelete);
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
124
Application/Repositories/AuthenticationRepository.cs
Normal file
124
Application/Repositories/AuthenticationRepository.cs
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Authentication;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Utilities.Constants;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class AuthenticationRepository(UserManager<User> userManager, ApplicationContext context, IMapper mapper, IJwtService jwtService, ILogger<AuthenticationRepository> logger) : IAuthenticationRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<LoginResponseDto>> LoginAsync(LoginRequestDto loginRequestDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var userToLogin = await userManager.FindByEmailAsync(loginRequestDto.Email);
|
||||||
|
|
||||||
|
if (userToLogin is null || !await userManager.CheckPasswordAsync(userToLogin, loginRequestDto.Password))
|
||||||
|
{
|
||||||
|
return Result.Failure<LoginResponseDto>(AuthenticationErrors.LoginFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
var loginResponse = new LoginResponseDto()
|
||||||
|
{
|
||||||
|
Token = await CreateJwtToken(userToLogin)
|
||||||
|
};
|
||||||
|
|
||||||
|
return Result.Success(loginResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<LoginResponseDto>> RegisterToApplicationAsync(RegisterRequestDto registerRequestDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newUser = mapper.Map<User>(registerRequestDto);
|
||||||
|
var userAlliance = mapper.Map<Alliance>(registerRequestDto);
|
||||||
|
|
||||||
|
var checkAllianceExists = await AllianceAlreadyExists(userAlliance.Server, userAlliance.Abbreviation, cancellationToken);
|
||||||
|
|
||||||
|
if (checkAllianceExists) return Result.Failure<LoginResponseDto>(AuthenticationErrors.AllianceAlreadyExists);
|
||||||
|
|
||||||
|
var createAllianceResult = await CreateAlliance(userAlliance, cancellationToken);
|
||||||
|
|
||||||
|
if (createAllianceResult.IsFailure) return Result.Failure<LoginResponseDto>(createAllianceResult.Error);
|
||||||
|
|
||||||
|
newUser.AllianceId = createAllianceResult.Value.Id;
|
||||||
|
|
||||||
|
var userCreateResult = await userManager.CreateAsync(newUser, registerRequestDto.Password);
|
||||||
|
|
||||||
|
if (!userCreateResult.Succeeded)
|
||||||
|
{
|
||||||
|
var rollBackResult = await RollbackAlliance(createAllianceResult.Value, cancellationToken);
|
||||||
|
|
||||||
|
return Result.Failure<LoginResponseDto>(rollBackResult.IsFailure ? rollBackResult.Error : AuthenticationErrors.RegisterFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
var addRoleResult = await userManager.AddToRoleAsync(newUser, ApplicationRoles.Administrator);
|
||||||
|
|
||||||
|
if (!addRoleResult.Succeeded)
|
||||||
|
{
|
||||||
|
await userManager.DeleteAsync(newUser);
|
||||||
|
await RollbackAlliance(createAllianceResult.Value, cancellationToken);
|
||||||
|
return Result.Failure<LoginResponseDto>(AuthenticationErrors.RegisterFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
var response = new LoginResponseDto()
|
||||||
|
{
|
||||||
|
Token = await CreateJwtToken(newUser)
|
||||||
|
};
|
||||||
|
|
||||||
|
return Result.Success(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<Result<Alliance>> CreateAlliance(Alliance alliance, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await context.Alliances.AddAsync(alliance, cancellationToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return alliance;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<Alliance>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<Result<bool>> RollbackAlliance(Alliance alliance, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
context.Alliances.Remove(alliance);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<bool>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<string> CreateJwtToken(User user)
|
||||||
|
{
|
||||||
|
var signingCredentials = jwtService.GetSigningCredentials();
|
||||||
|
var claims = await jwtService.GetClaimsAsync(user);
|
||||||
|
var tokenOptions = jwtService.GenerateTokenOptions(signingCredentials, claims);
|
||||||
|
|
||||||
|
return new JwtSecurityTokenHandler().WriteToken(tokenOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> AllianceAlreadyExists(int server, string allianceAbbreviation, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var allianceToCheck = await context.Alliances
|
||||||
|
.FirstOrDefaultAsync(alliance => alliance.Server == server && alliance.Abbreviation == allianceAbbreviation, cancellationToken);
|
||||||
|
|
||||||
|
return allianceToCheck is not null;
|
||||||
|
}
|
||||||
|
}
|
||||||
98
Application/Repositories/DesertStormRepository.cs
Normal file
98
Application/Repositories/DesertStormRepository.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.DesertStorm;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class DesertStormRepository(ApplicationContext context, IMapper mapper, ILogger<DesertStormRepository> logger) : IDesertStormRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<DesertStormDto>> GetDesertStormAsync(Guid desertStormId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var desertStormById = await context.DesertStorms
|
||||||
|
.ProjectTo<DesertStormDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(desertStorm => desertStorm.Id == desertStormId, cancellationToken);
|
||||||
|
|
||||||
|
return desertStormById is null
|
||||||
|
? Result.Failure<DesertStormDto>(DesertStormErrors.NotFound)
|
||||||
|
: Result.Success(desertStormById);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<List<DesertStormDto>>> GetPlayerDesertStormsAsync(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerDesertStorms = await context.DesertStorms
|
||||||
|
.Where(desertStorm => desertStorm.PlayerId == playerId)
|
||||||
|
.ProjectTo<DesertStormDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(playerDesertStorms);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<DesertStormDto>> CreateDesertStormAsync(CreateDesertStormDto createDesertStormDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newDesertStorm = mapper.Map<DesertStorm>(createDesertStormDto);
|
||||||
|
|
||||||
|
await context.DesertStorms.AddAsync(newDesertStorm, cancellationToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<DesertStormDto>(newDesertStorm));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<DesertStormDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<DesertStormDto>> UpdateDesertStormAsync(UpdateDesertStormDto updateDesertStormDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var desertStormToUpdate = await context.DesertStorms
|
||||||
|
.FirstOrDefaultAsync(desertStorm => desertStorm.Id == updateDesertStormDto.Id, cancellationToken);
|
||||||
|
|
||||||
|
if (desertStormToUpdate is null) return Result.Failure<DesertStormDto>(DesertStormErrors.NotFound);
|
||||||
|
|
||||||
|
mapper.Map(updateDesertStormDto, desertStormToUpdate);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<DesertStormDto>(desertStormToUpdate));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<DesertStormDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<bool>> DeleteDesertStormAsync(Guid desertStormId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var desertStormToDelete = await context.DesertStorms
|
||||||
|
.FirstOrDefaultAsync(desertStorm => desertStorm.Id == desertStormId, cancellationToken);
|
||||||
|
|
||||||
|
if (desertStormToDelete is null) return Result.Failure<bool>(DesertStormErrors.NotFound);
|
||||||
|
|
||||||
|
context.DesertStorms.Remove(desertStormToDelete);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<bool>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
98
Application/Repositories/MarshalGuardRepository.cs
Normal file
98
Application/Repositories/MarshalGuardRepository.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.MarshalGuard;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class MarshalGuardRepository(ApplicationContext context, IMapper mapper, ILogger<MarshalGuardRepository> logger) : IMarshalGuardRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<MarshalGuardDto>> GetMarshalGuardAsync(Guid marshalGuardId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var marshalGuardById = await context.MarshalGuards
|
||||||
|
.ProjectTo<MarshalGuardDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(marshalGuard => marshalGuard.Id == marshalGuardId, cancellationToken);
|
||||||
|
|
||||||
|
return marshalGuardById is null
|
||||||
|
? Result.Failure<MarshalGuardDto>(MarshalGuardErrors.NotFound)
|
||||||
|
: Result.Success(marshalGuardById);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<List<MarshalGuardDto>>> GetPlayerMarshalGuardsAsync(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerMarshalGuards = await context.MarshalGuards
|
||||||
|
.Where(marshalGuard => marshalGuard.PlayerId == playerId)
|
||||||
|
.ProjectTo<MarshalGuardDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(playerMarshalGuards);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<MarshalGuardDto>> CreateMarshalGuardAsync(CreateMarshalGuardDto createMarshalGuardDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newMarshalGuard = mapper.Map<MarshalGuard>(createMarshalGuardDto);
|
||||||
|
|
||||||
|
await context.MarshalGuards.AddAsync(newMarshalGuard, cancellationToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<MarshalGuardDto>(newMarshalGuard));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<MarshalGuardDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<MarshalGuardDto>> UpdateMarshalGuardAsync(UpdateMarshalGuardDto updateMarshalGuardDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var marshalGuardToUpdate = await context.MarshalGuards
|
||||||
|
.FirstOrDefaultAsync(marshalGuard => marshalGuard.Id == updateMarshalGuardDto.Id, cancellationToken);
|
||||||
|
|
||||||
|
if (marshalGuardToUpdate is null) return Result.Failure<MarshalGuardDto>(MarshalGuardErrors.NotFound);
|
||||||
|
|
||||||
|
mapper.Map(updateMarshalGuardDto, marshalGuardToUpdate);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<MarshalGuardDto>(marshalGuardToUpdate));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<MarshalGuardDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<bool>> DeleteMarshalGuardAsync(Guid marshalGuardId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var marshalGuardToDelete = await context.MarshalGuards
|
||||||
|
.FirstOrDefaultAsync(marshalGuard => marshalGuard.Id == marshalGuardId, cancellationToken);
|
||||||
|
|
||||||
|
if (marshalGuardToDelete is null) return Result.Failure<bool>(MarshalGuardErrors.NotFound);
|
||||||
|
|
||||||
|
context.MarshalGuards.Remove(marshalGuardToDelete);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<bool>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
98
Application/Repositories/NoteRepository.cs
Normal file
98
Application/Repositories/NoteRepository.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Note;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class NoteRepository(ApplicationContext context, IMapper mapper, ILogger<NoteRepository> logger) : INoteRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<NoteDto>> GetNoteAsync(Guid noteId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var noteById = await context.Notes
|
||||||
|
.ProjectTo<NoteDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(note => note.Id == noteId, cancellationToken);
|
||||||
|
|
||||||
|
return noteById is null
|
||||||
|
? Result.Failure<NoteDto>(NoteErrors.NotFound)
|
||||||
|
: Result.Success(noteById);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<List<NoteDto>>> GetPlayerNotesAsync(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerNotes = await context.Notes
|
||||||
|
.Where(note => note.PlayerId == playerId)
|
||||||
|
.ProjectTo<NoteDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(playerNotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<NoteDto>> CreateNoteAsync(CreateNoteDto createNoteDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newNote = mapper.Map<Note>(createNoteDto);
|
||||||
|
|
||||||
|
await context.Notes.AddAsync(newNote, cancellationToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<NoteDto>(newNote));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<NoteDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<NoteDto>> UpdateNoteAsync(UpdateNoteDto updateNoteDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var noteToUpdate = await context.Notes
|
||||||
|
.FirstOrDefaultAsync(note => note.Id == updateNoteDto.Id, cancellationToken);
|
||||||
|
|
||||||
|
if (noteToUpdate is null) return Result.Failure<NoteDto>(NoteErrors.NotFound);
|
||||||
|
|
||||||
|
mapper.Map(updateNoteDto, noteToUpdate);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<NoteDto>(noteToUpdate));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<NoteDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<bool>> DeleteNoteAsync(Guid noteId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var noteToDelete = await context.Notes
|
||||||
|
.FirstOrDefaultAsync(note => note.Id == noteId, cancellationToken);
|
||||||
|
|
||||||
|
if (noteToDelete is null) return Result.Failure<bool>(NoteErrors.NotFound);
|
||||||
|
|
||||||
|
context.Notes.Remove(noteToDelete);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<bool>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
98
Application/Repositories/PlayerRepository.cs
Normal file
98
Application/Repositories/PlayerRepository.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.Player;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogger<PlayerRepository> logger) : IPlayerRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<PlayerDto>> GetPlayerAsync(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerById = await context.Players
|
||||||
|
.ProjectTo<PlayerDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(player => player.Id == playerId, cancellationToken);
|
||||||
|
|
||||||
|
return playerById is null
|
||||||
|
? Result.Failure<PlayerDto>(PlayerErrors.NotFound)
|
||||||
|
: Result.Success(playerById);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<List<PlayerDto>>> GetAlliancePlayersAsync(Guid allianceId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var alliancePlayers = await context.Players
|
||||||
|
.Where(player => player.AllianceId == allianceId)
|
||||||
|
.ProjectTo<PlayerDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(alliancePlayers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<PlayerDto>> CreatePlayerAsync(CreatePlayerDto createPlayerDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newPlayer = mapper.Map<Player>(createPlayerDto);
|
||||||
|
|
||||||
|
await context.Players.AddAsync(newPlayer, cancellationToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<PlayerDto>(newPlayer));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<PlayerDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<PlayerDto>> UpdatePlayerAsync(UpdatePlayerDto updatePlayerDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerToUpdate = await context.Players
|
||||||
|
.FirstOrDefaultAsync(player => player.Id == updatePlayerDto.Id, cancellationToken);
|
||||||
|
|
||||||
|
if (playerToUpdate is null) return Result.Failure<PlayerDto>(PlayerErrors.NotFound);
|
||||||
|
|
||||||
|
mapper.Map(updatePlayerDto, playerToUpdate);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<PlayerDto>(playerToUpdate));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<PlayerDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<bool>> DeletePlayerAsync(Guid playerIId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerToDelete = await context.Players
|
||||||
|
.FirstOrDefaultAsync(player => player.Id == playerIId, cancellationToken);
|
||||||
|
|
||||||
|
if (playerToDelete is null) return Result.Failure<bool>(PlayerErrors.NotFound);
|
||||||
|
|
||||||
|
context.Players.Remove(playerToDelete);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<bool>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
98
Application/Repositories/VsDuelRepository.cs
Normal file
98
Application/Repositories/VsDuelRepository.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using Application.Classes;
|
||||||
|
using Application.DataTransferObjects.VsDuel;
|
||||||
|
using Application.Errors;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using Database;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Repositories;
|
||||||
|
|
||||||
|
public class VsDuelRepository(ApplicationContext context, IMapper mapper, ILogger<VsDuelRepository> logger) : IVsDuelRepository
|
||||||
|
{
|
||||||
|
public async Task<Result<VsDuelDto>> GetVsDuelAsync(Guid vsDuelId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var vsDuelById = await context.VsDuels
|
||||||
|
.ProjectTo<VsDuelDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(vsDuel => vsDuel.Id == vsDuelId, cancellationToken);
|
||||||
|
|
||||||
|
return vsDuelById is null
|
||||||
|
? Result.Failure<VsDuelDto>(VsDuelErrors.NotFound)
|
||||||
|
: Result.Success(vsDuelById);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<List<VsDuelDto>>> GetPlayerVsDuelsAsync(Guid playerId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var playerVsDuels = await context.VsDuels
|
||||||
|
.Where(vsDuel => vsDuel.PlayerId == playerId)
|
||||||
|
.ProjectTo<VsDuelDto>(mapper.ConfigurationProvider)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
return Result.Success(playerVsDuels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<VsDuelDto>> CreateVsDuelAsync(CreateVsDuelDto createVsDuelDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var newVsDuel = mapper.Map<VsDuel>(createVsDuelDto);
|
||||||
|
|
||||||
|
await context.VsDuels.AddAsync(newVsDuel, cancellationToken);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<VsDuelDto>(newVsDuel));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<VsDuelDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<VsDuelDto>> UpdateVsDuelAsync(UpdateVsDuelDto updateVsDuelDto, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var vsDuelToUpdate = await context.VsDuels
|
||||||
|
.FirstOrDefaultAsync(vsDuel => vsDuel.Id == updateVsDuelDto.Id, cancellationToken);
|
||||||
|
|
||||||
|
if (vsDuelToUpdate is null) return Result.Failure<VsDuelDto>(VsDuelErrors.NotFound);
|
||||||
|
|
||||||
|
mapper.Map(updateVsDuelDto, vsDuelToUpdate);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(mapper.Map<VsDuelDto>(vsDuelToUpdate));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<VsDuelDto>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result<bool>> DeleteVsDuelAsync(Guid vsDuelId, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var vsDuelToDelete = await context.VsDuels
|
||||||
|
.FirstOrDefaultAsync(vsDuel => vsDuel.Id == vsDuelId, cancellationToken);
|
||||||
|
|
||||||
|
if (vsDuelToDelete is null) return Result.Failure<bool>(VsDuelErrors.NotFound);
|
||||||
|
|
||||||
|
context.VsDuels.Remove(vsDuelToDelete);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await context.SaveChangesAsync(cancellationToken);
|
||||||
|
return Result.Success(true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, e.Message);
|
||||||
|
return Result.Failure<bool>(GeneralErrors.DatabaseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Application/Services/JwtService.cs
Normal file
50
Application/Services/JwtService.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
|
using Application.Interfaces;
|
||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
|
namespace Application.Services;
|
||||||
|
|
||||||
|
public class JwtService(IConfiguration configuration, UserManager<User> userManager) : IJwtService
|
||||||
|
{
|
||||||
|
private readonly IConfigurationSection _jwtSection = configuration.GetSection("Jwt");
|
||||||
|
public SigningCredentials GetSigningCredentials()
|
||||||
|
{
|
||||||
|
var key = Encoding.UTF8.GetBytes(_jwtSection["Key"]!);
|
||||||
|
var secret = new SymmetricSecurityKey(key);
|
||||||
|
|
||||||
|
return new SigningCredentials(secret, SecurityAlgorithms.HmacSha256);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<Claim>> GetClaimsAsync(User user)
|
||||||
|
{
|
||||||
|
var claims = new List<Claim>()
|
||||||
|
{
|
||||||
|
new("email", user.Email!),
|
||||||
|
new("playerName", user.PlayerName),
|
||||||
|
new("userId", user.Id.ToString()),
|
||||||
|
new("allianceId", user.AllianceId.ToString())
|
||||||
|
};
|
||||||
|
|
||||||
|
var roles = await userManager.GetRolesAsync(user);
|
||||||
|
claims.AddRange(roles.Select(role => new Claim(ClaimTypes.Role, role)));
|
||||||
|
return claims;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JwtSecurityToken GenerateTokenOptions(SigningCredentials signingCredentials, List<Claim> claims)
|
||||||
|
{
|
||||||
|
var tokenOptions = new JwtSecurityToken(
|
||||||
|
issuer: _jwtSection["Issuer"],
|
||||||
|
audience: _jwtSection["Audience"],
|
||||||
|
claims: claims,
|
||||||
|
expires: DateTime.Now.AddDays(Convert.ToInt32(_jwtSection["DurationInDays"])),
|
||||||
|
signingCredentials: signingCredentials
|
||||||
|
);
|
||||||
|
|
||||||
|
return tokenOptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Database/Configurations/AllianceConfiguration.cs
Normal file
17
Database/Configurations/AllianceConfiguration.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Database.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace Database.Configurations;
|
||||||
|
|
||||||
|
public class AllianceConfiguration : IEntityTypeConfiguration<Alliance>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<Alliance> builder)
|
||||||
|
{
|
||||||
|
builder.HasKey(alliance => alliance.Id);
|
||||||
|
|
||||||
|
builder.Property(alliance => alliance.Name).IsRequired().HasMaxLength(200);
|
||||||
|
builder.Property(alliance => alliance.Abbreviation).IsRequired().HasMaxLength(5);
|
||||||
|
builder.Property(alliance => alliance.Server).IsRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
644
Database/Migrations/20240930140736_Init.Designer.cs
generated
Normal file
644
Database/Migrations/20240930140736_Init.Designer.cs
generated
Normal file
@ -0,0 +1,644 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
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("20240930140736_Init")]
|
||||||
|
partial class Init
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasDefaultSchema("dbo")
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Admonition", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Abbreviation")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Server")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Alliances", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.DesertStorm", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("CalendarWeek")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Participated")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<bool>("Registered")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("DesertStorms", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.MarshalGuard", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("Day")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Month")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Participated")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("MarshalGuards", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Note", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("AllianceId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("nvarchar(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(250)
|
||||||
|
.HasColumnType("nvarchar(250)");
|
||||||
|
|
||||||
|
b.Property<Guid>("RankId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AllianceId");
|
||||||
|
|
||||||
|
b.HasIndex("RankId");
|
||||||
|
|
||||||
|
b.ToTable("Players", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Rank", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<Guid>("AllianceId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("LockoutEnabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedEmail")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedUserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("CalendarWeek")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("WeeklyPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("VsDuels", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("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<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("RoleClaims", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserClaims", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderKey")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderDisplayName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserLogins", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("UserRoles", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("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.DesertStorm", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.Player", "Player")
|
||||||
|
.WithMany("DesertStorms")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Player");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.MarshalGuard", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.Player", "Player")
|
||||||
|
.WithMany("MarshalGuards")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
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.Player", "Player")
|
||||||
|
.WithMany("VsDuels")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Player");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", 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<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Alliance", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Players");
|
||||||
|
|
||||||
|
b.Navigation("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Player", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Admonitions");
|
||||||
|
|
||||||
|
b.Navigation("DesertStorms");
|
||||||
|
|
||||||
|
b.Navigation("MarshalGuards");
|
||||||
|
|
||||||
|
b.Navigation("Notes");
|
||||||
|
|
||||||
|
b.Navigation("VsDuels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Rank", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Players");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
540
Database/Migrations/20240930140736_Init.cs
Normal file
540
Database/Migrations/20240930140736_Init.cs
Normal file
@ -0,0 +1,540 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||||
|
|
||||||
|
namespace Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Init : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.EnsureSchema(
|
||||||
|
name: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Alliances",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Server = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Abbreviation = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Alliances", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Ranks",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Ranks", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Roles",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
||||||
|
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
||||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Roles", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Users",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
AllianceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
PlayerName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
||||||
|
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
||||||
|
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
||||||
|
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
||||||
|
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
||||||
|
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
||||||
|
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Users_Alliances_AllianceId",
|
||||||
|
column: x => x.AllianceId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Alliances",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Players",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
PlayerName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
|
||||||
|
RankId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
AllianceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Level = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Players", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Players_Alliances_AllianceId",
|
||||||
|
column: x => x.AllianceId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Alliances",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Players_Ranks_RankId",
|
||||||
|
column: x => x.RankId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Ranks",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RoleClaims",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RoleClaims", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_RoleClaims_Roles_RoleId",
|
||||||
|
column: x => x.RoleId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Roles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "UserClaims",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_UserClaims", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserClaims_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "UserLogins",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||||
|
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||||
|
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_UserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserLogins_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "UserRoles",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
RoleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserRoles_Roles_RoleId",
|
||||||
|
column: x => x.RoleId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Roles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserRoles_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "UserTokens",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||||
|
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_UserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_UserTokens_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Admonitions",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Reason = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
|
||||||
|
PlayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Admonitions", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Admonitions_Players_PlayerId",
|
||||||
|
column: x => x.PlayerId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Players",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "DesertStorms",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Registered = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Participated = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Year = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CalendarWeek = table.Column<int>(type: "int", nullable: false),
|
||||||
|
PlayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_DesertStorms", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_DesertStorms_Players_PlayerId",
|
||||||
|
column: x => x.PlayerId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Players",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "MarshalGuards",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
Participated = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
Year = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Month = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Day = table.Column<int>(type: "int", nullable: false),
|
||||||
|
PlayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_MarshalGuards", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_MarshalGuards_Players_PlayerId",
|
||||||
|
column: x => x.PlayerId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Players",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Notes",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
PlayerNote = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
||||||
|
PlayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Notes", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Notes_Players_PlayerId",
|
||||||
|
column: x => x.PlayerId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Players",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "VsDuels",
|
||||||
|
schema: "dbo",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
|
WeeklyPoints = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Year = table.Column<int>(type: "int", nullable: false),
|
||||||
|
CalendarWeek = table.Column<int>(type: "int", nullable: false),
|
||||||
|
PlayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_VsDuels", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_VsDuels_Players_PlayerId",
|
||||||
|
column: x => x.PlayerId,
|
||||||
|
principalSchema: "dbo",
|
||||||
|
principalTable: "Players",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Ranks",
|
||||||
|
columns: new[] { "Id", "Name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ new Guid("0fc2f68a-0a4d-4922-981e-c624e4c39024"), "R4" },
|
||||||
|
{ new Guid("326edef0-5074-43a5-9db9-edc71221a0f7"), "R1" },
|
||||||
|
{ new Guid("4970e1f5-f7f5-43e8-88cc-7f8fc4075418"), "R3" },
|
||||||
|
{ new Guid("b1c10a1c-5cf3-4e22-9fc1-d9b165b85dd3"), "R5" },
|
||||||
|
{ new Guid("d8d0c587-f269-45ff-b13e-4631298bf0af"), "R2" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Roles",
|
||||||
|
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ new Guid("207bb0a3-ad50-49bb-bc41-b266fce66529"), null, "ReadOnly", "READONLY" },
|
||||||
|
{ new Guid("47de05ba-ff1e-46b6-9995-269084006c24"), null, "Administrator", "ADMINISTRATOR" },
|
||||||
|
{ new Guid("5cc27946-5601-4a25-b9a9-75b8a11c0cf4"), null, "User", "USER" },
|
||||||
|
{ new Guid("d8b9f882-95f0-4ba0-80ed-9c22c27ac88a"), null, "SystemAdministrator", "SYSTEMADMINISTRATOR" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Admonitions_PlayerId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Admonitions",
|
||||||
|
column: "PlayerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_DesertStorms_PlayerId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "DesertStorms",
|
||||||
|
column: "PlayerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_MarshalGuards_PlayerId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "MarshalGuards",
|
||||||
|
column: "PlayerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Notes_PlayerId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Notes",
|
||||||
|
column: "PlayerId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Players_AllianceId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Players",
|
||||||
|
column: "AllianceId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Players_RankId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Players",
|
||||||
|
column: "RankId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_RoleClaims_RoleId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "RoleClaims",
|
||||||
|
column: "RoleId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "RoleNameIndex",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Roles",
|
||||||
|
column: "NormalizedName",
|
||||||
|
unique: true,
|
||||||
|
filter: "[NormalizedName] IS NOT NULL");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UserClaims_UserId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "UserClaims",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UserLogins_UserId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "UserLogins",
|
||||||
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_UserRoles_RoleId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "UserRoles",
|
||||||
|
column: "RoleId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "EmailIndex",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Users",
|
||||||
|
column: "NormalizedEmail");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Users_AllianceId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Users",
|
||||||
|
column: "AllianceId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "UserNameIndex",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Users",
|
||||||
|
column: "NormalizedUserName",
|
||||||
|
unique: true,
|
||||||
|
filter: "[NormalizedUserName] IS NOT NULL");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_VsDuels_PlayerId",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "VsDuels",
|
||||||
|
column: "PlayerId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Admonitions",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "DesertStorms",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "MarshalGuards",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Notes",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RoleClaims",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "UserClaims",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "UserLogins",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "UserRoles",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "UserTokens",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "VsDuels",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Roles",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Users",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Players",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Alliances",
|
||||||
|
schema: "dbo");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Ranks",
|
||||||
|
schema: "dbo");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
646
Database/Migrations/20241001064648_FixAllianceConfiguration.Designer.cs
generated
Normal file
646
Database/Migrations/20241001064648_FixAllianceConfiguration.Designer.cs
generated
Normal file
@ -0,0 +1,646 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
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("20241001064648_FixAllianceConfiguration")]
|
||||||
|
partial class FixAllianceConfiguration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasDefaultSchema("dbo")
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Admonition", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Abbreviation")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("nvarchar(5)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<int>("Server")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Alliances", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.DesertStorm", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("CalendarWeek")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Participated")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<bool>("Registered")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("DesertStorms", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.MarshalGuard", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("Day")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Month")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Participated")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("MarshalGuards", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Note", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("AllianceId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("nvarchar(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(250)
|
||||||
|
.HasColumnType("nvarchar(250)");
|
||||||
|
|
||||||
|
b.Property<Guid>("RankId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AllianceId");
|
||||||
|
|
||||||
|
b.HasIndex("RankId");
|
||||||
|
|
||||||
|
b.ToTable("Players", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Rank", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<Guid>("AllianceId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("LockoutEnabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedEmail")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedUserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("CalendarWeek")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("WeeklyPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("VsDuels", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("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<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("RoleClaims", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserClaims", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderKey")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderDisplayName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserLogins", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("UserRoles", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("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.DesertStorm", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.Player", "Player")
|
||||||
|
.WithMany("DesertStorms")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Player");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.MarshalGuard", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.Player", "Player")
|
||||||
|
.WithMany("MarshalGuards")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
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.Player", "Player")
|
||||||
|
.WithMany("VsDuels")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Player");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", 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<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Alliance", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Players");
|
||||||
|
|
||||||
|
b.Navigation("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Player", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Admonitions");
|
||||||
|
|
||||||
|
b.Navigation("DesertStorms");
|
||||||
|
|
||||||
|
b.Navigation("MarshalGuards");
|
||||||
|
|
||||||
|
b.Navigation("Notes");
|
||||||
|
|
||||||
|
b.Navigation("VsDuels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Rank", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Players");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixAllianceConfiguration : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Alliances",
|
||||||
|
type: "nvarchar(200)",
|
||||||
|
maxLength: 200,
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(max)");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Abbreviation",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Alliances",
|
||||||
|
type: "nvarchar(5)",
|
||||||
|
maxLength: 5,
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(max)");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Name",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Alliances",
|
||||||
|
type: "nvarchar(max)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(200)",
|
||||||
|
oldMaxLength: 200);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Abbreviation",
|
||||||
|
schema: "dbo",
|
||||||
|
table: "Alliances",
|
||||||
|
type: "nvarchar(max)",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "nvarchar(5)",
|
||||||
|
oldMaxLength: 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
643
Database/Migrations/ApplicationContextModelSnapshot.cs
Normal file
643
Database/Migrations/ApplicationContextModelSnapshot.cs
Normal file
@ -0,0 +1,643 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Database;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Database.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationContext))]
|
||||||
|
partial class ApplicationContextModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasDefaultSchema("dbo")
|
||||||
|
.HasAnnotation("ProductVersion", "8.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Admonition", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Abbreviation")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("nvarchar(5)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<int>("Server")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Alliances", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.DesertStorm", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("CalendarWeek")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Participated")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<bool>("Registered")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("DesertStorms", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.MarshalGuard", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("Day")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Month")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<bool>("Participated")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("MarshalGuards", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Note", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("AllianceId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Level")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("nvarchar(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(250)
|
||||||
|
.HasColumnType("nvarchar(250)");
|
||||||
|
|
||||||
|
b.Property<Guid>("RankId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AllianceId");
|
||||||
|
|
||||||
|
b.HasIndex("RankId");
|
||||||
|
|
||||||
|
b.ToTable("Players", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Rank", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("AccessFailedCount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<Guid>("AllianceId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<bool>("EmailConfirmed")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<bool>("LockoutEnabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||||
|
.HasColumnType("datetimeoffset");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedEmail")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("NormalizedUserName")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("PasswordHash")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("PhoneNumberConfirmed")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("nvarchar(200)");
|
||||||
|
|
||||||
|
b.Property<string>("SecurityStamp")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<bool>("TwoFactorEnabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("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<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("CalendarWeek")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<Guid>("PlayerId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int>("WeeklyPoints")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Year")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("PlayerId");
|
||||||
|
|
||||||
|
b.ToTable("VsDuels", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("ConcurrencyStamp")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<string>("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<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("RoleClaims", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ClaimType")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("ClaimValue")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserClaims", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderKey")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("ProviderDisplayName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("LoginProvider", "ProviderKey");
|
||||||
|
|
||||||
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
|
b.ToTable("UserLogins", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("RoleId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.HasKey("UserId", "RoleId");
|
||||||
|
|
||||||
|
b.HasIndex("RoleId");
|
||||||
|
|
||||||
|
b.ToTable("UserRoles", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("UserId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("LoginProvider")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(450)");
|
||||||
|
|
||||||
|
b.Property<string>("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.DesertStorm", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.Player", "Player")
|
||||||
|
.WithMany("DesertStorms")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Player");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.MarshalGuard", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.Player", "Player")
|
||||||
|
.WithMany("MarshalGuards")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
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.Player", "Player")
|
||||||
|
.WithMany("VsDuels")
|
||||||
|
.HasForeignKey("PlayerId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Player");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RoleId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole<System.Guid>", 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<System.Guid>", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Database.Entities.User", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("UserId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Alliance", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Players");
|
||||||
|
|
||||||
|
b.Navigation("Users");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Player", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Admonitions");
|
||||||
|
|
||||||
|
b.Navigation("DesertStorms");
|
||||||
|
|
||||||
|
b.Navigation("MarshalGuards");
|
||||||
|
|
||||||
|
b.Navigation("Notes");
|
||||||
|
|
||||||
|
b.Navigation("VsDuels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Database.Entities.Rank", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Players");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Ui/.editorconfig
Normal file
16
Ui/.editorconfig
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.ts]
|
||||||
|
quote_type = single
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
42
Ui/.gitignore
vendored
Normal file
42
Ui/.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# Compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# Node
|
||||||
|
/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
.idea/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
/.angular/cache
|
||||||
|
.sass-cache/
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# System files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
4
Ui/.vscode/extensions.json
vendored
Normal file
4
Ui/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||||
|
"recommendations": ["angular.ng-template"]
|
||||||
|
}
|
||||||
19
Ui/.vscode/launch.json
vendored
Normal file
19
Ui/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "edge",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "localhost (Edge)",
|
||||||
|
"url": "http://localhost:4200",
|
||||||
|
"webRoot": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "localhost (Chrome)",
|
||||||
|
"url": "http://localhost:4200",
|
||||||
|
"webRoot": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
42
Ui/.vscode/tasks.json
vendored
Normal file
42
Ui/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "start",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "test",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
16
Ui/CHANGELOG.md
Normal file
16
Ui/CHANGELOG.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
This file explains how Visual Studio created the project.
|
||||||
|
|
||||||
|
The following tools were used to generate this project:
|
||||||
|
- Angular CLI (ng)
|
||||||
|
|
||||||
|
The following steps were used to generate this project:
|
||||||
|
- Create Angular project with ng: `ng new Ui --defaults --skip-install --skip-git --no-standalone `.
|
||||||
|
- Create project file (`Ui.esproj`).
|
||||||
|
- Create `launch.json` to enable debugging.
|
||||||
|
- Create `nuget.config` to specify location of the JavaScript Project System SDK (which is used in the first line in `Ui.esproj`).
|
||||||
|
- Update package.json to add `jest-editor-support`.
|
||||||
|
- Update `start` script in `package.json` to specify host.
|
||||||
|
- Add `karma.conf.js` for unit tests.
|
||||||
|
- Update `angular.json` to point to `karma.conf.js`.
|
||||||
|
- Add project to solution.
|
||||||
|
- Write this file.
|
||||||
27
Ui/README.md
Normal file
27
Ui/README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Ui
|
||||||
|
|
||||||
|
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.1.3.
|
||||||
|
|
||||||
|
## Development server
|
||||||
|
|
||||||
|
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
||||||
|
|
||||||
|
## Code scaffolding
|
||||||
|
|
||||||
|
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||||
|
|
||||||
|
## Running end-to-end tests
|
||||||
|
|
||||||
|
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||||
|
|
||||||
|
## Further help
|
||||||
|
|
||||||
|
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||||
10
Ui/Ui.esproj
Normal file
10
Ui/Ui.esproj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.784122">
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupCommand>npm start</StartupCommand>
|
||||||
|
<JavaScriptTestFramework>Jasmine</JavaScriptTestFramework>
|
||||||
|
<!-- Allows the build (or compile) script located on package.json to run on Build -->
|
||||||
|
<ShouldRunBuildScript>false</ShouldRunBuildScript>
|
||||||
|
<!-- Folder where production build objects will be placed -->
|
||||||
|
<BuildOutputFolder>$(MSBuildProjectDirectory)\dist\Ui\browser\</BuildOutputFolder>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
106
Ui/angular.json
Normal file
106
Ui/angular.json
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"Ui": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"standalone": false
|
||||||
|
},
|
||||||
|
"@schematics/angular:directive": {
|
||||||
|
"standalone": false
|
||||||
|
},
|
||||||
|
"@schematics/angular:pipe": {
|
||||||
|
"standalone": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:application",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/ui",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"browser": "src/main.ts",
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js"
|
||||||
|
],
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"maximumError": "1mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"maximumError": "4kb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"optimization": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"buildTarget": "Ui:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"buildTarget": "Ui:build:development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"buildTarget": "Ui:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js",
|
||||||
|
"zone.js/testing"
|
||||||
|
],
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": [],
|
||||||
|
"karmaConfig": "karma.conf.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
44
Ui/karma.conf.js
Normal file
44
Ui/karma.conf.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
module.exports = function (config) {
|
||||||
|
config.set({
|
||||||
|
basePath: '',
|
||||||
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
|
plugins: [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
|
],
|
||||||
|
client: {
|
||||||
|
jasmine: {
|
||||||
|
// you can add configuration options for Jasmine here
|
||||||
|
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||||
|
// for example, you can disable the random execution with `random: false`
|
||||||
|
// or set a specific seed with `seed: 4321`
|
||||||
|
},
|
||||||
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
|
},
|
||||||
|
jasmineHtmlReporter: {
|
||||||
|
suppressAll: true // removes the duplicated traces
|
||||||
|
},
|
||||||
|
coverageReporter: {
|
||||||
|
dir: require('path').join(__dirname, './coverage/'),
|
||||||
|
subdir: '.',
|
||||||
|
reporters: [
|
||||||
|
{ type: 'html' },
|
||||||
|
{ type: 'text-summary' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
reporters: ['progress', 'kjhtml'],
|
||||||
|
port: 9876,
|
||||||
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
autoWatch: true,
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
singleRun: false,
|
||||||
|
restartOnFileChange: true,
|
||||||
|
listenAddress: 'localhost',
|
||||||
|
hostname: 'localhost'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
10
Ui/nuget.config
Normal file
10
Ui/nuget.config
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<clear />
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||||
|
</packageSources>
|
||||||
|
<disabledPackageSources>
|
||||||
|
<clear />
|
||||||
|
</disabledPackageSources>
|
||||||
|
</configuration>
|
||||||
14786
Ui/package-lock.json
generated
Normal file
14786
Ui/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
Ui/package.json
Normal file
39
Ui/package.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "ui",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"ng": "ng",
|
||||||
|
"start": "ng serve --host=127.0.0.1",
|
||||||
|
"build": "ng build",
|
||||||
|
"watch": "ng build --watch --configuration development",
|
||||||
|
"test": "ng test"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/animations": "^17.1.0",
|
||||||
|
"@angular/common": "^17.1.0",
|
||||||
|
"@angular/compiler": "^17.1.0",
|
||||||
|
"@angular/core": "^17.1.0",
|
||||||
|
"@angular/forms": "^17.1.0",
|
||||||
|
"@angular/platform-browser": "^17.1.0",
|
||||||
|
"@angular/platform-browser-dynamic": "^17.1.0",
|
||||||
|
"@angular/router": "^17.1.0",
|
||||||
|
"rxjs": "~7.8.0",
|
||||||
|
"tslib": "^2.3.0",
|
||||||
|
"zone.js": "~0.14.3",
|
||||||
|
"jest-editor-support": "*"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular-devkit/build-angular": "^17.1.3",
|
||||||
|
"@angular/cli": "^17.1.3",
|
||||||
|
"@angular/compiler-cli": "^17.1.0",
|
||||||
|
"@types/jasmine": "~5.1.0",
|
||||||
|
"jasmine-core": "~5.1.0",
|
||||||
|
"karma": "~6.4.0",
|
||||||
|
"karma-chrome-launcher": "~3.2.0",
|
||||||
|
"karma-coverage": "~2.2.0",
|
||||||
|
"karma-jasmine": "~5.1.0",
|
||||||
|
"karma-jasmine-html-reporter": "~2.1.0",
|
||||||
|
"typescript": "~5.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Ui/src/app/app-routing.module.ts
Normal file
10
Ui/src/app/app-routing.module.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
|
const routes: Routes = [];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule { }
|
||||||
0
Ui/src/app/app.component.css
Normal file
0
Ui/src/app/app.component.css
Normal file
336
Ui/src/app/app.component.html
Normal file
336
Ui/src/app/app.component.html
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * * The content below * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * Delete the template below * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * to get started with your project! * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:host {
|
||||||
|
--bright-blue: oklch(51.01% 0.274 263.83);
|
||||||
|
--electric-violet: oklch(53.18% 0.28 296.97);
|
||||||
|
--french-violet: oklch(47.66% 0.246 305.88);
|
||||||
|
--vivid-pink: oklch(69.02% 0.277 332.77);
|
||||||
|
--hot-red: oklch(61.42% 0.238 15.34);
|
||||||
|
--orange-red: oklch(63.32% 0.24 31.68);
|
||||||
|
|
||||||
|
--gray-900: oklch(19.37% 0.006 300.98);
|
||||||
|
--gray-700: oklch(36.98% 0.014 302.71);
|
||||||
|
--gray-400: oklch(70.9% 0.015 304.04);
|
||||||
|
|
||||||
|
--red-to-pink-to-purple-vertical-gradient: linear-gradient(
|
||||||
|
180deg,
|
||||||
|
var(--orange-red) 0%,
|
||||||
|
var(--vivid-pink) 50%,
|
||||||
|
var(--electric-violet) 100%
|
||||||
|
);
|
||||||
|
|
||||||
|
--red-to-pink-to-purple-horizontal-gradient: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
var(--orange-red) 0%,
|
||||||
|
var(--vivid-pink) 50%,
|
||||||
|
var(--electric-violet) 100%
|
||||||
|
);
|
||||||
|
|
||||||
|
--pill-accent: var(--bright-blue);
|
||||||
|
|
||||||
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||||
|
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
||||||
|
"Segoe UI Symbol";
|
||||||
|
box-sizing: border-box;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.125rem;
|
||||||
|
color: var(--gray-900);
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 100%;
|
||||||
|
letter-spacing: -0.125rem;
|
||||||
|
margin: 0;
|
||||||
|
font-family: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||||
|
Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
||||||
|
"Segoe UI Symbol";
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--gray-700);
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 1rem;
|
||||||
|
box-sizing: inherit;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.angular-logo {
|
||||||
|
max-width: 9.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 700px;
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content h1 {
|
||||||
|
margin-top: 1.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content p {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
width: 1px;
|
||||||
|
background: var(--red-to-pink-to-purple-vertical-gradient);
|
||||||
|
margin-inline: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pill-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pill {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
--pill-accent: var(--bright-blue);
|
||||||
|
background: color-mix(in srgb, var(--pill-accent) 5%, transparent);
|
||||||
|
color: var(--pill-accent);
|
||||||
|
padding-inline: 0.75rem;
|
||||||
|
padding-block: 0.375rem;
|
||||||
|
border-radius: 2.75rem;
|
||||||
|
border: 0;
|
||||||
|
transition: background 0.3s ease;
|
||||||
|
font-family: var(--inter-font);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.4rem;
|
||||||
|
letter-spacing: -0.00875rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pill:hover {
|
||||||
|
background: color-mix(in srgb, var(--pill-accent) 15%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pill-group .pill:nth-child(6n + 1) {
|
||||||
|
--pill-accent: var(--bright-blue);
|
||||||
|
}
|
||||||
|
.pill-group .pill:nth-child(6n + 2) {
|
||||||
|
--pill-accent: var(--french-violet);
|
||||||
|
}
|
||||||
|
.pill-group .pill:nth-child(6n + 3),
|
||||||
|
.pill-group .pill:nth-child(6n + 4),
|
||||||
|
.pill-group .pill:nth-child(6n + 5) {
|
||||||
|
--pill-accent: var(--hot-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pill-group svg {
|
||||||
|
margin-inline-start: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.social-links {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.73rem;
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.social-links path {
|
||||||
|
transition: fill 0.3s ease;
|
||||||
|
fill: var(--gray-400);
|
||||||
|
}
|
||||||
|
|
||||||
|
.social-links a:hover svg path {
|
||||||
|
fill: var(--gray-900);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 650px) {
|
||||||
|
.content {
|
||||||
|
flex-direction: column;
|
||||||
|
width: max-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
height: 1px;
|
||||||
|
width: 100%;
|
||||||
|
background: var(--red-to-pink-to-purple-horizontal-gradient);
|
||||||
|
margin-block: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="content">
|
||||||
|
<div class="left-side">
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 982 239"
|
||||||
|
fill="none"
|
||||||
|
class="angular-logo"
|
||||||
|
>
|
||||||
|
<g clip-path="url(#a)">
|
||||||
|
<path
|
||||||
|
fill="url(#b)"
|
||||||
|
d="M388.676 191.625h30.849L363.31 31.828h-35.758l-56.215 159.797h30.848l13.174-39.356h60.061l13.256 39.356Zm-65.461-62.675 21.602-64.311h1.227l21.602 64.311h-44.431Zm126.831-7.527v70.202h-28.23V71.839h27.002v20.374h1.392c2.782-6.71 7.2-12.028 13.255-15.956 6.056-3.927 13.584-5.89 22.503-5.89 8.264 0 15.465 1.8 21.684 5.318 6.137 3.518 10.964 8.673 14.319 15.382 3.437 6.71 5.074 14.81 4.992 24.383v76.175h-28.23v-71.92c0-8.019-2.046-14.237-6.219-18.819-4.173-4.5-9.819-6.791-17.102-6.791-4.91 0-9.328 1.063-13.174 3.272-3.846 2.128-6.792 5.237-9.001 9.328-2.046 4.009-3.191 8.918-3.191 14.728ZM589.233 239c-10.147 0-18.82-1.391-26.103-4.091-7.282-2.7-13.092-6.382-17.511-10.964-4.418-4.582-7.528-9.655-9.164-15.219l25.448-6.136c1.145 2.372 2.782 4.663 4.991 6.954 2.209 2.291 5.155 4.255 8.837 5.81 3.683 1.554 8.428 2.291 14.074 2.291 8.019 0 14.647-1.964 19.884-5.81 5.237-3.845 7.856-10.227 7.856-19.064v-22.665h-1.391c-1.473 2.946-3.601 5.892-6.383 9.001-2.782 3.109-6.464 5.645-10.965 7.691-4.582 2.046-10.228 3.109-17.101 3.109-9.165 0-17.511-2.209-25.039-6.545-7.446-4.337-13.42-10.883-17.757-19.474-4.418-8.673-6.628-19.473-6.628-32.565 0-13.091 2.21-24.301 6.628-33.383 4.419-9.082 10.311-15.955 17.839-20.7 7.528-4.746 15.874-7.037 25.039-7.037 7.037 0 12.846 1.145 17.347 3.518 4.582 2.373 8.182 5.236 10.883 8.51 2.7 3.272 4.746 6.382 6.137 9.327h1.554v-19.8h27.821v121.749c0 10.228-2.454 18.737-7.364 25.447-4.91 6.709-11.538 11.7-20.048 15.055-8.509 3.355-18.165 4.991-28.884 4.991Zm.245-71.266c5.974 0 11.047-1.473 15.302-4.337 4.173-2.945 7.446-7.118 9.573-12.519 2.21-5.482 3.274-12.027 3.274-19.637 0-7.609-1.064-14.155-3.274-19.8-2.127-5.646-5.318-10.064-9.491-13.255-4.174-3.11-9.329-4.746-15.384-4.746s-11.537 1.636-15.792 4.91c-4.173 3.272-7.365 7.772-9.492 13.418-2.128 5.727-3.191 12.191-3.191 19.392 0 7.2 1.063 13.745 3.273 19.228 2.127 5.482 5.318 9.736 9.573 12.764 4.174 3.027 9.41 4.582 15.629 4.582Zm141.56-26.51V71.839h28.23v119.786h-27.412v-21.273h-1.227c-2.7 6.709-7.119 12.191-13.338 16.446-6.137 4.255-13.747 6.382-22.748 6.382-7.855 0-14.81-1.718-20.783-5.237-5.974-3.518-10.72-8.591-14.075-15.382-3.355-6.709-5.073-14.891-5.073-24.464V71.839h28.312v71.921c0 7.609 2.046 13.664 6.219 18.083 4.173 4.5 9.655 6.709 16.365 6.709 4.173 0 8.183-.982 12.111-3.028 3.927-2.045 7.118-5.072 9.655-9.082 2.537-4.091 3.764-9.164 3.764-15.218Zm65.707-109.395v159.796h-28.23V31.828h28.23Zm44.841 162.169c-7.61 0-14.402-1.391-20.457-4.091-6.055-2.7-10.883-6.791-14.32-12.109-3.518-5.319-5.237-11.946-5.237-19.801 0-6.791 1.228-12.355 3.765-16.773 2.536-4.419 5.891-7.937 10.228-10.637 4.337-2.618 9.164-4.664 14.647-6.055 5.4-1.391 11.046-2.373 16.856-3.027 7.037-.737 12.683-1.391 17.102-1.964 4.337-.573 7.528-1.555 9.574-2.782 1.963-1.309 3.027-3.273 3.027-5.973v-.491c0-5.891-1.718-10.391-5.237-13.664-3.518-3.191-8.51-4.828-15.056-4.828-6.955 0-12.356 1.473-16.447 4.5-4.009 3.028-6.71 6.546-8.183 10.719l-26.348-3.764c2.046-7.282 5.483-13.336 10.31-18.328 4.746-4.909 10.638-8.59 17.511-11.045 6.955-2.455 14.565-3.682 22.912-3.682 5.809 0 11.537.654 17.265 2.045s10.965 3.6 15.711 6.71c4.746 3.109 8.51 7.282 11.455 12.6 2.864 5.318 4.337 11.946 4.337 19.883v80.184h-27.166v-16.446h-.9c-1.719 3.355-4.092 6.464-7.201 9.328-3.109 2.864-6.955 5.237-11.619 6.955-4.828 1.718-10.229 2.536-16.529 2.536Zm7.364-20.701c5.646 0 10.556-1.145 14.729-3.354 4.173-2.291 7.364-5.237 9.655-9.001 2.292-3.763 3.355-7.854 3.355-12.273v-14.155c-.9.737-2.373 1.391-4.5 2.046-2.128.654-4.419 1.145-7.037 1.636-2.619.491-5.155.9-7.692 1.227-2.537.328-4.746.655-6.628.901-4.173.572-8.019 1.472-11.292 2.781-3.355 1.31-5.973 3.11-7.855 5.401-1.964 2.291-2.864 5.318-2.864 8.918 0 5.237 1.882 9.164 5.728 11.782 3.682 2.782 8.51 4.091 14.401 4.091Zm64.643 18.328V71.839h27.412v19.965h1.227c2.21-6.955 5.974-12.274 11.292-16.038 5.319-3.763 11.456-5.645 18.329-5.645 1.555 0 3.355.082 5.237.163 1.964.164 3.601.328 4.91.573v25.938c-1.227-.41-3.109-.819-5.646-1.146a58.814 58.814 0 0 0-7.446-.49c-5.155 0-9.738 1.145-13.829 3.354-4.091 2.209-7.282 5.236-9.655 9.164-2.373 3.927-3.519 8.427-3.519 13.5v70.448h-28.312ZM222.077 39.192l-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill="url(#c)"
|
||||||
|
d="M388.676 191.625h30.849L363.31 31.828h-35.758l-56.215 159.797h30.848l13.174-39.356h60.061l13.256 39.356Zm-65.461-62.675 21.602-64.311h1.227l21.602 64.311h-44.431Zm126.831-7.527v70.202h-28.23V71.839h27.002v20.374h1.392c2.782-6.71 7.2-12.028 13.255-15.956 6.056-3.927 13.584-5.89 22.503-5.89 8.264 0 15.465 1.8 21.684 5.318 6.137 3.518 10.964 8.673 14.319 15.382 3.437 6.71 5.074 14.81 4.992 24.383v76.175h-28.23v-71.92c0-8.019-2.046-14.237-6.219-18.819-4.173-4.5-9.819-6.791-17.102-6.791-4.91 0-9.328 1.063-13.174 3.272-3.846 2.128-6.792 5.237-9.001 9.328-2.046 4.009-3.191 8.918-3.191 14.728ZM589.233 239c-10.147 0-18.82-1.391-26.103-4.091-7.282-2.7-13.092-6.382-17.511-10.964-4.418-4.582-7.528-9.655-9.164-15.219l25.448-6.136c1.145 2.372 2.782 4.663 4.991 6.954 2.209 2.291 5.155 4.255 8.837 5.81 3.683 1.554 8.428 2.291 14.074 2.291 8.019 0 14.647-1.964 19.884-5.81 5.237-3.845 7.856-10.227 7.856-19.064v-22.665h-1.391c-1.473 2.946-3.601 5.892-6.383 9.001-2.782 3.109-6.464 5.645-10.965 7.691-4.582 2.046-10.228 3.109-17.101 3.109-9.165 0-17.511-2.209-25.039-6.545-7.446-4.337-13.42-10.883-17.757-19.474-4.418-8.673-6.628-19.473-6.628-32.565 0-13.091 2.21-24.301 6.628-33.383 4.419-9.082 10.311-15.955 17.839-20.7 7.528-4.746 15.874-7.037 25.039-7.037 7.037 0 12.846 1.145 17.347 3.518 4.582 2.373 8.182 5.236 10.883 8.51 2.7 3.272 4.746 6.382 6.137 9.327h1.554v-19.8h27.821v121.749c0 10.228-2.454 18.737-7.364 25.447-4.91 6.709-11.538 11.7-20.048 15.055-8.509 3.355-18.165 4.991-28.884 4.991Zm.245-71.266c5.974 0 11.047-1.473 15.302-4.337 4.173-2.945 7.446-7.118 9.573-12.519 2.21-5.482 3.274-12.027 3.274-19.637 0-7.609-1.064-14.155-3.274-19.8-2.127-5.646-5.318-10.064-9.491-13.255-4.174-3.11-9.329-4.746-15.384-4.746s-11.537 1.636-15.792 4.91c-4.173 3.272-7.365 7.772-9.492 13.418-2.128 5.727-3.191 12.191-3.191 19.392 0 7.2 1.063 13.745 3.273 19.228 2.127 5.482 5.318 9.736 9.573 12.764 4.174 3.027 9.41 4.582 15.629 4.582Zm141.56-26.51V71.839h28.23v119.786h-27.412v-21.273h-1.227c-2.7 6.709-7.119 12.191-13.338 16.446-6.137 4.255-13.747 6.382-22.748 6.382-7.855 0-14.81-1.718-20.783-5.237-5.974-3.518-10.72-8.591-14.075-15.382-3.355-6.709-5.073-14.891-5.073-24.464V71.839h28.312v71.921c0 7.609 2.046 13.664 6.219 18.083 4.173 4.5 9.655 6.709 16.365 6.709 4.173 0 8.183-.982 12.111-3.028 3.927-2.045 7.118-5.072 9.655-9.082 2.537-4.091 3.764-9.164 3.764-15.218Zm65.707-109.395v159.796h-28.23V31.828h28.23Zm44.841 162.169c-7.61 0-14.402-1.391-20.457-4.091-6.055-2.7-10.883-6.791-14.32-12.109-3.518-5.319-5.237-11.946-5.237-19.801 0-6.791 1.228-12.355 3.765-16.773 2.536-4.419 5.891-7.937 10.228-10.637 4.337-2.618 9.164-4.664 14.647-6.055 5.4-1.391 11.046-2.373 16.856-3.027 7.037-.737 12.683-1.391 17.102-1.964 4.337-.573 7.528-1.555 9.574-2.782 1.963-1.309 3.027-3.273 3.027-5.973v-.491c0-5.891-1.718-10.391-5.237-13.664-3.518-3.191-8.51-4.828-15.056-4.828-6.955 0-12.356 1.473-16.447 4.5-4.009 3.028-6.71 6.546-8.183 10.719l-26.348-3.764c2.046-7.282 5.483-13.336 10.31-18.328 4.746-4.909 10.638-8.59 17.511-11.045 6.955-2.455 14.565-3.682 22.912-3.682 5.809 0 11.537.654 17.265 2.045s10.965 3.6 15.711 6.71c4.746 3.109 8.51 7.282 11.455 12.6 2.864 5.318 4.337 11.946 4.337 19.883v80.184h-27.166v-16.446h-.9c-1.719 3.355-4.092 6.464-7.201 9.328-3.109 2.864-6.955 5.237-11.619 6.955-4.828 1.718-10.229 2.536-16.529 2.536Zm7.364-20.701c5.646 0 10.556-1.145 14.729-3.354 4.173-2.291 7.364-5.237 9.655-9.001 2.292-3.763 3.355-7.854 3.355-12.273v-14.155c-.9.737-2.373 1.391-4.5 2.046-2.128.654-4.419 1.145-7.037 1.636-2.619.491-5.155.9-7.692 1.227-2.537.328-4.746.655-6.628.901-4.173.572-8.019 1.472-11.292 2.781-3.355 1.31-5.973 3.11-7.855 5.401-1.964 2.291-2.864 5.318-2.864 8.918 0 5.237 1.882 9.164 5.728 11.782 3.682 2.782 8.51 4.091 14.401 4.091Zm64.643 18.328V71.839h27.412v19.965h1.227c2.21-6.955 5.974-12.274 11.292-16.038 5.319-3.763 11.456-5.645 18.329-5.645 1.555 0 3.355.082 5.237.163 1.964.164 3.601.328 4.91.573v25.938c-1.227-.41-3.109-.819-5.646-1.146a58.814 58.814 0 0 0-7.446-.49c-5.155 0-9.738 1.145-13.829 3.354-4.091 2.209-7.282 5.236-9.655 9.164-2.373 3.927-3.519 8.427-3.519 13.5v70.448h-28.312ZM222.077 39.192l-8.019 125.923L137.387 0l84.69 39.192Zm-53.105 162.825-57.933 33.056-57.934-33.056 11.783-28.556h92.301l11.783 28.556ZM111.039 62.675l30.357 73.803H80.681l30.358-73.803ZM7.937 165.115 0 39.192 84.69 0 7.937 165.115Z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<radialGradient
|
||||||
|
id="c"
|
||||||
|
cx="0"
|
||||||
|
cy="0"
|
||||||
|
r="1"
|
||||||
|
gradientTransform="rotate(118.122 171.182 60.81) scale(205.794)"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
>
|
||||||
|
<stop stop-color="#FF41F8" />
|
||||||
|
<stop offset=".707" stop-color="#FF41F8" stop-opacity=".5" />
|
||||||
|
<stop offset="1" stop-color="#FF41F8" stop-opacity="0" />
|
||||||
|
</radialGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="b"
|
||||||
|
x1="0"
|
||||||
|
x2="982"
|
||||||
|
y1="192"
|
||||||
|
y2="192"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
>
|
||||||
|
<stop stop-color="#F0060B" />
|
||||||
|
<stop offset="0" stop-color="#F0070C" />
|
||||||
|
<stop offset=".526" stop-color="#CC26D5" />
|
||||||
|
<stop offset="1" stop-color="#7702FF" />
|
||||||
|
</linearGradient>
|
||||||
|
<clipPath id="a"><path fill="#fff" d="M0 0h982v239H0z" /></clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
<h1>Hello, {{ title }}</h1>
|
||||||
|
<p>Congratulations! Your app is running. 🎉</p>
|
||||||
|
</div>
|
||||||
|
<div class="divider" role="separator" aria-label="Divider"></div>
|
||||||
|
<div class="right-side">
|
||||||
|
<div class="pill-group">
|
||||||
|
@for (item of [
|
||||||
|
{ title: 'Explore the Docs', link: 'https://angular.dev' },
|
||||||
|
{ title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' },
|
||||||
|
{ title: 'CLI Docs', link: 'https://angular.dev/tools/cli' },
|
||||||
|
{ title: 'Angular Language Service', link: 'https://angular.dev/tools/language-service' },
|
||||||
|
{ title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' },
|
||||||
|
]; track item.title) {
|
||||||
|
<a
|
||||||
|
class="pill"
|
||||||
|
[href]="item.link"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>
|
||||||
|
<span>{{ item.title }}</span>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
height="14"
|
||||||
|
viewBox="0 -960 960 960"
|
||||||
|
width="14"
|
||||||
|
fill="currentColor"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="social-links">
|
||||||
|
<a
|
||||||
|
href="https://github.com/angular/angular"
|
||||||
|
aria-label="Github"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="25"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 25 24"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
alt="Github"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M12.3047 0C5.50634 0 0 5.50942 0 12.3047C0 17.7423 3.52529 22.3535 8.41332 23.9787C9.02856 24.0946 9.25414 23.7142 9.25414 23.3871C9.25414 23.0949 9.24389 22.3207 9.23876 21.2953C5.81601 22.0377 5.09414 19.6444 5.09414 19.6444C4.53427 18.2243 3.72524 17.8449 3.72524 17.8449C2.61064 17.082 3.81137 17.0973 3.81137 17.0973C5.04697 17.1835 5.69604 18.3647 5.69604 18.3647C6.79321 20.2463 8.57636 19.7029 9.27978 19.3881C9.39052 18.5924 9.70736 18.0499 10.0591 17.7423C7.32641 17.4347 4.45429 16.3765 4.45429 11.6618C4.45429 10.3185 4.9311 9.22133 5.72065 8.36C5.58222 8.04931 5.16694 6.79833 5.82831 5.10337C5.82831 5.10337 6.85883 4.77319 9.2121 6.36459C10.1965 6.09082 11.2424 5.95546 12.2883 5.94931C13.3342 5.95546 14.3801 6.09082 15.3644 6.36459C17.7023 4.77319 18.7328 5.10337 18.7328 5.10337C19.3942 6.79833 18.9789 8.04931 18.8559 8.36C19.6403 9.22133 20.1171 10.3185 20.1171 11.6618C20.1171 16.3888 17.2409 17.4296 14.5031 17.7321C14.9338 18.1012 15.3337 18.8559 15.3337 20.0084C15.3337 21.6552 15.3183 22.978 15.3183 23.3779C15.3183 23.7009 15.5336 24.0854 16.1642 23.9623C21.0871 22.3484 24.6094 17.7341 24.6094 12.3047C24.6094 5.50942 19.0999 0 12.3047 0Z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
href="https://twitter.com/angular"
|
||||||
|
aria-label="Twitter"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
alt="Twitter"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
href="https://www.youtube.com/channel/UCbn1OgGei-DV7aSRo_HaAiw"
|
||||||
|
aria-label="Youtube"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="29"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 29 20"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
alt="Youtube"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
d="M27.4896 1.52422C27.9301 1.96749 28.2463 2.51866 28.4068 3.12258C29.0004 5.35161 29.0004 10 29.0004 10C29.0004 10 29.0004 14.6484 28.4068 16.8774C28.2463 17.4813 27.9301 18.0325 27.4896 18.4758C27.0492 18.9191 26.5 19.2389 25.8972 19.4032C23.6778 20 14.8068 20 14.8068 20C14.8068 20 5.93586 20 3.71651 19.4032C3.11363 19.2389 2.56449 18.9191 2.12405 18.4758C1.68361 18.0325 1.36732 17.4813 1.20683 16.8774C0.613281 14.6484 0.613281 10 0.613281 10C0.613281 10 0.613281 5.35161 1.20683 3.12258C1.36732 2.51866 1.68361 1.96749 2.12405 1.52422C2.56449 1.08095 3.11363 0.76113 3.71651 0.596774C5.93586 0 14.8068 0 14.8068 0C14.8068 0 23.6778 0 25.8972 0.596774C26.5 0.76113 27.0492 1.08095 27.4896 1.52422ZM19.3229 10L11.9036 5.77905V14.221L19.3229 10Z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * * The content above * * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * * -->
|
||||||
|
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||||
|
|
||||||
|
|
||||||
|
<router-outlet />
|
||||||
35
Ui/src/app/app.component.spec.ts
Normal file
35
Ui/src/app/app.component.spec.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
describe('AppComponent', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
RouterTestingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
}).compileComponents();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create the app', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should have as title 'Ui'`, () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
const app = fixture.componentInstance;
|
||||||
|
expect(app.title).toEqual('Ui');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render title', () => {
|
||||||
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
|
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, Ui');
|
||||||
|
});
|
||||||
|
});
|
||||||
10
Ui/src/app/app.component.ts
Normal file
10
Ui/src/app/app.component.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-root',
|
||||||
|
templateUrl: './app.component.html',
|
||||||
|
styleUrl: './app.component.css'
|
||||||
|
})
|
||||||
|
export class AppComponent {
|
||||||
|
title = 'Ui';
|
||||||
|
}
|
||||||
18
Ui/src/app/app.module.ts
Normal file
18
Ui/src/app/app.module.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
AppRoutingModule
|
||||||
|
],
|
||||||
|
providers: [],
|
||||||
|
bootstrap: [AppComponent]
|
||||||
|
})
|
||||||
|
export class AppModule { }
|
||||||
0
Ui/src/assets/.gitkeep
Normal file
0
Ui/src/assets/.gitkeep
Normal file
BIN
Ui/src/favicon.ico
Normal file
BIN
Ui/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user