diff --git a/src/WorkFlow.Application/Contracts/Repositories/IProfileRepository.cs b/src/WorkFlow.Application/Contracts/Repositories/IProfileRepository.cs
index bbd5ad8..ee365eb 100644
--- a/src/WorkFlow.Application/Contracts/Repositories/IProfileRepository.cs
+++ b/src/WorkFlow.Application/Contracts/Repositories/IProfileRepository.cs
@@ -11,11 +11,12 @@ public interface IProfileRepository
/// Retrieves the associated with a given user ID by calling a database function.
///
/// The unique identifier of the user whose profile is to be retrieved.
+ /// Propagates notification that operations should be canceled.
///
/// A task that represents the asynchronous operation. The task result contains the object if found; otherwise, null.
///
///
/// Logs an error if no profile is found, or if multiple profiles are returned, indicating potential data issues.
///
- Task ReadAsync(int userId);
+ Task ReadAsync(int userId, CancellationToken cancel = default);
}
\ No newline at end of file
diff --git a/src/WorkFlow.Application/Profile/ReadProfile.cs b/src/WorkFlow.Application/Profile/ReadProfile.cs
deleted file mode 100644
index d142cdc..0000000
--- a/src/WorkFlow.Application/Profile/ReadProfile.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using MediatR;
-using WorkFlow.Application.Contracts.Repositories;
-
-namespace WorkFlow.Application.Profile;
-
-public record ReadProfile(int UserId) : IRequest;
-
-public class ReadProfileHandler : IRequestHandler
-{
- private readonly IProfileRepository _repository;
-
- public ReadProfileHandler(IProfileRepository repository)
- {
- _repository = repository;
- }
-
- public async Task Handle(ReadProfile request, CancellationToken cancellationToken)
- {
- var profile = await _repository.ReadAsync(request.UserId);
- return profile;
- }
-}
diff --git a/src/WorkFlow.Application/Profiles/ReadProfile.cs b/src/WorkFlow.Application/Profiles/ReadProfile.cs
new file mode 100644
index 0000000..c70551d
--- /dev/null
+++ b/src/WorkFlow.Application/Profiles/ReadProfile.cs
@@ -0,0 +1,41 @@
+using MediatR;
+using WorkFlow.Application.Contracts.Repositories;
+
+namespace WorkFlow.Application.Profiles;
+
+///
+/// Represents a request to read a user profile by their user ID.
+///
+/// The ID of the user whose profile is being requested.
+public record ReadProfile(int UserId) : IRequest;
+
+///
+/// Handles the request by retrieving the user profile
+/// from the data store using the .
+///
+public class ReadProfileHandler : IRequestHandler
+{
+ private readonly IProfileRepository _repository;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The profile repository used to access profile data.
+ public ReadProfileHandler(IProfileRepository repository)
+ {
+ _repository = repository;
+ }
+
+ ///
+ /// Handles the request by retrieving the profile
+ /// corresponding to the specified user ID.
+ ///
+ /// The request containing the user ID.
+ /// A cancellation token for the operation.
+ /// The user profile if found; otherwise, null.
+ public async Task Handle(ReadProfile request, CancellationToken cancel = default)
+ {
+ var profile = await _repository.ReadAsync(request.UserId, cancel);
+ return profile;
+ }
+}
diff --git a/src/WorkFlow.Infrastructure/Repositories/ProfileRepository.cs b/src/WorkFlow.Infrastructure/Repositories/ProfileRepository.cs
index 210f56a..5c272e2 100644
--- a/src/WorkFlow.Infrastructure/Repositories/ProfileRepository.cs
+++ b/src/WorkFlow.Infrastructure/Repositories/ProfileRepository.cs
@@ -28,17 +28,18 @@ public class ProfileRepository : IProfileRepository
/// Retrieves the associated with a given user ID by calling a database function.
///
/// The unique identifier of the user whose profile is to be retrieved.
+ /// Propagates notification that operations should be canceled.
///
/// A task that represents the asynchronous operation. The task result contains the object if found; otherwise, null.
///
///
/// Logs an error if no profile is found, or if multiple profiles are returned, indicating potential data issues.
///
- public async Task ReadAsync(int userId)
+ public async Task ReadAsync(int userId, CancellationToken cancel = default)
{
var profiles = await _context.Profiles
.FromSqlRaw("SELECT * FROM FNMWF_GET_PROFILES ({0})", userId)
- .ToListAsync();
+ .ToListAsync(cancel);
if (profiles == null || profiles.Count == 0)
{