feat(application): enforce validation and API error mapping rules
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using DigitalData.TaskFlow.Domain.Enums;
|
||||
|
||||
namespace DigitalData.TaskFlow.Application.Common.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a 403 API exception.
|
||||
/// </summary>
|
||||
public sealed class ForbiddenApiException : ApiException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ForbiddenApiException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">Response message.</param>
|
||||
public ForbiddenApiException(string message)
|
||||
: base(403, MetaCode.NoAccess, message)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using DigitalData.TaskFlow.Domain.Enums;
|
||||
|
||||
namespace DigitalData.TaskFlow.Application.Common.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a 400 API exception.
|
||||
/// </summary>
|
||||
public sealed class InvalidRequestApiException : ApiException
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InvalidRequestApiException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">Response message.</param>
|
||||
public InvalidRequestApiException(string message)
|
||||
: base(400, MetaCode.InvalidRequest, message)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,6 @@ public interface IDocumentRepository : IRepository
|
||||
/// </summary>
|
||||
/// <param name="id">Document identifier.</param>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>Binary document payload.</returns>
|
||||
Task<DocumentBinaryResult> GetAsync(string id, CancellationToken cancellationToken);
|
||||
/// <returns>Binary document payload when found; otherwise <see langword="null"/>.</returns>
|
||||
Task<DocumentBinaryResult?> GetAsync(string id, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user