From f16a8bcdb926690c330e714fec6d6791725c169c Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 4 Jun 2024 16:34:15 +0200 Subject: [PATCH] =?UTF-8?q?EnvelopeController=20aktualisiert,=20um=20das?= =?UTF-8?q?=20Ablehnen=20von=20Umschl=C3=A4gen=20mit=20optionalem=20Grund?= =?UTF-8?q?=20zu=20erm=C3=B6glichen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/IEnvelopeHistoryService.cs | 2 +- .../Services/EnvelopeHistoryService.cs | 4 ++-- EnvelopeGenerator.Web/Controllers/EnvelopeController.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs b/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs index d67d8828..9f4d5ce7 100644 --- a/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs +++ b/EnvelopeGenerator.Application/Contracts/IEnvelopeHistoryService.cs @@ -19,6 +19,6 @@ namespace EnvelopeGenerator.Application.Contracts Task> ReadRejectedAsync(int envelopeId, string? userReference = null); - Task> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status); + Task> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status, string? comment = null); } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs b/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs index 879570cc..43cc0f6b 100644 --- a/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs +++ b/EnvelopeGenerator.Application/Services/EnvelopeHistoryService.cs @@ -63,8 +63,8 @@ namespace EnvelopeGenerator.Application.Services public async Task> ReadRejectedAsync(int envelopeId, string? userReference = null) => await ReadAsync(envelopeId: envelopeId, userReference: userReference, status: (int)EnvelopeStatus.DocumentRejected); - public async Task> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status) => - await CreateAsync(new (EnvelopeId: envelopeId, UserReference: userReference, Status: (int)status, ActionDate: DateTime.Now)) + public async Task> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status, string? comment = null) => + await CreateAsync(new (EnvelopeId: envelopeId, UserReference: userReference, Status: (int)status, ActionDate: DateTime.Now, Comment: comment)) .ThenAsync( Success: id => Result.Success(id), Fail: (mssg, ntc) => Result.Fail().Message(mssg).Notice(ntc) diff --git a/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs b/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs index 88a5b5a6..a59a377a 100644 --- a/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs +++ b/EnvelopeGenerator.Web/Controllers/EnvelopeController.cs @@ -115,7 +115,7 @@ namespace EnvelopeGenerator.Web.Controllers [Authorize] [HttpPost("reject")] - public async Task Reject() + public async Task Reject([FromBody] string? reason = null) { try { @@ -137,7 +137,7 @@ namespace EnvelopeGenerator.Web.Controllers return Unauthorized(); } - return await _histService.RecordAsync(envRcvRes.Data.EnvelopeId, userReference: mail, EnvelopeStatus.DocumentRejected).ThenAsync( + return await _histService.RecordAsync(envRcvRes.Data.EnvelopeId, userReference: mail, EnvelopeStatus.DocumentRejected, comment: reason).ThenAsync( Success: id => NoContent(), Fail: IActionResult (mssg, ntc) => {