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.
26 lines
782 B
C#
26 lines
782 B
C#
using MediatR;
|
|
using ReC.Application.Common.Procedures.UpdateProcedure;
|
|
using ReC.Application.Common.Procedures.UpdateProcedure.Dto;
|
|
using ReC.Application.Common.Procedures;
|
|
|
|
namespace ReC.Application.Results.Commands;
|
|
|
|
public record UpdateResultCommand : IUpdateProcedure<UpdateResultDto>
|
|
{
|
|
public long Id { get; set; }
|
|
|
|
public UpdateResultDto Data { get; set; } = null!;
|
|
}
|
|
|
|
public class UpdateResultProcedureHandler(ISender sender) : IRequestHandler<UpdateResultCommand, int>
|
|
{
|
|
public async Task<int> Handle(UpdateResultCommand request, CancellationToken cancel)
|
|
{
|
|
return await sender.Send(new UpdateObjectProcedure
|
|
{
|
|
Entity = EntityType.Result,
|
|
Id = request.Id,
|
|
Result = request.Data
|
|
}, cancel);
|
|
}
|
|
} |