From 02aeaea8a99c4288e069ea47a71f5588ab76c41d Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Mon, 12 May 2025 16:36:21 +0200 Subject: [PATCH] Refactor EnvelopeHistoryDto to use properties The EnvelopeHistoryDto class has been changed from a record type with positional parameters to a traditional class structure with explicit properties. This refactor improves readability and maintainability, and includes XML documentation for each property. The GetHashCode method has also been overridden to ensure uniqueness based on the Id property. --- .../EnvelopeHistory/EnvelopeHistoryDto.cs | 91 +++++++++++++------ 1 file changed, 64 insertions(+), 27 deletions(-) diff --git a/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryDto.cs b/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryDto.cs index 0eb887f6..ececcbd9 100644 --- a/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryDto.cs +++ b/EnvelopeGenerator.Application/DTOs/EnvelopeHistory/EnvelopeHistoryDto.cs @@ -1,36 +1,73 @@ using DigitalData.Core.Abstractions; -using DigitalData.Core.DTO; using DigitalData.UserManager.Application.DTOs.User; using EnvelopeGenerator.Application.DTOs.Receiver; -using Microsoft.AspNetCore.Mvc; using static EnvelopeGenerator.Common.Constants; namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory; /// -/// +/// Data Transfer Object representing the history of an envelope, including status, sender, receiver, and related metadata. /// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -[ApiExplorerSettings(IgnoreApi = true)] -public record EnvelopeHistoryDto( - long Id, - int EnvelopeId, - string UserReference, - int Status, - string? StatusName, - DateTime AddedWhen, - DateTime? ActionDate, - UserCreateDto? Sender, - ReceiverReadDto? Receiver, - ReferenceType ReferenceType, - string? Comment = null) : BaseDTO(Id), IUnique; \ No newline at end of file +public record EnvelopeHistoryDto : IUnique +{ + /// + /// Unique identifier for the envelope history entry. + /// + public long Id { get; set; } + + /// + /// Identifier of the associated envelope. + /// + public int EnvelopeId { get; set; } + + /// + /// Reference string for the user related to this history entry. + /// + public string UserReference { get; set; } + + /// + /// Status code of the envelope at this history point. + /// + public int Status { get; set; } + + /// + /// Human-readable name of the status. + /// + public string? StatusName { get; set; } + + /// + /// Date and time when this history entry was added. + /// + public DateTime AddedWhen { get; set; } + + /// + /// Date and time when an action was performed, if applicable. + /// + public DateTime? ActionDate { get; set; } + + /// + /// Information about the sender associated with this history entry. + /// + public UserCreateDto? Sender { get; set; } + + /// + /// Information about the receiver associated with this history entry. + /// + public ReceiverReadDto? Receiver { get; set; } + + /// + /// Type of reference for this history entry. + /// + public ReferenceType ReferenceType { get; set; } + + /// + /// Optional comment related to this history entry. + /// + public string? Comment { get; set; } + + /// + public override int GetHashCode() + { + return Id.GetHashCode(); + } +};