Refactoring

This commit is contained in:
Veljko Tosic
2026-02-19 14:13:34 +01:00
parent 7177446470
commit 83db13ef53
4 changed files with 12 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ public class DeleteWhiteboardCommandHandler : ICommandHandler<DeleteWhiteboardCo
throw new ValidationException(WhiteboardErrors.NotFound(whiteboardId));
}
if (!whiteboard.IsOwnedBy(userId))
if (!whiteboard.CanUserDelete(userId))
{
throw new ValidationException(WhiteboardErrors.OnlyOwnerCanDeleteWhiteboard(userId));
}

View File

@@ -0,0 +1,8 @@
using AipsCore.Domain.Common.ValueObjects;
namespace AipsCore.Domain.Abstract;
public interface ISoftDeletableRepository<in TId> where TId : DomainId
{
Task SoftDeleteAsync(TId id, CancellationToken cancellationToken = default);
}

View File

@@ -3,8 +3,8 @@ using AipsCore.Domain.Models.Whiteboard.ValueObjects;
namespace AipsCore.Domain.Models.Whiteboard.External;
public interface IWhiteboardRepository : IAbstractRepository<Whiteboard, WhiteboardId>
public interface IWhiteboardRepository
: IAbstractRepository<Whiteboard, WhiteboardId>, ISoftDeletableRepository<WhiteboardId>
{
Task<bool> WhiteboardCodeExists(WhiteboardCode whiteboardCode);
Task SoftDeleteAsync(WhiteboardId id, CancellationToken cancellationToken = default);
}

View File

@@ -4,7 +4,7 @@ namespace AipsCore.Domain.Models.Whiteboard;
public partial class Whiteboard
{
public bool IsOwnedBy(UserId userId)
public bool CanUserDelete(UserId userId)
{
return WhiteboardOwnerId.IdValue == userId.IdValue;
}