Refactored Communications and Evidence endpoints
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace PostFundManagement.Domain.Extensions;
|
||||
|
||||
public static class General
|
||||
{
|
||||
public static ProblemDetails ToProblems(this IReadOnlyList<IError> errors, string title) => new()
|
||||
{
|
||||
Errors = errors.Select(e => new KeyValuePair<string, string[]>(e.Message,
|
||||
[.. e.Reasons.Select(r => r.Message)])).ToDictionary(),
|
||||
Detail = errors.FirstOrDefault()?.Message,
|
||||
Status = StatusCodes.Status400BadRequest,
|
||||
Title = title,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user