Queries to filter out deleted whiteboards
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using AipsCore.Application.Abstract.Query;
|
using AipsCore.Application.Abstract.Query;
|
||||||
using AipsCore.Application.Abstract.UserContext;
|
using AipsCore.Application.Abstract.UserContext;
|
||||||
|
using AipsCore.Domain.Models.Whiteboard.Enums;
|
||||||
using AipsCore.Infrastructure.Persistence.Db;
|
using AipsCore.Infrastructure.Persistence.Db;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -32,7 +33,8 @@ public class GetRecentWhiteboardsQueryHandler : IQueryHandler<GetRecentWhiteboar
|
|||||||
.Where(m => (
|
.Where(m => (
|
||||||
m.UserId == userIdGuid &&
|
m.UserId == userIdGuid &&
|
||||||
m.IsBanned == false &&
|
m.IsBanned == false &&
|
||||||
m.Whiteboard != null
|
m.Whiteboard != null &&
|
||||||
|
m.Whiteboard.State != WhiteboardState.Deleted
|
||||||
))
|
))
|
||||||
.OrderByDescending(m => m.LastInteractedAt)
|
.OrderByDescending(m => m.LastInteractedAt)
|
||||||
.Select(m => m.Whiteboard!);
|
.Select(m => m.Whiteboard!);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using AipsCore.Application.Abstract.Query;
|
using AipsCore.Application.Abstract.Query;
|
||||||
using AipsCore.Application.Abstract.UserContext;
|
using AipsCore.Application.Abstract.UserContext;
|
||||||
|
using AipsCore.Domain.Models.Whiteboard.Enums;
|
||||||
using AipsCore.Infrastructure.Persistence.Db;
|
using AipsCore.Infrastructure.Persistence.Db;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ public class GetWhiteboardHistoryQueryHandler
|
|||||||
var userIdGuid = new Guid(_userContext.GetCurrentUserId().IdValue);
|
var userIdGuid = new Guid(_userContext.GetCurrentUserId().IdValue);
|
||||||
|
|
||||||
return await _context.Whiteboards
|
return await _context.Whiteboards
|
||||||
.Where(w => w.OwnerId == userIdGuid)
|
.Where(w => w.OwnerId == userIdGuid && w.State != WhiteboardState.Deleted)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user