Refactor scope handling with new IScoped and AuthScope
Introduce IScoped<TScope> interface for unified scope access and add AuthScope record. Remove legacy IScopedRequest interfaces to streamline scope management across the application.
This commit is contained in:
13
src/ReC.Application/Common/Interfaces/IAuthScoped.cs
Normal file
13
src/ReC.Application/Common/Interfaces/IAuthScoped.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace ReC.Application.Common.Interfaces;
|
||||||
|
|
||||||
|
public record AuthScope
|
||||||
|
{
|
||||||
|
public string AddedWho { get; } = null!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IAuthScoped : IScoped<AuthScope>
|
||||||
|
{
|
||||||
|
public string AddedWho => Scope.AddedWho;
|
||||||
|
}
|
||||||
10
src/ReC.Application/Common/Interfaces/IScoped.cs
Normal file
10
src/ReC.Application/Common/Interfaces/IScoped.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using MediatR;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace ReC.Application.Common.Interfaces;
|
||||||
|
|
||||||
|
public interface IScoped<TScope> where TScope : notnull
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public TScope Scope { get; }
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using MediatR;
|
|
||||||
|
|
||||||
namespace ReC.Application.Common.Interfaces;
|
|
||||||
|
|
||||||
public interface IScopedRequestBase<TScope> where TScope : notnull
|
|
||||||
{
|
|
||||||
public TScope Scope { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IScopedRequest<TScope> : IRequest, IScopedRequestBase<TScope> where TScope : notnull
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IScopedRequest<TScope, out TResponse> : IRequest<TResponse>, IScopedRequestBase<TScope> where TScope : notnull
|
|
||||||
{
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user