Refactor DocumentCreateCommand and enhance validation

Updated the `DocumentCreateCommand` record to include a nullable `DataAsBase64` property for better encapsulation. Enhanced the `EnvelopeReceiverController` with logic to validate document data, ensuring that either `DataAsBase64` or `DataAsByte` is provided, but not both. Introduced a new static method `IsBase64String` to validate base64 string format.
This commit is contained in:
Developer 02
2025-05-07 01:57:22 +02:00
parent cc86e5fadd
commit f2a09ea10e
2 changed files with 47 additions and 5 deletions

View File

@@ -39,8 +39,11 @@ public record ReceiverGetOrCreateCommand([Required] IEnumerable<Signature> Signa
/// <param name="DataAsByte">
/// Die Dokumentdaten im Byte-Array-Format. Wird verwendet, wenn das Dokument als Roh-Binärdaten bereitgestellt wird.
/// </param>
/// <param name="DataAsBase64">
/// Die Dokumentdaten im Base64-String-Format. Wird verwendet, wenn das Dokument als Base64-codierter String bereitgestellt wird.
/// </param>
public record DocumentCreateCommand(byte[]? DataAsByte = null, string? DataAsBase64 = null);
public record DocumentCreateCommand(byte[]? DataAsByte = null)
{
/// <summary>
/// Die Dokumentdaten im Base64-String-Format. Wird verwendet, wenn das Dokument als Base64-codierter String bereitgestellt wird.
/// </summary>
public string? DataAsBase64 { get; set; }
};
#endregion