Replaced string-based entity identifiers in CRUD procedure and command classes with a strongly-typed EntityType enum. Updated all relevant handlers and records to use the new enum property, improving type safety and maintainability. Added necessary using directives and updated documentation comments to reflect these changes.
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using MediatR;
|
|
using ReC.Application.Common.Procedures.InsertProcedure;
|
|
using ReC.Application.Common.Procedures;
|
|
|
|
namespace ReC.Application.EndpointAuth.Commands;
|
|
|
|
public record InsertEndpointAuthCommand : 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 class InsertEndpointAuthProcedureHandler(ISender sender) : IRequestHandler<InsertEndpointAuthCommand, long>
|
|
{
|
|
public async Task<long> Handle(InsertEndpointAuthCommand request, CancellationToken cancel)
|
|
{
|
|
return await sender.Send(new InsertObjectProcedure
|
|
{
|
|
Entity = EntityType.EndpointAuth,
|
|
EndpointAuth = request
|
|
}, cancel);
|
|
}
|
|
} |