Refactor ReportItem creation and encapsulate mapping
Moved mapping logic from ReportCreator.ToReportItem to a new constructor in ReportItem, improving encapsulation and simplifying report generation. Updated usings to remove unused and add necessary dependencies.
This commit is contained in:
@@ -1,9 +1,26 @@
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
|
||||
|
||||
public class ReportItem
|
||||
{
|
||||
public ReportItem() { }
|
||||
|
||||
public ReportItem(EnvelopeReport report, Envelope envelope)
|
||||
{
|
||||
CreatorFullName = envelope.User is not null
|
||||
? $"{envelope.User.Prename} {envelope.User.Name}".Trim()
|
||||
: string.Empty;
|
||||
CreatorEmailAddress = envelope.User?.Email ?? string.Empty;
|
||||
EnvelopeTitle = report.HeadTitle ?? string.Empty;
|
||||
EnvelopeUuid = report.HeadUuid ?? string.Empty;
|
||||
EnvelopeCertificationType = envelope.CertificationType is int certType ? ((CertificationType)certType).ToString() : "null";
|
||||
ItemStatus = (EnvelopeStatus)report.PosStatus;
|
||||
ItemUserReference = report.PosWho ?? string.Empty;
|
||||
ItemDate = report.PosWhen ?? DateTime.MinValue;
|
||||
}
|
||||
|
||||
// Header fields (from Envelope)
|
||||
public string CreatorFullName { get; set; } = string.Empty;
|
||||
public string CreatorEmailAddress { get; set; } = string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user