feat(cqrs): migrate Events, Agents, Assignments, Discovery, Others to CQRS
- Events: CRUD commands/queries + EventCreatedNotification for SignalR - Agents: Register (with API key gen), Heartbeat, queries - Assignments: Assign, Failover, Release commands + queries - Discovery: 10 handlers delegating to existing probes/services - Groups/Persons/Settings/Audit/Stats: full CQRS for remaining domains - Extend IApplicationDbContext with all DbSets
This commit is contained in:
1 parent
11f7fd8d20
commit
c1b3b3d3b4
74 files changed
+1981
-2
No files matched your search
@@ -0,0 +1,26 @@
|
||||
using Heimdall.Application.Common;
|
||||
using Heimdall.Application.Services;
|
||||
using MediatR;
|
||||
|
||||
namespace Heimdall.Application.Discovery.Queries.GetScreenshot;
|
||||
|
||||
public record GetScreenshotQuery(Guid SessionId, int Index) : IRequest<ServiceResult<byte[]>>;
|
||||
|
||||
public class GetScreenshotQueryHandler : IRequestHandler<GetScreenshotQuery, ServiceResult<byte[]>>
|
||||
{
|
||||
private readonly ICameraDiscoveryService _discovery;
|
||||
|
||||
public GetScreenshotQueryHandler(ICameraDiscoveryService discovery)
|
||||
{
|
||||
_discovery = discovery;
|
||||
}
|
||||
|
||||
public async Task<ServiceResult<byte[]>> Handle(GetScreenshotQuery request, CancellationToken ct)
|
||||
{
|
||||
var bytes = await _discovery.GetScreenshotAsync(request.SessionId, request.Index, ct);
|
||||
if (bytes is null || bytes.Length == 0)
|
||||
return ServiceResult<byte[]>.NotFound("Screenshot not found");
|
||||
|
||||
return ServiceResult<byte[]>.Success(bytes);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user