Queries to filter out deleted whiteboards

This commit is contained in:
Veljko Tosic
2026-02-19 00:22:39 +01:00
parent c99aaa1062
commit 7f4a7c034f
2 changed files with 5 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
using AipsCore.Application.Abstract.Query;
using AipsCore.Application.Abstract.UserContext;
using AipsCore.Domain.Models.Whiteboard.Enums;
using AipsCore.Infrastructure.Persistence.Db;
using Microsoft.EntityFrameworkCore;
@@ -32,7 +33,8 @@ public class GetRecentWhiteboardsQueryHandler : IQueryHandler<GetRecentWhiteboar
.Where(m => (
m.UserId == userIdGuid &&
m.IsBanned == false &&
m.Whiteboard != null
m.Whiteboard != null &&
m.Whiteboard.State != WhiteboardState.Deleted
))
.OrderByDescending(m => m.LastInteractedAt)
.Select(m => m.Whiteboard!);

View File

@@ -1,5 +1,6 @@
using AipsCore.Application.Abstract.Query;
using AipsCore.Application.Abstract.UserContext;
using AipsCore.Domain.Models.Whiteboard.Enums;
using AipsCore.Infrastructure.Persistence.Db;
using Microsoft.EntityFrameworkCore;
@@ -22,7 +23,7 @@ public class GetWhiteboardHistoryQueryHandler
var userIdGuid = new Guid(_userContext.GetCurrentUserId().IdValue);
return await _context.Whiteboards
.Where(w => w.OwnerId == userIdGuid)
.Where(w => w.OwnerId == userIdGuid && w.State != WhiteboardState.Deleted)
.ToListAsync(cancellationToken);
}
}