Update package references and improve code readability

- Added `Microsoft.Data.SqlClient` v5.1.1 to `EnvelopeGenerator.Application.csproj` for enhanced database compatibility.
- Refactored `ReadByUuidSignatureAsync` in `EnvelopeReceiverRepository` to improve query construction and execution clarity.
- Simplified error handling in `HomeController` by replacing `ThenAsync` with a more direct approach for processing results.
- Removed `System.Data.SqlClient` v4.8.5 and added `System.Diagnostics.PerformanceCounter` v7.0.0 in `EnvelopeGenerator.Web.csproj` to focus on performance monitoring.
This commit is contained in:
Developer 02 2025-05-10 03:47:55 +02:00
parent b01f13fb5f
commit 406ddfb226
4 changed files with 31 additions and 25 deletions

View File

@ -21,6 +21,7 @@
<PackageReference Include="DigitalData.EmailProfilerDispatcher" Version="3.0.0" />
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.18" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
<PackageReference Include="Otp.NET" Version="1.4.0" />

View File

@ -39,7 +39,11 @@ public class EnvelopeReceiverRepository : CRUDRepository<EnvelopeReceiver, (int
=> await ReadWhere(signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly).ToListAsync();
public async Task<EnvelopeReceiver?> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true)
=> await ReadWhere(uuid: uuid, signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly).FirstOrDefaultAsync();
{
var query = ReadWhere(uuid: uuid, signature: signature, withEnvelope: withEnvelope, withReceiver: withReceiver, readOnly: readOnly);
return await query.FirstOrDefaultAsync();
}
public async Task<string?> ReadAccessCodeAsync(string uuid, string signature, bool readOnly = true)
=> await ReadWhere(uuid: uuid, signature: signature, readOnly: readOnly)

View File

@ -96,31 +96,32 @@ public class HomeController : ViewControllerBase
ViewData["EnvelopeKey"] = envelopeReceiverId;
return await _envRcvService.ReadByEnvelopeReceiverIdAsync(envelopeReceiverId: envelopeReceiverId).ThenAsync<EnvelopeReceiverDto, IActionResult>(
SuccessAsync: async er =>
var er_res = await _envRcvService.ReadByEnvelopeReceiverIdAsync(envelopeReceiverId: envelopeReceiverId);
if (er_res.IsFailed)
{
_logger.LogNotice(er_res.Notices);
return this.ViewEnvelopeNotFound();
}
var er = er_res.Data;
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
bool accessCodeAlreadyRequested = await _historyService.AccessCodeAlreadyRequested(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress);
if (!accessCodeAlreadyRequested)
{
await _historyService.RecordAsync(er.EnvelopeId, er.Receiver.EmailAddress, EnvelopeStatus.AccessCodeRequested);
var mailRes = await _mailService.SendAccessCodeAsync(envelopeReceiverDto: er);
if (mailRes.IsFailed)
{
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
_logger.LogNotice(mailRes);
return this.ViewAccessCodeNotSent();
}
}
bool accessCodeAlreadyRequested = await _historyService.AccessCodeAlreadyRequested(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress);
if (!accessCodeAlreadyRequested)
{
await _historyService.RecordAsync(er.EnvelopeId, er.Receiver.EmailAddress, EnvelopeStatus.AccessCodeRequested);
var mailRes = await _mailService.SendAccessCodeAsync(envelopeReceiverDto: er);
if (mailRes.IsFailed)
{
_logger.LogNotice(mailRes);
return this.ViewAccessCodeNotSent();
}
}
return Redirect($"{envelopeReceiverId}/Locked");
},
Fail: (messages, notices) =>
{
_logger.LogNotice(notices);
return this.ViewEnvelopeNotFound();
});
return Redirect($"{envelopeReceiverId}/Locked");
}
catch(Exception ex)
{

View File

@ -2126,7 +2126,7 @@
<PackageReference Include="Quartz.Serialization.Json" Version="3.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="7.0.0" />
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" />
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />