From acf136e6895ef4505c99e23de4744e2c9dcbeac8 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 24 Mar 2026 09:41:17 +0100 Subject: [PATCH] Refactor UpdateProfileProcedure and add MediatR handler Refactored UpdateProfileProcedure to implement IUpdateProcedure and expanded its properties. Removed ToObjectProcedure method. Introduced UpdateProfileProcedureHandler using MediatR's ISender for command dispatch. Modernized structure to use record types and handler classes. --- .../Profile/Commands/UpdateProfileProcedure.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/ReC.Application/Profile/Commands/UpdateProfileProcedure.cs b/src/ReC.Application/Profile/Commands/UpdateProfileProcedure.cs index 74d7fa6..072e335 100644 --- a/src/ReC.Application/Profile/Commands/UpdateProfileProcedure.cs +++ b/src/ReC.Application/Profile/Commands/UpdateProfileProcedure.cs @@ -1,9 +1,11 @@ +using MediatR; using ReC.Application.Common.Procedures.UpdateProcedure; namespace ReC.Application.Profile.Commands; public record UpdateProfileProcedure : IUpdateProcedure { + public long Id { get; set; } public bool? Active { get; set; } public byte? TypeId { get; set; } public string? Mandantor { get; set; } @@ -14,14 +16,17 @@ public record UpdateProfileProcedure : IUpdateProcedure public DateTime? FirstRun { get; set; } public DateTime? LastRun { get; set; } public string? LastResult { get; set; } +} - public UpdateObjectProcedure ToObjectProcedure(long id, string? changedWho = null) +public class UpdateProfileProcedureHandler(ISender sender) : IRequestHandler +{ + public async Task Handle(UpdateProfileProcedure request, CancellationToken cancel) { - return new UpdateObjectProcedure + return await sender.Send(new UpdateObjectProcedure { Entity = "PROFILE", - Id = id, - Profile = this - }.ChangedBy(changedWho); + Id = request.Id, + Profile = request + }, cancel); } -} +} \ No newline at end of file