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) => {