Introduce a new `DocumentDetailsDto` record to encapsulate shared document metadata and elements without binary payload. Refactor `DocumentDto` to inherit from `DocumentDetailsDto`, eliminating redundant properties and improving code reuse. Convert `DocumentDto` from a class to a record for immutability. Add a parameterized constructor to `DocumentDto` for initializing binary data alongside metadata. Update `ByteData` to use the `init` accessor. These changes enhance maintainability, reduce duplication, and enforce immutability by leveraging C# records and inheritance.
28 lines
861 B
C#
28 lines
861 B
C#
namespace EnvelopeGenerator.Application.Common.Dto;
|
|
|
|
/// <summary>
|
|
/// Data Transfer Object representing document metadata and elements without binary payload.
|
|
/// </summary>
|
|
public record DocumentDetailsDto
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the unique identifier of the document.
|
|
/// </summary>
|
|
public int Id { get; init; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the envelope ID to which the document belongs.
|
|
/// </summary>
|
|
public int EnvelopeId { get; init; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the date and time when the document was added.
|
|
/// </summary>
|
|
public DateTime AddedWhen { get; init; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the collection of elements associated with the document for receiver interactions, if any.
|
|
/// </summary>
|
|
public IEnumerable<DocReceiverElementDto>? Elements { get; init; }
|
|
}
|