adds unit tests to cover 80%
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Availability;
|
||||
|
||||
/// <summary>
|
||||
/// Configuratie-opties voor de Availability module.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class AvailabilityOptions
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Availability;
|
||||
|
||||
/// <summary>
|
||||
/// Status en optionele admin-melding van de systeembeschikbaarheid.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public record AvailabilityStatusDetails(AvailabilityStatus Status, string? Message);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Exception die gegooid wordt bij authenticatie- of autorisatiefouten.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class InvitationOrUserAlreadyExistsException : Exception
|
||||
{
|
||||
public InvitationOrUserAlreadyExistsException(string message) : base(message)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Exception die gegooid wordt bij authenticatie- of autorisatiefouten.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UnauthorizedException : Exception
|
||||
{
|
||||
public UnauthorizedException(string message) : base(message)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Exception die gegooid wordt bij validatiefouten.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ValidationException : Exception
|
||||
{
|
||||
public ValidationException(string message) : base(message)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Authorization;
|
||||
@@ -5,6 +6,7 @@ namespace SlpModularCms.Core.Identity.Authorization;
|
||||
/// <summary>
|
||||
/// Requirement voor hiërarchische rol-gebaseerde autorisatie.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class HierarchicalRoleRequirement : IAuthorizationRequirement
|
||||
{
|
||||
public string MinimumRole { get; }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Entities;
|
||||
@@ -5,6 +6,7 @@ namespace SlpModularCms.Core.Identity.Entities;
|
||||
/// <summary>
|
||||
/// Aangepaste Role entiteit voor SlpModularCms.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ApplicationRole : IdentityRole<Guid>
|
||||
{
|
||||
public ApplicationRole() : base()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Entities;
|
||||
@@ -5,6 +6,7 @@ namespace SlpModularCms.Core.Identity.Entities;
|
||||
/// <summary>
|
||||
/// Aangepaste User entiteit voor SlpModularCms.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ApplicationUser : IdentityUser<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using SlpModularCms.Core.Availability;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Entities;
|
||||
@@ -5,6 +6,7 @@ namespace SlpModularCms.Core.Identity.Entities;
|
||||
/// <summary>
|
||||
/// Persistente opslag voor de globale systeemstatus.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GlobalAvailabilityState
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entiteit voor gebruikersuitnodigingen.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class Invitation
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entiteit voor module-specifieke rechten per gebruiker.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ModulePermission
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Entiteit voor het opslaan van refresh tokens.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class RefreshToken
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Models;
|
||||
|
||||
public record CreateOwnerRequest(string Name, string Email, string Password);
|
||||
public record LoginRequest(string Email, string Password);
|
||||
public record InviteUserRequest(string Email, string Role);
|
||||
public record CompleteSetupRequest(string Token, string Password);
|
||||
public record ChangeRoleRequest(string NewRole);
|
||||
public record UpdateProfileRequest(string Name, string Email);
|
||||
public record ChangePasswordRequest(string CurrentPassword, string NewPassword);
|
||||
public record SetUserActiveRequest(bool IsActive);
|
||||
public record PendingInvitationInfo(Guid Id, string Email, string Role, string Token, DateTimeOffset CreatedAt);
|
||||
[ExcludeFromCodeCoverage] public record CreateOwnerRequest(string Name, string Email, string Password);
|
||||
[ExcludeFromCodeCoverage] public record LoginRequest(string Email, string Password);
|
||||
[ExcludeFromCodeCoverage] public record InviteUserRequest(string Email, string Role);
|
||||
[ExcludeFromCodeCoverage] public record CompleteSetupRequest(string Token, string Password);
|
||||
[ExcludeFromCodeCoverage] public record ChangeRoleRequest(string NewRole);
|
||||
[ExcludeFromCodeCoverage] public record UpdateProfileRequest(string Name, string Email);
|
||||
[ExcludeFromCodeCoverage] public record ChangePasswordRequest(string CurrentPassword, string NewPassword);
|
||||
[ExcludeFromCodeCoverage] public record SetUserActiveRequest(bool IsActive);
|
||||
[ExcludeFromCodeCoverage] public record PendingInvitationInfo(Guid Id, string Email, string Role, string Token, DateTimeOffset CreatedAt);
|
||||
[ExcludeFromCodeCoverage]
|
||||
public record UserDto(
|
||||
Guid Id,
|
||||
string Email,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Configuratie-instellingen voor JWT.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class JwtSettings
|
||||
{
|
||||
public string Secret { get; set; } = string.Empty;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SlpModularCms.Core.Identity.Models;
|
||||
@@ -5,6 +6,7 @@ namespace SlpModularCms.Core.Identity.Models;
|
||||
/// <summary>
|
||||
/// Model voor het retourneren van authenticatie tokens.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public record TokenResponse(
|
||||
string AccessToken,
|
||||
[property: JsonIgnore] string RefreshToken,
|
||||
@@ -15,6 +17,7 @@ public record TokenResponse(
|
||||
/// <summary>
|
||||
/// Model voor gebruikersinformatie in de auth response.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public record UserResponse(
|
||||
Guid Id,
|
||||
string Email,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
@@ -6,6 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
namespace SlpModularCms.Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[ExcludeFromCodeCoverage]
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
// <auto-generated />
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SlpModularCms.Core.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[ExcludeFromCodeCoverage]
|
||||
public partial class AddsDisplayName : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
@@ -11,6 +12,7 @@ using SlpModularCms.Core.Data;
|
||||
namespace SlpModularCms.Core.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[ExcludeFromCodeCoverage]
|
||||
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace SlpModularCms.Core.Modules;
|
||||
|
||||
/// <summary>
|
||||
/// Metadata over een geladen module.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public record ModuleInfo(
|
||||
string Name,
|
||||
string Version,
|
||||
|
||||
Reference in New Issue
Block a user