Refactor controllers for MediatR and cleaner API design

- Switch EnvelopeController and ReceiverController to MediatR for all operations
- Encapsulate UserId in CreateEnvelopeCommand via Authorize() method
- Change CreateEnvelopeCommand binding to [FromBody]
- Add CancellationToken support to EnvelopeReceiverController
- Remove obsolete CRUD logic from ReceiverController; now only supports GET via MediatR
- Clean up unused dependencies and update controller summaries for clarity
This commit is contained in:
2026-01-28 14:14:04 +01:00
parent 114555c843
commit a3afeb175f
4 changed files with 34 additions and 78 deletions

View File

@@ -105,6 +105,7 @@ public class EnvelopeReceiverController : ControllerBase
/// Datenübertragungsobjekt mit Informationen zu Umschlägen, Empfängern und Unterschriften.
/// </summary>
/// <param name="request"></param>
/// <param name="cancel"></param>
/// <returns>HTTP-Antwort</returns>
/// <remarks>
/// Sample request:
@@ -140,13 +141,10 @@ public class EnvelopeReceiverController : ControllerBase
/// <response code="500">Es handelt sich um einen unerwarteten Fehler. Die Protokolle sollten überprüft werden.</response>
[Authorize]
[HttpPost]
public async Task<IActionResult> CreateAsync([FromBody] CreateEnvelopeReceiverCommand request)
public async Task<IActionResult> CreateAsync([FromBody] CreateEnvelopeReceiverCommand request, CancellationToken cancel)
{
CancellationToken cancel = default;
int userId = User.GetId();
#region Create Envelope
var envelope = await _envelopeExecutor.CreateEnvelopeAsync(userId, request.Title, request.Message, request.TFAEnabled, cancel);
var envelope = await _envelopeExecutor.CreateEnvelopeAsync(User.GetId(), request.Title, request.Message, request.TFAEnabled, cancel);
#endregion
#region Add receivers