feat(service): add ReadLastUsedReceiverNameByMail method to IEnvelopeReceiverService and EnvelopeReceiverService

- Added `ReadLastUsedReceiverNameByMail` method to `IEnvelopeReceiverService` interface.
- Implemented `ReadLastUsedReceiverNameByMail` method in `EnvelopeReceiverService` to retrieve the last used receiver's name by email and handle results with `DataResult`.
This commit is contained in:
Developer 02
2024-08-29 16:57:45 +02:00
parent 183c94fd0a
commit 1ededc1f64
3 changed files with 9 additions and 1 deletions

View File

@@ -122,5 +122,11 @@ namespace EnvelopeGenerator.Application.Services
var dto_list = _mapper.MapOrThrow<IEnumerable<EnvelopeReceiverDto>>(er_list);
return Result.Success(dto_list);
}
public async Task<DataResult<string?>> ReadLastUsedReceiverNameByMail(string mail)
{
var er = await _repository.ReadLastByReceiver(mail);
return er is null ? Result.Fail<string?>().Notice(LogLevel.None, Flag.NotFound) : Result.Success(er.Name);
}
}
}