Compare commits

..

6 Commits

Author SHA1 Message Date
f0f92c5400 Ensure DocResult is included in envelope query handling
Set IncludeDocResult to true on the envelope in the query handler to guarantee the document result is included in responses. This prevents missing document data when processing envelope queries.
2026-04-09 17:10:45 +02:00
7e34f01f6a Include doc result in GetDocResultAsync query
Set IncludeDocResult to true in GetDocResultAsync to ensure the document result is included when retrieving envelope data. This change guarantees that the response contains the necessary document information.
2026-04-09 17:10:08 +02:00
f449767bf9 Add [NotMapped] for Envelope property on .NET Framework
Applied the [NotMapped] attribute to a property in the Envelope class when targeting .NET Framework, ensuring it is not mapped to a database column by Entity Framework in that environment. No changes for other frameworks.
2026-04-09 17:09:40 +02:00
f8ec6065c2 Add IncludeDocResult option to EnvelopeQueryBase
Introduced the IncludeDocResult boolean property to EnvelopeQueryBase, allowing queries to optionally include the DocResult field. By default, DocResult is excluded to prevent unnecessary loading of large binary data.
2026-04-09 16:36:30 +02:00
fabfe80666 Change FinalizeDocumentJob to scoped, add ReportCreator
Changed FinalizeDocumentJob DI registration from singleton to scoped for better instance management. Added ReportCreator as a scoped service. Removed unused EnvelopeGenerator.ServiceHost.Jobs.Infrastructure import.
2026-04-09 16:01:51 +02:00
bdb3863c07 Refactor Kestrel config and add exception middleware
Replaced "UseKestrelConfig" with "UseCustomKestrelEndpoints" and renamed the "Kestrel" section to "ServerConfig" in both Program.cs and appsettings.json. Updated Kestrel server configuration to use the new section. Added ExceptionHandlingMiddleware to the pipeline for global exception handling.
2026-04-09 15:54:38 +02:00
7 changed files with 20 additions and 7 deletions

View File

@@ -71,6 +71,7 @@ public class EnvelopeController : ControllerBase
[HttpGet("doc-result")]
public async Task<IActionResult> GetDocResultAsync([FromQuery] ReadEnvelopeQuery query, [FromQuery] bool view = false)
{
query.IncludeDocResult = true;
var envelopes = await _mediator.Send(query.Authorize(User.GetId()));
var envelope = envelopes.FirstOrDefault();

View File

@@ -14,4 +14,10 @@ public record EnvelopeQueryBase
/// Die universell eindeutige Kennung des Umschlags.
/// </summary>
public virtual string? Uuid { get; set; }
/// <summary>
/// Wenn gesetzt, wird das DocResult-Feld in der Abfrage einbezogen.
/// Standardmäßig wird DocResult nicht geladen, um große Binärdaten zu vermeiden.
/// </summary>
public bool IncludeDocResult { get; set; } = false;
}

View File

@@ -39,6 +39,7 @@ public class ReadSingleEnvelopeDocResultQueryHandler : IRequestHandler<ReadSingl
/// <returns></returns>
public async Task<byte[]> Handle(ReadSingleEnvelopeDocResultQuery request, CancellationToken cancellationToken)
{
request.Envelope.IncludeDocResult = true;
var result = await _mediator.Send(request.Envelope, cancellationToken);
return result.DocResult is byte[] docResult && docResult.Length > 0
? docResult

View File

@@ -140,7 +140,9 @@ namespace EnvelopeGenerator.Domain.Entities
= false;
#endif
#if NETFRAMEWORK
[NotMapped]
#endif
[Column("DOC_RESULT")]
public byte[]
#if nullable

View File

@@ -1,6 +1,5 @@
using EnvelopeGenerator.ServiceHost.Jobs;
using EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
using EnvelopeGenerator.ServiceHost.Jobs.Infrastructure;
using GdPicture14;
using Microsoft.Extensions.Options;
@@ -12,11 +11,12 @@ public static class DependencyInjection
public static IServiceCollection AddFinalizeDocumentJob(this IServiceCollection services, IConfiguration configuration)
{
services.Configure<WorkerOptions>(configuration.GetSection(nameof(WorkerOptions)));
services.AddSingleton<FinalizeDocumentJob>();
services.AddScoped<FinalizeDocumentJob>();
services.AddScoped<ActionService>();
services.AddSingleton<TempFiles>();
services.AddScoped<PDFBurner>();
services.AddScoped<PDFMerger>();
services.AddScoped<ReportCreator>();
//TODO: Check lifetime of services. They might be singleton or scoped.
services.AddTransient<GdViewer>();

View File

@@ -3,6 +3,7 @@ using EnvelopeGenerator.Application;
using EnvelopeGenerator.Infrastructure;
using EnvelopeGenerator.ServiceHost;
using EnvelopeGenerator.ServiceHost.Extensions;
using EnvelopeGenerator.ServiceHost.Middleware;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
using System.Globalization;
@@ -15,12 +16,12 @@ if (builder.Configuration.GetValue<bool>("UseWindowsService"))
builder.Host.UseWindowsService();
}
if (builder.Configuration.GetValue<bool>("UseKestrelConfig"))
if (builder.Configuration.GetValue<bool>("UseCustomKestrelEndpoints"))
{
builder.WebHost.ConfigureKestrel((context, serverOptions) =>
{
var kestrelSection = context.Configuration.GetSection("Kestrel");
serverOptions.Configure(kestrelSection);
var serverConfigSection = context.Configuration.GetSection("ServerConfig");
serverOptions.Configure(serverConfigSection);
});
}
#endregion
@@ -65,6 +66,8 @@ builder.Services.AddSwaggerGen();
var app = builder.Build();
app.UseMiddleware<ExceptionHandlingMiddleware>();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{

View File

@@ -14,8 +14,8 @@
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
},
"UseWindowsService": false,
"UseKestrelConfig": false,
"Kestrel": {
"UseCustomKestrelEndpoints": false,
"ServerConfig": {
"Endpoints": {
"Http": {
"Url": "http://localhost:1111"