For getting whiteboard info

This commit is contained in:
Veljko Tosic
2026-02-18 20:21:05 +01:00
parent c43ad57ce5
commit eda7804f9f
3 changed files with 42 additions and 1 deletions

View File

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

View File

@@ -0,0 +1,23 @@
using AipsCore.Application.Abstract.Query;
using AipsCore.Infrastructure.Persistence.Db;
using Microsoft.EntityFrameworkCore;
namespace AipsCore.Application.Models.Whiteboard.Query.GetWhiteboard;
public class GetWhiteboardQueryHandler
: IQueryHandler<GetWhiteboardQuery, Infrastructure.Persistence.Whiteboard.Whiteboard?>
{
private readonly AipsDbContext _context;
public GetWhiteboardQueryHandler(AipsDbContext context)
{
_context = context;
}
public async Task<Infrastructure.Persistence.Whiteboard.Whiteboard?> Handle(GetWhiteboardQuery query, CancellationToken cancellationToken = default)
{
return await _context.Whiteboards
.Where(w => w.Id.ToString() == query.WhiteboardId)
.FirstOrDefaultAsync(cancellationToken);
}
}