diff --git a/src/core/DigitalData.TaskFlow.Application/Common/Interfaces/IUserRepository.cs b/src/core/DigitalData.TaskFlow.Application/Common/Interfaces/IUserRepository.cs new file mode 100644 index 0000000..07bc7b4 --- /dev/null +++ b/src/core/DigitalData.TaskFlow.Application/Common/Interfaces/IUserRepository.cs @@ -0,0 +1,8 @@ +using DigitalData.TaskFlow.Domain.ProcedureResults; + +namespace DigitalData.TaskFlow.Application.Common.Interfaces; + +public interface IUserRepository : IRepository +{ + Task> GetAuthorizedAsync(CancellationToken cancellationToken); +} diff --git a/src/infrastructure/DigitalData.TaskFlow.Infrastructure/DependencyInjection.cs b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/DependencyInjection.cs index 12b43f6..dc5dd81 100644 --- a/src/infrastructure/DigitalData.TaskFlow.Infrastructure/DependencyInjection.cs +++ b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/DependencyInjection.cs @@ -22,6 +22,7 @@ public static class DependencyInjection services.AddScoped(); services.AddScoped(); + services.AddScoped(); return services; } diff --git a/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Repositories/UserRepository.cs b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Repositories/UserRepository.cs new file mode 100644 index 0000000..8e46a14 --- /dev/null +++ b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Repositories/UserRepository.cs @@ -0,0 +1,17 @@ +using DigitalData.TaskFlow.Application.Common.Interfaces; +using DigitalData.TaskFlow.Domain.ProcedureResults; +using DigitalData.TaskFlow.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; + +namespace DigitalData.TaskFlow.Infrastructure.Repositories; + +public sealed class UserRepository(TaskFlowDbContext context) : IUserRepository +{ + public async Task> GetAuthorizedAsync(CancellationToken cancellationToken) + { + return await context.AuthorizedUsers + .FromSqlInterpolated($"EXEC [dbo].[PRCUST_F19_GET_AUTHORIZED_USERS]") + .AsNoTracking() + .ToListAsync(cancellationToken); + } +}