implement feedback loop

This commit is contained in:
2026-03-07 16:15:21 +01:00
parent 5d57abe913
commit 3de787e07c
18 changed files with 170 additions and 12 deletions

View File

@@ -1,3 +1,6 @@
namespace AipsCore.Application.Abstract.MessageBroking;
public interface IMessage;
public interface IMessage
{
Guid? GetWhiteboardId();
};

View File

@@ -3,4 +3,10 @@ using AipsCore.Application.Models.Shape.Command.CreateArrow;
namespace AipsCore.Application.Common.Message.AddArrow;
public record AddArrowMessage(CreateArrowCommand Command) : IMessage;
public record AddArrowMessage(CreateArrowCommand Command) : IMessage
{
public Guid? GetWhiteboardId()
{
return Guid.Parse(Command.WhiteboardId);
}
}

View File

@@ -3,4 +3,10 @@ using AipsCore.Application.Models.Shape.Command.CreateLine;
namespace AipsCore.Application.Common.Message.AddLine;
public record AddLineMessage(CreateLineCommand Command) : IMessage;
public record AddLineMessage(CreateLineCommand Command) : IMessage
{
public Guid? GetWhiteboardId()
{
return Guid.Parse(Command.WhiteboardId);
}
}

View File

@@ -3,4 +3,10 @@ using AipsCore.Application.Models.Shape.Command.CreateRectangle;
namespace AipsCore.Application.Common.Message.AddRectangle;
public record AddRectangleMessage(CreateRectangleCommand Command) : IMessage;
public record AddRectangleMessage(CreateRectangleCommand Command) : IMessage
{
public Guid? GetWhiteboardId()
{
return Guid.Parse(Command.WhiteboardId);
}
}

View File

@@ -3,4 +3,10 @@ using AipsCore.Application.Models.Shape.Command.CreateTextShape;
namespace AipsCore.Application.Common.Message.AddTextShape;
public record AddTextShapeMessage(CreateTextShapeCommand Command) : IMessage;
public record AddTextShapeMessage(CreateTextShapeCommand Command) : IMessage
{
public Guid? GetWhiteboardId()
{
return Guid.Parse(Command.WhiteboardId);
}
}

View File

@@ -0,0 +1,12 @@
using AipsCore.Application.Abstract.MessageBroking;
using AipsCore.Domain.Common.Validation;
namespace AipsCore.Application.Common.Message.ErrorMessage;
public record ErrorMessage(Guid WhiteboardId, ICollection<ValidationError> Errors) : IMessage
{
public Guid? GetWhiteboardId()
{
return WhiteboardId;
}
}

View File

@@ -0,0 +1,18 @@
using AipsCore.Application.Abstract.MessageBroking;
namespace AipsCore.Application.Common.Message.ErrorMessage;
public class ErrorMessageHandler : IMessageHandler<ErrorMessage>
{
private readonly IErrorMessageHandleStrategy _handleStrategy;
public ErrorMessageHandler(IErrorMessageHandleStrategy handleStrategy)
{
_handleStrategy = handleStrategy;
}
public async Task Handle(ErrorMessage message, CancellationToken cancellationToken)
{
await _handleStrategy.Handle(message, cancellationToken);
}
}

View File

@@ -0,0 +1,6 @@
namespace AipsCore.Application.Common.Message.ErrorMessage;
public interface IErrorMessageHandleStrategy
{
Task Handle(ErrorMessage message, CancellationToken cancellationToken);
}

View File

@@ -3,4 +3,10 @@ using AipsCore.Application.Models.Shape.Command.MoveShape;
namespace AipsCore.Application.Common.Message.MoveShape;
public record MoveShapeMessage(MoveShapeCommand Command) : IMessage;
public record MoveShapeMessage(Guid WhiteboardId, MoveShapeCommand Command) : IMessage
{
public Guid? GetWhiteboardId()
{
return WhiteboardId;
}
}

View File

@@ -2,4 +2,10 @@ using AipsCore.Application.Abstract.MessageBroking;
namespace AipsCore.Application.Common.Message.TestMessage;
public record TestMessage(string Text) : IMessage;
public record TestMessage(string Text) : IMessage
{
public Guid? GetWhiteboardId()
{
return null;
}
}