Enhance envelope filtering in EnvelopeController

Updated the success handler to filter envelopes by Id, Status, and Uuid based on the provided envelope object. The method now returns the specific envelope instead of a list of envelopes.
This commit is contained in:
Developer 02 2025-05-07 00:27:34 +02:00
parent a7e4d6e58f
commit 1c4f7f2386

View File

@ -63,7 +63,19 @@ public class EnvelopeController : ControllerBase
{
if (User.GetId() is int intId)
return await _envelopeService.ReadByUserAsync(intId, min_status: envelope.Status, max_status: envelope.Status).ThenAsync(
Success: Ok,
Success: envelopes =>
{
if(envelope.Id is int id)
envelopes = envelopes.Where(e => e.Id == id);
if(envelope.Status is int status)
envelopes = envelopes.Where(e => e.Status == status);
if (envelope.Uuid is string uuid)
envelopes = envelopes.Where(e => e.Uuid == uuid);
return Ok(envelope);
},
Fail: IActionResult (msg, ntc) =>
{
_logger.LogNotice(ntc);