RT state managment and rectangle support

This commit is contained in:
2026-02-16 16:14:25 +01:00
parent 0f0418dee3
commit d9caeb2209
21 changed files with 459 additions and 5 deletions

View File

@@ -0,0 +1,5 @@
using AipsCore.Application.Abstract.Query;
namespace AipsCore.Application.Models.Whiteboard.Query.GetWhiteboardInfoRT;
public record GetWhiteboardInfoRTQuery(Guid WhiteboardId) : IQuery<Infrastructure.Persistence.Whiteboard.Whiteboard>;

View File

@@ -0,0 +1,40 @@
using AipsCore.Application.Abstract.Query;
using AipsCore.Domain.Common.Validation;
using AipsCore.Domain.Models.Whiteboard.Validation;
using AipsCore.Domain.Models.Whiteboard.ValueObjects;
using AipsCore.Infrastructure.Persistence.Db;
using Microsoft.EntityFrameworkCore;
namespace AipsCore.Application.Models.Whiteboard.Query.GetWhiteboardInfoRT;
public class GetWhiteboardInfoRTQueryHandler
: IQueryHandler<GetWhiteboardInfoRTQuery, Infrastructure.Persistence.Whiteboard.Whiteboard>
{
private readonly AipsDbContext _context;
public GetWhiteboardInfoRTQueryHandler(AipsDbContext context)
{
_context = context;
}
public async Task<Infrastructure.Persistence.Whiteboard.Whiteboard> Handle(GetWhiteboardInfoRTQuery query, CancellationToken cancellationToken = default)
{
var whiteboard = await GetQuery(query.WhiteboardId).FirstOrDefaultAsync(cancellationToken);
if (whiteboard is null)
{
throw new ValidationException(WhiteboardErrors.NotFound(new WhiteboardId(query.WhiteboardId.ToString())));
}
return whiteboard;
}
private IQueryable<Infrastructure.Persistence.Whiteboard.Whiteboard> GetQuery(Guid whiteboardId)
{
return _context.Whiteboards
.Where(w => w.Id == whiteboardId)
.Include(w => w.Memberships)
.Include(w => w.Owner)
.Include(w => w.Shapes);
}
}