Refactor to use EnvelopeDto in report generation

Updated ReportCreator and ReportItem to accept EnvelopeDto
instead of Envelope, promoting better separation of concerns
and improved data handling via DTOs.
This commit is contained in:
2026-04-01 15:32:09 +02:00
parent 5423d5317b
commit 4caf8cd192
2 changed files with 4 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
using DevExpress.Xpo;
using DigitalData.Core.Abstraction.Application.Repository;
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.ServiceHost.Exceptions;
@@ -7,7 +8,7 @@ namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
public class ReportCreator(IRepository<EnvelopeReport> reportRepo)
{
public async Task<byte[]> CreateReportAsync(Envelope envelope, CancellationToken cancel = default)
public async Task<byte[]> CreateReportAsync(EnvelopeDto envelope, CancellationToken cancel = default)
{
var reports = await reportRepo.Where(r => r.EnvelopeId == envelope.Id).ToListAsync(cancel);

View File

@@ -1,3 +1,4 @@
using EnvelopeGenerator.Application.Common.Dto;
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Entities;
@@ -7,7 +8,7 @@ public class ReportItem
{
public ReportItem() { }
public ReportItem(EnvelopeReport report, Envelope envelope)
public ReportItem(EnvelopeReport report, EnvelopeDto envelope)
{
CreatorFullName = envelope.User is not null
? $"{envelope.User.Prename} {envelope.User.Name}".Trim()