Refactor update procedures to use DTO-based pattern
Refactored Update*Procedure records to encapsulate update data in dedicated DTOs (e.g., UpdateActionDto, UpdateEndpointDto) via a generic Data property. Updated interfaces to be generic and modified handlers to pass only the DTO to UpdateObjectProcedure. This improves maintainability, reduces duplication, and standardizes update logic across entities.
This commit is contained in:
@@ -1,21 +1,14 @@
|
||||
using MediatR;
|
||||
using ReC.Application.Common.Procedures.UpdateProcedure;
|
||||
using ReC.Application.Common.Procedures.UpdateProcedure.Dto;
|
||||
|
||||
namespace ReC.Application.Profile.Commands;
|
||||
|
||||
public record UpdateProfileProcedure : IUpdateProcedure
|
||||
public record UpdateProfileProcedure : IUpdateProcedure<UpdateProfileDto>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
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 DateTime? FirstRun { get; set; }
|
||||
public DateTime? LastRun { get; set; }
|
||||
public string? LastResult { get; set; }
|
||||
|
||||
public UpdateProfileDto Data { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class UpdateProfileProcedureHandler(ISender sender) : IRequestHandler<UpdateProfileProcedure, int>
|
||||
@@ -26,7 +19,7 @@ public class UpdateProfileProcedureHandler(ISender sender) : IRequestHandler<Upd
|
||||
{
|
||||
Entity = "PROFILE",
|
||||
Id = request.Id,
|
||||
Profile = request
|
||||
Profile = request.Data
|
||||
}, cancel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user