Soft deleting whiteboards
This commit is contained in:
@@ -6,4 +6,5 @@ namespace AipsCore.Domain.Models.Whiteboard.External;
|
||||
public interface IWhiteboardRepository : IAbstractRepository<Whiteboard, WhiteboardId>
|
||||
{
|
||||
Task<bool> WhiteboardCodeExists(WhiteboardCode whiteboardCode);
|
||||
Task SoftDeleteAsync(WhiteboardId id, CancellationToken cancellationToken = default);
|
||||
}
|
||||
@@ -38,4 +38,12 @@ public class WhiteboardErrors : AbstractErrors<Whiteboard, WhiteboardId>
|
||||
|
||||
return CreateValidationError(code, message);
|
||||
}
|
||||
|
||||
public static ValidationError OnlyOwnerCanDeleteWhiteboard(UserId currentUserId)
|
||||
{
|
||||
string code = "only_owner_can_delete_whiteboard";
|
||||
string message = $"Only owner of whiteboard can delete the whiteboard. Current user id: '{currentUserId}' is not the owner.";
|
||||
|
||||
return CreateValidationError(code, message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using AipsCore.Domain.Models.User.ValueObjects;
|
||||
|
||||
namespace AipsCore.Domain.Models.Whiteboard;
|
||||
|
||||
public partial class Whiteboard
|
||||
{
|
||||
public bool IsOwnedBy(UserId userId)
|
||||
{
|
||||
return WhiteboardOwnerId.IdValue == userId.IdValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user