Refactor command records and simplify document handling
- Updated `ReceiverGetOrCreateCommand` to include a required `IEnumerable<Signature>`. - Modified `DocumentCreateCommand` to remove `DataAsByte` and enforce a required `DataAsBase64` property with immutability. - Cleaned up SQL command formatting in `EnvelopeReceiverAddReadSQL`. - Simplified document validation logic in `EnvelopeReceiverController` by removing redundant checks. - Changed hardcoded connection string to a variable `_cnnStr` for improved security and flexibility.
This commit is contained in:
@@ -221,16 +221,6 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
#endregion
|
||||
|
||||
#region Add document
|
||||
if(request.Document.DataAsBase64 is null)
|
||||
if (request.Document.DataAsByte is null)
|
||||
return BadRequest("No document data is found");
|
||||
else
|
||||
request.Document.DataAsBase64 = Convert.ToBase64String(request.Document.DataAsByte);
|
||||
else if (request.Document.DataAsByte is not null)
|
||||
return BadRequest("Document data cannot be assigned as both byte data and base64 string.");
|
||||
else if (!IsBase64String(request.Document.DataAsBase64))
|
||||
return BadRequest("Document data is not a base64 string");
|
||||
|
||||
var document = await _documentExecutor.CreateDocumentAsync(request.Document.DataAsBase64, envelope.Uuid, cancel);
|
||||
|
||||
if(document is null)
|
||||
@@ -279,8 +269,6 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
#endregion
|
||||
|
||||
#region Create history
|
||||
string connectionString = "Server=YOUR_SERVER;Database=YOUR_DATABASE;Trusted_Connection=True;";
|
||||
|
||||
string sql_hist = @"
|
||||
USE [DD_ECM]
|
||||
|
||||
@@ -294,7 +282,7 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
|
||||
SELECT @OUT_SUCCESS as [@OUT_SUCCESS];";
|
||||
|
||||
using (SqlConnection conn = new(connectionString))
|
||||
using (SqlConnection conn = new(_cnnStr))
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user