configure for test case

This commit is contained in:
2026-05-31 05:52:42 +02:00
parent 5bdc552492
commit b416823f38
6 changed files with 166 additions and 32 deletions

View File

@@ -6,7 +6,6 @@ using EnvelopeGenerator.Domain.Constants;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Channels;
namespace EnvelopeGenerator.API.Controllers;
@@ -16,7 +15,6 @@ namespace EnvelopeGenerator.API.Controllers;
/// <remarks>
/// Initializes a new instance of the <see cref="DocumentController"/> class.
/// </remarks>
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class DocumentController(IMediator mediator, IAuthorizationService authService, ILogger<DocumentController> logger) : ControllerBase, IAuthController
@@ -70,20 +68,21 @@ public class DocumentController(IMediator mediator, IAuthorizationService authSe
/// <param name="cancel"></param>
/// <returns></returns>
[HttpGet("{envelopeKey}")]
[Authorize(Policy = AuthPolicy.Receiver)]
public async Task<IActionResult> GetDocumentOfReceiver(string envelopeKey, CancellationToken cancel)
{
var envelopeIdStr = User.FindFirst(EnvelopeClaimNames.EnvelopeId)?.Value;
var envelopeId = 2071;
if (!int.TryParse(envelopeIdStr, out int envelopeId))
{
logger.LogError(
"Inner service error: Failed to parse Envelope ID from claims. Claim '{ClaimName}' had an invalid or missing value: '{ClaimValue}'.",
EnvelopeClaimNames.EnvelopeId,
envelopeIdStr ?? "null");
//var envelopeIdStr = User.FindFirst(EnvelopeClaimNames.EnvelopeId)?.Value;
return StatusCode(StatusCodes.Status500InternalServerError, "Inner service error: Invalid envelope claim.");
}
//if (!int.TryParse(envelopeIdStr, out int envelopeId))
//{
// logger.LogError(
// "Inner service error: Failed to parse Envelope ID from claims. Claim '{ClaimName}' had an invalid or missing value: '{ClaimValue}'.",
// EnvelopeClaimNames.EnvelopeId,
// envelopeIdStr ?? "null");
// return StatusCode(StatusCodes.Status500InternalServerError, "Inner service error: Invalid envelope claim.");
//}
var senderDoc = await mediator.Send(new ReadDocumentQuery() { EnvelopeId = envelopeId }, cancel);