Skip to content

Commit

Permalink
Integrate domain events into Domain (remaining modules) (#679)
Browse files Browse the repository at this point in the history
* chore: Challenges: Make entities subclasses of Entity

* chore: Devices: Make entities subclasses of Entity

* chore: Correct namespace of DatawalletModifiedDomainEventHandler

* chore: Correct namespace of DatawalletModifiedDomainEvent

* chore: Devices: Integrate IdentityDeletionProcessStartedDomainEvent

* chore: Devices: Integrate IdentityCreatedDomainEvent

* chore: Devices: Integrate IdentityDeletionProcessStatusChangedDomainEvent

* fix: Remove unused event bus parameter

* chore: Integrate FileUploadedDomainEvent into domain

* chore: Messages: Make entities subclasses of Entity

* chore: Integrate MessageCreatedDomainEvent into domain

* test: Messages: Add domain test for MessageCreatedDomainEvent

* chore: Relationships: Make entities subclasses of Entity

* chore: Relationships: Integrate RelationshipChangeCreatedDomainEvent into domain

* chore: Relationships: Integrate RelationshipChangeCompletedDomainEvent into domain

* chore: Relationships: Integrate RelationshipTemplateCreatedDomainEvent into domain

* test: Relationships: Write domain tests and remove handler tests for the domain events

* chore: Tokens: Make entities subclasses of Entity

* chore: Tokens: Integrate TokenCreatedDomainEvent into domain

* test: Tokens: Add domain test for TokenCreatedDomainEvent

* fix: Fix formatting

* fix: Make Test classes subclasses of AbstractTestsBase

* chore: Add todos

* chore: Rename test classes and tests

* chore: Fix formatting

* chore: Remove comments

* chore: Use factory methods

* chore: Don't use factory methods

* fix: Fix "Start of week, last monday" bug

* fix: Import missing dependency

* chore: Remove event bus call from handler and tests

* chore: Raise TierOfIdentityChangedDomainEvent automatically when changing the Tier Id

* chore: Raise IdentityDeletionProcessStatusChangedDomainEvent automatically when changing status (wip)

* fix: Remove double raises of TierOfIdentityChangedDomainEvent

* chore: Rename CancelDeletionProcessTests class to CancelDeletionProcessAsOwnerTests

* fix: Fix formatting

* test: Add three unit tests for the ChangeTier method

* test: StartOfWeek on Monday returns same day

* test: Add test for successful path

* chore: Unify test names

* chore: Raise more IdentityDeletionProcessStatusChangedDomainEvents

* chore: Rework TestDataGenerator, remove unused Factory method

* fix: Use TierId property in constructor and rewrite null check

* chore: Remove comments

* fix: Implement custom save methods manually

* chore: fix nullability warning in Identity.cs

* test: refactor TestDataGenerator.cs

* test: don't assert for NotThrow

* test: dont use the word "triggers" in tests; use "raises" instead

* chore: Remove commented out code, fix typo

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Daniel Silva <[email protected]>
Co-authored-by: Timo Notheisen <[email protected]>
  • Loading branch information
4 people authored Jun 12, 2024
1 parent 91b765c commit cf54c5f
Show file tree
Hide file tree
Showing 79 changed files with 696 additions and 580 deletions.
7 changes: 7 additions & 0 deletions Backbone.sln
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventHandlerService.Tests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseMigrator", "DatabaseMigrator\DatabaseMigrator.csproj", "{143EAC38-A2D0-4F74-88F1-3EF27413A8C6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tokens.Domain.Tests", "Modules\Tokens\test\Tokens.Domain.Tests\Tokens.Domain.Tests.csproj", "{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -715,6 +717,10 @@ Global
{143EAC38-A2D0-4F74-88F1-3EF27413A8C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{143EAC38-A2D0-4F74-88F1-3EF27413A8C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{143EAC38-A2D0-4F74-88F1-3EF27413A8C6}.Release|Any CPU.Build.0 = Release|Any CPU
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -849,6 +855,7 @@ Global
{2429FCAB-2058-4403-94DA-DA26B1655A7D} = {11FE034C-FA73-4766-99DB-D2C606018934}
{B4664E79-77A5-41AE-8480-C449ED5B2576} = {D54A9259-7708-45C1-B8D9-448B97F43B80}
{D47E0FE1-23A0-4A96-AF57-E3CE71A132AD} = {2429FCAB-2058-4403-94DA-DA26B1655A7D}
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402} = {1E437DEA-7657-48AD-ADA0-7B86608E0768}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F3BD2C6-7CB3-450F-A21A-23EA520D5B7A}
Expand Down
4 changes: 3 additions & 1 deletion BuildingBlocks/src/Tooling/Extensions/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public static DateTime StartOfDay(this DateTime pivot)
public static DateTime StartOfWeek(this DateTime pivot)
{
var result = new DateTime(pivot.Year, pivot.Month, pivot.Day, 0, 0, 0, 0, DateTimeKind.Utc);
do result = result.AddDays(-1); while (result.DayOfWeek != FIRST_DAY_OF_WEEK);

while (result.DayOfWeek != FIRST_DAY_OF_WEEK) result = result.AddDays(-1);

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Xunit;

namespace Backbone.Tooling.Tests.Tests;

public class DateTimeExtensionsTests : AbstractTestsBase
{
[Theory]
Expand Down Expand Up @@ -69,6 +70,7 @@ public IEnumerator<object[]> GetEnumerator()
yield return ["2023-02-23T23:58:30.000", DateTimeExtensions.StartOfDay, "2023-02-23T00:00:00.000"];
yield return ["2023-06-20T00:00:30.000", DateTimeExtensions.StartOfWeek, "2023-06-19T00:00:00.000"];
yield return ["2023-01-01T23:58:30.000", DateTimeExtensions.StartOfWeek, "2022-12-26T00:00:00.000"];
yield return ["2024-06-10T23:58:30.000", DateTimeExtensions.StartOfWeek, "2024-06-10T00:00:00.000"];
yield return ["2023-01-01T00:00:30.000", DateTimeExtensions.StartOfMonth, "2023-01-01T00:00:00.000"];
yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.StartOfMonth, "2023-02-01T00:00:00.000"];
yield return ["2023-02-23T00:00:30.000", DateTimeExtensions.StartOfYear, "2023-01-01T00:00:00.000"];
Expand All @@ -85,6 +87,4 @@ public IEnumerator<object[]> GetEnumerator()
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
#pragma warning restore CS8974 // Converting method group to non-delegate type


}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using System.Linq.Expressions;
using Backbone.BuildingBlocks.Domain;
using Backbone.DevelopmentKit.Identity.ValueObjects;
using Backbone.Modules.Challenges.Domain.Ids;
using Backbone.Tooling;

namespace Backbone.Modules.Challenges.Domain.Entities;

public class Challenge
public class Challenge : Entity
{
private const int EXPIRY_TIME_IN_MINUTES = 10;

public Challenge() : this(null, null) { }
public Challenge() : this(null, null)
{
}

public Challenge(IdentityAddress? createdBy, DeviceId? createdByDevice)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using Backbone.BuildingBlocks.Infrastructure.Persistence.Database.EntityTypeConfigurations;
using Backbone.Modules.Challenges.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Backbone.Modules.Challenges.Infrastructure.Persistence.Database.Configurations;

public class ChallengeEventEntityTypeConfiguration : IEntityTypeConfiguration<Challenge>
public class ChallengeEventEntityTypeConfiguration : EntityEntityTypeConfiguration<Challenge>
{
public void Configure(EntityTypeBuilder<Challenge> builder)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public async Task<ApproveDeletionProcessResponse> Handle(ApproveDeletionProcessC

_eventBus.Publish(new TierOfIdentityChangedDomainEvent(identity, oldTierId, newTierId));

var daysUntilDeletion = deletionProcess.GracePeriodEndsAt?.DaysUntilDate() ?? throw new Exception($"Expected '{nameof(deletionProcess.GracePeriodEndsAt)}' to be set but found 'null' instead.");
var daysUntilDeletion = deletionProcess.GracePeriodEndsAt?.DaysUntilDate() ??
throw new Exception($"Expected '{nameof(deletionProcess.GracePeriodEndsAt)}' to be set but found 'null' instead.");
await _notificationSender.SendNotification(identity.Address, new DeletionProcessApprovedNotification(daysUntilDeletion), cancellationToken);

return new ApproveDeletionProcessResponse(deletionProcess);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ public class Handler : IRequestHandler<CancelDeletionProcessAsOwnerCommand, Canc
{
private readonly IIdentitiesRepository _identitiesRepository;
private readonly IUserContext _userContext;
private readonly IEventBus _eventBus;
private readonly IPushNotificationSender _notificationSender;

public Handler(IIdentitiesRepository identitiesRepository, IUserContext userContext, IEventBus eventBus, IPushNotificationSender notificationSender)
public Handler(IIdentitiesRepository identitiesRepository, IUserContext userContext, IPushNotificationSender notificationSender)
{
_identitiesRepository = identitiesRepository;
_userContext = userContext;
_eventBus = eventBus;
_notificationSender = notificationSender;
}

Expand All @@ -44,9 +42,6 @@ public async Task<CancelDeletionProcessAsOwnerResponse> Handle(CancelDeletionPro
await _identitiesRepository.Update(identity, cancellationToken);
var newTierId = identity.TierId;

_eventBus.Publish(new TierOfIdentityChangedDomainEvent(identity, oldTierId, newTierId));
_eventBus.Publish(new IdentityDeletionProcessStatusChangedDomainEvent(identity.Address, deletionProcess.Id, _userContext.GetAddress()));

await _notificationSender.SendNotification(identity.Address, new DeletionProcessCancelledByOwnerNotification(), cancellationToken);

return new CancelDeletionProcessAsOwnerResponse(deletionProcess);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Backbone.BuildingBlocks.Application.Abstractions.Exceptions;
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus;
using Backbone.BuildingBlocks.Application.PushNotifications;
using Backbone.BuildingBlocks.Domain;
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository;
using Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess;
using Backbone.Modules.Devices.Domain.DomainEvents.Outgoing;
using Backbone.Modules.Devices.Domain.Entities.Identities;
using MediatR;

Expand All @@ -13,20 +11,17 @@ namespace Backbone.Modules.Devices.Application.Identities.Commands.CancelDeletio
public class Handler : IRequestHandler<CancelDeletionAsSupportCommand, CancelDeletionAsSupportResponse>
{
private readonly IIdentitiesRepository _identitiesRepository;
private readonly IEventBus _eventBus;
private readonly IPushNotificationSender _notificationSender;

public Handler(IIdentitiesRepository identitiesRepository, IEventBus eventBus, IPushNotificationSender notificationSender)
public Handler(IIdentitiesRepository identitiesRepository, IPushNotificationSender notificationSender)
{
_identitiesRepository = identitiesRepository;
_eventBus = eventBus;
_notificationSender = notificationSender;
}

public async Task<CancelDeletionAsSupportResponse> Handle(CancelDeletionAsSupportCommand request, CancellationToken cancellationToken)
{
var identity = await _identitiesRepository.FindByAddress(request.Address, cancellationToken, track: true) ?? throw new NotFoundException(nameof(Identity));
var oldTierId = identity.TierId;

var deletionProcessIdResult = IdentityDeletionProcessId.Create(request.DeletionProcessId);

Expand All @@ -38,10 +33,6 @@ public async Task<CancelDeletionAsSupportResponse> Handle(CancelDeletionAsSuppor
var deletionProcess = identity.CancelDeletionProcessAsSupport(deletionProcessId);

await _identitiesRepository.Update(identity, cancellationToken);
var newTierId = identity.TierId;

_eventBus.Publish(new TierOfIdentityChangedDomainEvent(identity, oldTierId, newTierId));
_eventBus.Publish(new IdentityDeletionProcessStatusChangedDomainEvent(identity.Address, deletionProcess.Id, null));

await _notificationSender.SendNotification(identity.Address, new DeletionProcessCancelledBySupportNotification(), cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus;
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository;
using Backbone.Modules.Devices.Domain.DomainEvents.Outgoing;
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository;
using Backbone.Modules.Devices.Domain.Entities.Identities;
using MediatR;

namespace Backbone.Modules.Devices.Application.Identities.Commands.CancelStaleIdentityDeletionProcesses;

public class Handler : IRequestHandler<CancelStaleIdentityDeletionProcessesCommand, CancelStaleIdentityDeletionProcessesResponse>
{
private readonly IEventBus _eventBus;
private readonly IIdentitiesRepository _identityRepository;

public Handler(IIdentitiesRepository identityRepository, IEventBus eventBus)
public Handler(IIdentitiesRepository identityRepository)
{
_identityRepository = identityRepository;
_eventBus = eventBus;
}

public async Task<CancelStaleIdentityDeletionProcessesResponse> Handle(CancelStaleIdentityDeletionProcessesCommand request, CancellationToken cancellationToken)
Expand All @@ -33,8 +29,6 @@ public async Task<CancelStaleIdentityDeletionProcessesResponse> Handle(CancelSta
idsOfCancelledDeletionProcesses.Add(deletionProcess.Value.Id);

await _identityRepository.Update(identity, cancellationToken);

_eventBus.Publish(new IdentityDeletionProcessStatusChangedDomainEvent(identity.Address, deletionProcess.Value.Id, null));
}

return new CancelStaleIdentityDeletionProcessesResponse(idsOfCancelledDeletionProcesses);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Backbone.BuildingBlocks.Application.Abstractions.Exceptions;
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus;
using Backbone.BuildingBlocks.Domain;
using Backbone.DevelopmentKit.Identity.ValueObjects;
using Backbone.Modules.Devices.Application.Devices.DTOs;
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository;
using Backbone.Modules.Devices.Domain.DomainEvents.Outgoing;
using Backbone.Modules.Devices.Domain.Entities;
using Backbone.Modules.Devices.Domain.Entities.Identities;
using MediatR;
Expand All @@ -20,14 +18,12 @@ public class Handler : IRequestHandler<CreateIdentityCommand, CreateIdentityResp
private readonly IOAuthClientsRepository _oAuthClientsRepository;
private readonly ChallengeValidator _challengeValidator;
private readonly ILogger<Handler> _logger;
private readonly IEventBus _eventBus;

public Handler(ChallengeValidator challengeValidator, ILogger<Handler> logger, IEventBus eventBus, IOptions<ApplicationOptions> applicationOptions, IIdentitiesRepository identitiesRepository,
public Handler(ChallengeValidator challengeValidator, ILogger<Handler> logger, IOptions<ApplicationOptions> applicationOptions, IIdentitiesRepository identitiesRepository,
IOAuthClientsRepository oAuthClientsRepository)
{
_challengeValidator = challengeValidator;
_logger = logger;
_eventBus = eventBus;
_applicationOptions = applicationOptions.Value;
_identitiesRepository = identitiesRepository;
_oAuthClientsRepository = oAuthClientsRepository;
Expand Down Expand Up @@ -69,8 +65,6 @@ public async Task<CreateIdentityResponse> Handle(CreateIdentityCommand command,

_logger.CreatedIdentity(newIdentity.Address, user.DeviceId, user.UserName!);

_eventBus.Publish(new IdentityCreatedDomainEvent(newIdentity));

return new CreateIdentityResponse
{
Address = address,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Backbone.BuildingBlocks.Application.Abstractions.Exceptions;
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus;
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository;
using Backbone.Modules.Devices.Domain.DomainEvents.Outgoing;
using Backbone.Modules.Devices.Domain.Entities.Identities;
using MediatR;

Expand All @@ -10,12 +8,10 @@ namespace Backbone.Modules.Devices.Application.Identities.Commands.StartDeletion
public class Handler : IRequestHandler<StartDeletionProcessAsSupportCommand, StartDeletionProcessAsSupportResponse>
{
private readonly IIdentitiesRepository _identitiesRepository;
private readonly IEventBus _eventBus;

public Handler(IIdentitiesRepository identitiesRepository, IEventBus eventBus)
public Handler(IIdentitiesRepository identitiesRepository)
{
_identitiesRepository = identitiesRepository;
_eventBus = eventBus;
}

public async Task<StartDeletionProcessAsSupportResponse> Handle(StartDeletionProcessAsSupportCommand request, CancellationToken cancellationToken)
Expand All @@ -25,8 +21,6 @@ public async Task<StartDeletionProcessAsSupportResponse> Handle(StartDeletionPro

await _identitiesRepository.Update(identity, cancellationToken);

_eventBus.Publish(new IdentityDeletionProcessStartedDomainEvent(identity.Address, deletionProcess.Id, null));

return new StartDeletionProcessAsSupportResponse(deletionProcess);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ public class Handler : IRequestHandler<UpdateIdentityCommand>
{
private readonly IIdentitiesRepository _identitiesRepository;
private readonly ITiersRepository _tiersRepository;
private readonly IEventBus _eventBus;

public Handler(IIdentitiesRepository identitiesRepository, ITiersRepository tiersRepository, IEventBus eventBus)
public Handler(IIdentitiesRepository identitiesRepository, ITiersRepository tiersRepository)
{
_identitiesRepository = identitiesRepository;
_tiersRepository = tiersRepository;
_eventBus = eventBus;
}

public async Task Handle(UpdateIdentityCommand request, CancellationToken cancellationToken)
Expand All @@ -39,6 +37,5 @@ public async Task Handle(UpdateIdentityCommand request, CancellationToken cancel

identity.ChangeTier(newTier.Id);
await _identitiesRepository.Update(identity, cancellationToken);
_eventBus.Publish(new TierOfIdentityChangedDomainEvent(identity, oldTier.Id, newTier.Id));
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.EventBus;
using Backbone.Modules.Devices.Application.Infrastructure.Persistence.Repository;
using Backbone.Modules.Devices.Domain.Aggregates.Tier;
using Backbone.Modules.Devices.Domain.DomainEvents.Outgoing;
using MediatR;
using Microsoft.Extensions.Logging;
using ApplicationException = Backbone.BuildingBlocks.Application.Abstractions.Exceptions.ApplicationException;
Expand All @@ -12,13 +10,11 @@ public class Handler : IRequestHandler<CreateTierCommand, CreateTierResponse>
{
private readonly ITiersRepository _tierRepository;
private readonly ILogger<Handler> _logger;
private readonly IEventBus _eventBus;

public Handler(ITiersRepository tierRepository, ILogger<Handler> logger, IEventBus eventBus)
public Handler(ITiersRepository tierRepository, ILogger<Handler> logger)
{
_tierRepository = tierRepository;
_logger = logger;
_eventBus = eventBus;
}

public async Task<CreateTierResponse> Handle(CreateTierCommand request, CancellationToken cancellationToken)
Expand All @@ -35,8 +31,6 @@ public async Task<CreateTierResponse> Handle(CreateTierCommand request, Cancella

_logger.CreatedTier(tier.Id.Value, tier.Name.Value);

_eventBus.Publish(new TierCreatedDomainEvent(tier));

return new CreateTierResponse(tier.Id, tier.Name);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Linq.Expressions;
using Backbone.BuildingBlocks.Domain;
using Backbone.DevelopmentKit.Identity.ValueObjects;
using Backbone.Modules.Devices.Domain.Aggregates.PushNotifications.Handles;
using Backbone.Tooling;
using Backbone.Tooling.Extensions;

namespace Backbone.Modules.Devices.Domain.Aggregates.PushNotifications;

public class PnsRegistration
public class PnsRegistration : Entity
{
// ReSharper disable once UnusedMember.Local
private PnsRegistration()
Expand Down
8 changes: 6 additions & 2 deletions Modules/Devices/src/Devices.Domain/Aggregates/Tier/Tier.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using Backbone.BuildingBlocks.Domain;
using Backbone.BuildingBlocks.Domain.Errors;
using Backbone.Modules.Devices.Domain.DomainEvents.Outgoing;

namespace Backbone.Modules.Devices.Domain.Aggregates.Tier;

public class Tier
public class Tier : Entity
{
public static readonly Tier QUEUED_FOR_DELETION = new(TierId.Create("TIR00000000000000001").Value, TierName.Create("Queued for Deletion").Value, false, false);

public Tier(TierName name) : this(TierId.Generate(), name, true, true)
{
RaiseDomainEvent(new TierCreatedDomainEvent(this));
}

private Tier(TierId id, TierName name, bool canBeUsedAsDefaultForClient, bool canBeManuallyAssigned)
Expand All @@ -26,7 +29,8 @@ private Tier(TierId id, TierName name, bool canBeUsedAsDefaultForClient, bool ca
public DomainError? CanBeDeleted(int clientsCount, int identitiesCount)
{
if (clientsCount > 0)
return DomainErrors.CannotDeleteUsedTier($"The Tier is used as the default Tier by one or more clients. A Tier cannot be deleted if it is the default Tier of a Client ({clientsCount} found).");
return DomainErrors.CannotDeleteUsedTier(
$"The Tier is used as the default Tier by one or more clients. A Tier cannot be deleted if it is the default Tier of a Client ({clientsCount} found).");

if (identitiesCount > 0)
return DomainErrors.CannotDeleteUsedTier($"The Tier is assigned to one or more Identities. A Tier cannot be deleted if it is assigned to an Identity ({identitiesCount} found).");
Expand Down
3 changes: 2 additions & 1 deletion Modules/Devices/src/Devices.Domain/Entities/Challenge.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Backbone.BuildingBlocks.Domain;
using Backbone.Tooling;

namespace Backbone.Modules.Devices.Domain.Entities;

public class Challenge
public class Challenge : Entity
{
// ReSharper disable once UnusedMember.Local
private Challenge()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Backbone.Modules.Devices.Domain.Entities.Identities;

public class Device
public class Device : Entity
{
// ReSharper disable once UnusedMember.Local
private Device()
Expand Down
Loading

0 comments on commit cf54c5f

Please sign in to comment.