Skip to content

Commit

Permalink
todo notes
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Sep 28, 2024
1 parent d616ae3 commit daf51d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Shiny.Mediator/IRequestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public interface IRequestContext
IRequestHandler RequestHandler { get; }
}

// TODO: middleware could ref the request handler, CT, request - all from the context
// TODO: result could/should(?) come back on context? how to protect it?
// TODO: RequestStreamContext OR reuse IRequestContext?
// public class EventContext
// {
Expand Down
2 changes: 1 addition & 1 deletion src/Shiny.Mediator/Impl/RequestVoidWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Shiny.Mediator.Impl;

class RequestVoidWrapper<TRequest> where TRequest : IRequest
{
public async Task Handle(IServiceProvider services, TRequest request, CancellationToken cancellationToken)
public async Task<IRequestContext> Handle(IServiceProvider services, TRequest request, CancellationToken cancellationToken)

Check failure on line 9 in src/Shiny.Mediator/Impl/RequestVoidWrapper.cs

View workflow job for this annotation

GitHub Actions / build

'RequestVoidWrapper<TRequest>.Handle(IServiceProvider, TRequest, CancellationToken)': not all code paths return a value

Check failure on line 9 in src/Shiny.Mediator/Impl/RequestVoidWrapper.cs

View workflow job for this annotation

GitHub Actions / build

'RequestVoidWrapper<TRequest>.Handle(IServiceProvider, TRequest, CancellationToken)': not all code paths return a value
{
var requestHandler = services.GetService<IRequestHandler<TRequest>>();
if (requestHandler == null)
Expand Down
2 changes: 1 addition & 1 deletion src/Shiny.Mediator/Middleware/FlushAllStoresEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Shiny.Mediator.Middleware;
public record FlushAllStoresEvent : IEvent;


public static class MiddlewareExtensions
public static partial class MiddlewareExtensions
{
/// <summary>
/// All middleware within Shiny will respond to this event
Expand Down
16 changes: 16 additions & 0 deletions src/Shiny.Mediator/Middleware/FlushStoreByRequestKeyEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Shiny.Mediator.Middleware;

public record FlushStoreByRequestKeyEvent(IRequestKey requestKey) : IEvent;


public static partial class MiddlewareExtensions
{
/// <summary>
/// All middleware within Shiny will respond to this event
/// </summary>
/// <param name="mediator"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static Task FlushStoreByRequest(this IMediator mediator, IRequestKey requestKey, CancellationToken cancellationToken = default)
=> mediator.Publish(new FlushStoreByRequestKeyEvent(requestKey), cancellationToken);
}

0 comments on commit daf51d1

Please sign in to comment.