Soft deleting whiteboards
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user