From a962299c959990d5d7f1e14efe5a2b70aaa23c40 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 1 Dec 2025 15:56:25 +0100 Subject: [PATCH] Refactor GetOrCreateCommand to GetOrCreateEndpointCommand Renamed `GetOrCreateCommand` to `GetOrCreateEndpointCommand` to improve clarity and consistency. Removed the old `GetOrCreateCommand` class and handler, and introduced the new `GetOrCreateEndpointCommand` class with equivalent functionality. Updated `MappingProfile` to reflect the new command name and adjusted `CreateRecActionCommand` to use the renamed command. Added the appropriate namespace for the new class to ensure proper organization. --- ...CreateCommand.cs.cs => GetOrCreateEndpointCommand.cs.cs} | 6 +++--- src/ReC.Application/Endpoints/MappingProfile.cs | 2 +- .../RecActions/Commands/CreateRecActionCommand.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/ReC.Application/Endpoints/Commands/{GetOrCreateCommand.cs.cs => GetOrCreateEndpointCommand.cs.cs} (62%) diff --git a/src/ReC.Application/Endpoints/Commands/GetOrCreateCommand.cs.cs b/src/ReC.Application/Endpoints/Commands/GetOrCreateEndpointCommand.cs.cs similarity index 62% rename from src/ReC.Application/Endpoints/Commands/GetOrCreateCommand.cs.cs rename to src/ReC.Application/Endpoints/Commands/GetOrCreateEndpointCommand.cs.cs index 368a82f..b533c3a 100644 --- a/src/ReC.Application/Endpoints/Commands/GetOrCreateCommand.cs.cs +++ b/src/ReC.Application/Endpoints/Commands/GetOrCreateEndpointCommand.cs.cs @@ -5,14 +5,14 @@ using ReC.Domain.Entities; namespace ReC.Application.Endpoints.Commands; -public class GetOrCreateCommand : IRequest +public class GetOrCreateEndpointCommand : IRequest { public string Uri { get; init; } = null!; } -public class GetOrCreateCommandHandler(IRepository repo) : IRequestHandler +public class GetOrCreateEndpointCommandHandler(IRepository repo) : IRequestHandler { - public async Task Handle(GetOrCreateCommand request, CancellationToken cancel) + public async Task Handle(GetOrCreateEndpointCommand request, CancellationToken cancel) { var endpoint = await repo.Where(e => e.Uri == request.Uri).FirstOrDefaultAsync(cancel); diff --git a/src/ReC.Application/Endpoints/MappingProfile.cs b/src/ReC.Application/Endpoints/MappingProfile.cs index 6f53a38..f268432 100644 --- a/src/ReC.Application/Endpoints/MappingProfile.cs +++ b/src/ReC.Application/Endpoints/MappingProfile.cs @@ -7,6 +7,6 @@ public class MappingProfile : AutoMapper.Profile { public MappingProfile() { - CreateMap(); + CreateMap(); } } diff --git a/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs b/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs index 99ee52d..fee5587 100644 --- a/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs +++ b/src/ReC.Application/RecActions/Commands/CreateRecActionCommand.cs @@ -30,7 +30,7 @@ public class CreateRecActionCommandHandler(ISender sender) : IRequestHandler