Replaced all instances of `EnvelopeTypeId` (int/int?) with `Type` (EnvelopeType/EnvelopeType?) across the codebase to improve type safety and readability. Updated affected properties, methods, and logic in DTOs, commands, handlers, and Razor components. Introduced conditional compilation to handle differences between .NET and .NET Framework where necessary. Removed obsolete helper methods for `EnvelopeTypeId`. This refactor ensures consistent use of the strongly-typed `EnvelopeType` enum, reducing the risk of invalid values and aligning with best practices.
105 lines
3.5 KiB
C#
105 lines
3.5 KiB
C#
using EnvelopeGenerator.Domain.Constants;
|
|
|
|
namespace EnvelopeGenerator.Server.Client.Models;
|
|
|
|
/// <summary>
|
|
/// Client-side model for the envelope receiver returned by
|
|
/// <c>GET api/EnvelopeReceiver/{envelopeKey}</c>.
|
|
/// </summary>
|
|
public record EnvelopeReceiverDto
|
|
{
|
|
public int EnvelopeId { get; init; }
|
|
public int ReceiverId { get; init; }
|
|
public int Sequence { get; init; }
|
|
|
|
public string? Name { get; init; }
|
|
public string? JobTitle { get; init; }
|
|
public string? CompanyName { get; init; }
|
|
public string? PrivateMessage { get; init; }
|
|
|
|
public DateTime AddedWhen { get; init; }
|
|
public DateTime? ChangedWhen { get; init; }
|
|
public bool HasPhoneNumber { get; init; }
|
|
|
|
public EnvelopeClientDto? Envelope { get; init; }
|
|
public ReceiverClientDto? Receiver { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Client-side model for the envelope data embedded in <see cref="EnvelopeReceiverDto"/>.
|
|
/// </summary>
|
|
public record EnvelopeClientDto
|
|
{
|
|
public int Id { get; init; }
|
|
public int UserId { get; init; }
|
|
public int Status { get; init; }
|
|
public string StatusName { get; init; } = string.Empty;
|
|
public string Uuid { get; init; } = string.Empty;
|
|
public string Title { get; init; } = string.Empty;
|
|
public string Message { get; init; } = string.Empty;
|
|
public DateTime AddedWhen { get; init; }
|
|
public DateTime? ChangedWhen { get; init; }
|
|
public string Language { get; init; } = "de-DE";
|
|
public EnvelopeType? Type { get; init; }
|
|
public string? EnvelopeTypeTitle { get; init; }
|
|
public bool UseAccessCode { get; init; }
|
|
public bool TFAEnabled { get; init; }
|
|
public IEnumerable<DocumentClientDto>? Documents { get; init; }
|
|
public EnvelopeSenderDto? User { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sender (user) information embedded in <see cref="EnvelopeClientDto"/>.
|
|
/// </summary>
|
|
public record EnvelopeSenderDto
|
|
{
|
|
public int Id { get; init; }
|
|
public string? Username { get; init; }
|
|
public string? FullName { get; init; }
|
|
public string? Email { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Client-side model for a document embedded in <see cref="EnvelopeClientDto"/>.
|
|
/// </summary>
|
|
public record DocumentClientDto
|
|
{
|
|
public int Id { get; init; }
|
|
public int EnvelopeId { get; init; }
|
|
public DateTime AddedWhen { get; init; }
|
|
public IEnumerable<SignatureClientDto>? Elements { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Client-side model for a signature/annotation element embedded in <see cref="DocumentClientDto"/>.
|
|
/// </summary>
|
|
public record SignatureClientDto
|
|
{
|
|
public int Id { get; init; }
|
|
public int DocumentId { get; init; }
|
|
public int ReceiverId { get; init; }
|
|
public int ElementType { get; init; }
|
|
public double X { get; init; }
|
|
public double Y { get; init; }
|
|
public double Width { get; init; }
|
|
public double Height { get; init; }
|
|
public int Page { get; init; }
|
|
public bool Required { get; init; }
|
|
public string? Tooltip { get; init; }
|
|
public bool ReadOnly { get; init; }
|
|
public int AnnotationIndex { get; init; }
|
|
public DateTime AddedWhen { get; init; }
|
|
public DateTime? ChangedWhen { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Client-side model for the receiver data embedded in <see cref="EnvelopeReceiverDto"/>.
|
|
/// </summary>
|
|
public record ReceiverClientDto
|
|
{
|
|
public int Id { get; init; }
|
|
public string? EmailAddress { get; init; }
|
|
public string? Signature { get; init; }
|
|
public DateTime AddedWhen { get; init; }
|
|
public DateTime? TfaRegDeadline { get; init; }
|
|
} |