Files
ReC/src/ReC.Application/Common/Dto/RecActionViewDto.cs
TekH 98261f4e21 Refactor ProfileType to enum in RecActionViewDto
Changed ProfileType from string? to ProfileType? enum for improved type safety. Updated URI scheme assignment to use ToUriBuilderScheme(), centralizing scheme mapping logic.
2025-12-15 15:05:56 +01:00

88 lines
2.2 KiB
C#

using ReC.Domain.Constants;
namespace ReC.Application.Common.Dto;
public record RecActionViewDto
{
public required long Id { get; init; }
public long? ProfileId { get; init; }
public string? ProfileName { get; init; }
public ProfileType? ProfileType { get; init; }
public byte? Sequence { get; init; }
public long? EndpointId { get; init; }
public string? EndpointUri { get; init; }
public long? EndpointAuthId { get; init; }
public EndpointAuthType? EndpointAuthType { get; init; }
public string? EndpointAuthTypeName { get; init; }
public string? EndpointAuthApiKey { get; init; }
public string? EndpointAuthApiValue { get; init; }
public ApiKeyLocation? EndpointAuthApiKeyAddTo { get; init; }
public string? EndpointAuthApiKeyAddToName { get; init; }
public string? EndpointAuthToken { get; init; }
public string? EndpointAuthUsername { get; init; }
public string? EndpointAuthPassword { get; init; }
public string? EndpointAuthDomain { get; init; }
public string? EndpointAuthWorkstation { get; init; }
public short? EndpointParamsId { get; init; }
public short? SqlConnectionId { get; init; }
public string? SqlConnectionServer { get; init; }
public string? SqlConnectionDb { get; init; }
public string? SqlConnectionUsername { get; init; }
public string? SqlConnectionPassword { get; init; }
public RestType? RestType { get; init; }
public string? RestTypeName { get; init; }
public string? PreprocessingQuery { get; init; }
public string? HeaderQuery { get; init; }
public Dictionary<string, string>? Headers { get; set; }
public string? BodyQuery { get; init; }
public string? Body { get; set; }
public string? PostprocessingQuery { get; init; }
public ErrorAction? ErrorAction { get; init; }
public string? ErrorActionName { get; init; }
public UriBuilder ToEndpointUriBuilder()
{
var builder = EndpointUri is null ? new UriBuilder() : new UriBuilder(EndpointUri);
builder.Port = -1;
if (ProfileType is ProfileType type)
builder.Scheme = type.ToUriBuilderScheme();
return builder;
}
}