From 168a4b079187b2070bee26b54ea311db770d367a Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 25 Jul 2025 17:50:38 +0200 Subject: [PATCH] feat: add ReadProfileAsync extension method for IMediator --- src/WorkFlow.API/Controllers/ProfileController.cs | 2 +- src/WorkFlow.Application/Profiles/ReadProfile.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/WorkFlow.API/Controllers/ProfileController.cs b/src/WorkFlow.API/Controllers/ProfileController.cs index c0a2ac0..f40c740 100644 --- a/src/WorkFlow.API/Controllers/ProfileController.cs +++ b/src/WorkFlow.API/Controllers/ProfileController.cs @@ -33,7 +33,7 @@ public class ProfileController : ControllerBase return Unauthorized("Failed to retrieve user identity."); } - var profile = await _mediator.Send(new ReadProfile(UserId: userId)); + var profile = await _mediator.ReadProfileAsync(userId); return profile is null ? NotFound() : Ok(profile); } catch (Exception ex) diff --git a/src/WorkFlow.Application/Profiles/ReadProfile.cs b/src/WorkFlow.Application/Profiles/ReadProfile.cs index 48bd4e0..3860189 100644 --- a/src/WorkFlow.Application/Profiles/ReadProfile.cs +++ b/src/WorkFlow.Application/Profiles/ReadProfile.cs @@ -46,3 +46,9 @@ public class ReadProfileHandler : IRequestHandler ReadProfileAsync(this IMediator mediator, int userId, bool includeObject = true) + => mediator.Send(new ReadProfile(UserId: userId, IncludeObject: includeObject)); +} \ No newline at end of file