Refactor controllers and update envelope status handling

- Updated `TestEnvelopeHistoryController` to use `EnvelopeStatus` for status parameters and marked it as obsolete.
- Modified `TestViewController` with new route attributes, simplified constructor, and improved error handling in HTTP methods.
- Cleaned up `DebugEnvelopes.cshtml` by removing unnecessary using directives and ensuring type safety in envelope grouping.
This commit is contained in:
2025-06-27 13:51:51 +02:00
parent fcbe956095
commit 6f73ba929c
3 changed files with 49 additions and 48 deletions

View File

@@ -3,9 +3,11 @@ using EnvelopeGenerator.Application.Contracts.Services;
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
using EnvelopeGenerator.Domain.Entities;
using Microsoft.AspNetCore.Mvc;
using static EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Web.Controllers.Test;
[Obsolete("Use MediatR")]
public class TestEnvelopeHistoryController : CRUDControllerBase<IEnvelopeHistoryService, EnvelopeHistoryCreateDto, EnvelopeHistoryDto, EnvelopeHistoryDto, EnvelopeHistory, long>
{
public TestEnvelopeHistoryController(ILogger<TestEnvelopeHistoryController> logger, IEnvelopeHistoryService service) : base(logger, service)
@@ -13,7 +15,7 @@ public class TestEnvelopeHistoryController : CRUDControllerBase<IEnvelopeHistory
}
[HttpGet("Count")]
public async Task<IActionResult> Count(int? envelopeId = null, string? userReference = null, int? status = null)
public async Task<IActionResult> Count(int? envelopeId = null, string? userReference = null, EnvelopeStatus? status = null)
{
return Ok(await _service.CountAsync(envelopeId, userReference, status));
}
@@ -25,7 +27,7 @@ public class TestEnvelopeHistoryController : CRUDControllerBase<IEnvelopeHistory
}
[HttpGet]
public async Task<IActionResult> GetAsyncWith(int? envelopeId = null, string? userReference = null, int? status = null)
public async Task<IActionResult> GetAsyncWith(int? envelopeId = null, string? userReference = null, EnvelopeStatus? status = null)
{
return Ok(await _service.ReadAsync(envelopeId: envelopeId, userReference: userReference, status: status));
}