Refactor: split insert procedures into separate files

Refactored insert procedure-related classes by moving each record type (Action, Endpoint, EndpointAuth, Profile, Result, EndpointParams) and the IInsertProcedure interface into their own files under the new InsertProcedure namespace. Updated InsertObjectProcedureValidator to use the new namespace. This improves code organization, readability, and maintainability.
This commit is contained in:
2026-01-14 09:26:27 +01:00
parent 854e36e71f
commit d90c2fab96
9 changed files with 136 additions and 129 deletions

View File

@@ -0,0 +1,6 @@
namespace ReC.Application.Common.Procedures.InsertProcedure;
public interface IInsertProcedure
{
public InsertObjectProcedure ToObjectProcedure();
}

View File

@@ -0,0 +1,27 @@
namespace ReC.Application.Common.Procedures.InsertProcedure;
public record InsertActionProcedure : IInsertProcedure
{
public long? ProfileId { get; set; }
public bool? Active { get; set; }
public byte? Sequence { get; set; }
public long? EndpointId { get; set; }
public long? EndpointAuthId { get; set; }
public short? EndpointParamsId { get; set; }
public short? SqlConnectionId { get; set; }
public byte? TypeId { get; set; }
public string? PreSql { get; set; }
public string? HeaderSql { get; set; }
public string? BodySql { get; set; }
public string? PostSql { get; set; }
public byte? ErrorActionId { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ACTION",
Action = this
};
}
}

View File

@@ -0,0 +1,25 @@
namespace ReC.Application.Common.Procedures.InsertProcedure;
public record InsertEndpointAuthProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public string? Description { get; set; }
public byte? TypeId { get; set; }
public string? ApiKey { get; set; }
public string? ApiValue { get; set; }
public bool? ApiKeyAddToId { get; set; }
public string? Token { get; set; }
public string? Username { get; set; }
public string? Password { get; set; }
public string? Domain { get; set; }
public string? Workstation { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ENDPOINT_AUTH",
EndpointAuth = this
};
}
}

View File

@@ -0,0 +1,20 @@
namespace ReC.Application.Common.Procedures.InsertProcedure;
public record InsertEndpointParamsProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public string? Description { get; set; }
public short? GroupId { get; set; }
public byte? Sequence { get; set; }
public string? Key { get; set; }
public string? Value { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ENDPOINT_PARAMS",
EndpointParams = this
};
}
}

View File

@@ -0,0 +1,17 @@
namespace ReC.Application.Common.Procedures.InsertProcedure;
public record InsertEndpointProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public string? Description { get; set; }
public string? Uri { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ENDPOINT",
Endpoint = this
};
}
}

View File

@@ -4,134 +4,7 @@ using Microsoft.Data.SqlClient;
using ReC.Application.Common.Exceptions;
using System.Text.Json;
namespace ReC.Application.Common.Procedures;
public interface IInsertProcedure
{
public InsertObjectProcedure ToObjectProcedure();
}
public record InsertActionProcedure : IInsertProcedure
{
public long? ProfileId { get; set; }
public bool? Active { get; set; }
public byte? Sequence { get; set; }
public long? EndpointId { get; set; }
public long? EndpointAuthId { get; set; }
public short? EndpointParamsId { get; set; }
public short? SqlConnectionId { get; set; }
public byte? TypeId { get; set; }
public string? PreSql { get; set; }
public string? HeaderSql { get; set; }
public string? BodySql { get; set; }
public string? PostSql { get; set; }
public byte? ErrorActionId { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ACTION",
Action = this
};
}
}
public record InsertEndpointProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public string? Description { get; set; }
public string? Uri { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ENDPOINT",
Endpoint = this
};
}
}
public record InsertEndpointAuthProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public string? Description { get; set; }
public byte? TypeId { get; set; }
public string? ApiKey { get; set; }
public string? ApiValue { get; set; }
public bool? ApiKeyAddToId { get; set; }
public string? Token { get; set; }
public string? Username { get; set; }
public string? Password { get; set; }
public string? Domain { get; set; }
public string? Workstation { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ENDPOINT_AUTH",
EndpointAuth = this
};
}
}
public record InsertProfileProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public byte? TypeId { get; set; }
public string? Mandantor { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public byte? LogLevelId { get; set; }
public short? LanguageId { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "PROFILE",
Profile = this
};
}
}
public record InsertResultProcedure : IInsertProcedure
{
public long? ActionId { get; set; }
public short? StatusId { get; set; }
public string? Header { get; set; }
public string? Body { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "RESULT",
Result = this
};
}
}
public record InsertEndpointParamsProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public string? Description { get; set; }
public short? GroupId { get; set; }
public byte? Sequence { get; set; }
public string? Key { get; set; }
public string? Value { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "ENDPOINT_PARAMS",
EndpointParams = this
};
}
}
namespace ReC.Application.Common.Procedures.InsertProcedure;
public record InsertObjectProcedure : IRequest<long>
{

View File

@@ -0,0 +1,21 @@
namespace ReC.Application.Common.Procedures.InsertProcedure;
public record InsertProfileProcedure : IInsertProcedure
{
public bool? Active { get; set; }
public byte? TypeId { get; set; }
public string? Mandantor { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public byte? LogLevelId { get; set; }
public short? LanguageId { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "PROFILE",
Profile = this
};
}
}

View File

@@ -0,0 +1,18 @@
namespace ReC.Application.Common.Procedures.InsertProcedure;
public record InsertResultProcedure : IInsertProcedure
{
public long? ActionId { get; set; }
public short? StatusId { get; set; }
public string? Header { get; set; }
public string? Body { get; set; }
public InsertObjectProcedure ToObjectProcedure()
{
return new InsertObjectProcedure
{
Entity = "RESULT",
Result = this
};
}
}

View File

@@ -1,5 +1,5 @@
using FluentValidation;
using ReC.Application.Common.Procedures;
using ReC.Application.Common.Procedures.InsertProcedure;
namespace ReC.Application.Common.Validations;