Soft deleting whiteboards

This commit is contained in:
Veljko Tosic
2026-02-19 00:21:55 +01:00
parent c4ab8aa53e
commit c99aaa1062
7 changed files with 96 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
using AipsCore.Domain.Models.Whiteboard.Enums;
using AipsCore.Domain.Models.Whiteboard.External;
using AipsCore.Domain.Models.Whiteboard.ValueObjects;
using AipsCore.Infrastructure.Persistence.Abstract;
@@ -61,4 +62,16 @@ public class WhiteboardRepository
{
return await Context.Whiteboards.AnyAsync(w => w.Code == whiteboardCode.CodeValue);
}
public async Task SoftDeleteAsync(WhiteboardId id, CancellationToken cancellationToken = default)
{
var entity = await Context.Whiteboards.FindAsync([new Guid(id.IdValue)], cancellationToken);
if (entity != null)
{
entity.State = WhiteboardState.Deleted;
entity.DeletedAt = DateTime.UtcNow;
Context.Whiteboards.Update(entity);
}
}
}