refactor(EnvelopeReceiverQueryBase): simplify EnvelopeReceiverQueryBase.Key handling
- Introduced private backing field `_key` for Key property - Removed dynamic recomputation from Envelope and Receiver - Ensured Key is only set once during initialization - Improved null handling and exception safety
This commit is contained in:
parent
c887f857cd
commit
2355a566e4
@ -17,24 +17,26 @@ public record EnvelopeReceiverQueryBase<TEnvelopeQuery, TReceiverQuery>
|
||||
where TEnvelopeQuery : EnvelopeQueryBase, new()
|
||||
where TReceiverQuery : ReceiverQueryBase, new()
|
||||
{
|
||||
private string? _key;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public virtual string? Key
|
||||
{
|
||||
get => Envelope?.Uuid is string uuid && Receiver?.Signature is string signature
|
||||
? (uuid, signature).EncodeEnvelopeReceiverId()
|
||||
: null;
|
||||
get => _key;
|
||||
init
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
_key = null;
|
||||
return;
|
||||
}
|
||||
|
||||
(string? EnvelopeUuid, string? ReceiverSignature) = value.DecodeEnvelopeReceiverId();
|
||||
if (string.IsNullOrEmpty(EnvelopeUuid) || string.IsNullOrEmpty(ReceiverSignature))
|
||||
{
|
||||
throw new BadRequestException("Der EnvelopeReceiverKey muss ein gültiger Base64-kodierter String sein, der die EnvelopeUuid und die ReceiverSignature enthält.");
|
||||
}
|
||||
|
||||
Envelope = new TEnvelopeQuery()
|
||||
{
|
||||
Uuid = EnvelopeUuid
|
||||
@ -43,6 +45,7 @@ public record EnvelopeReceiverQueryBase<TEnvelopeQuery, TReceiverQuery>
|
||||
{
|
||||
Signature = ReceiverSignature
|
||||
};
|
||||
_key = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user