server/src/Core/Vault/VaultServiceCollectionExtensions.cs
Nick Krantz f88baba66b
[PM-23580] Security Task Metrics (#6164)
* add metrics endpoint for an organization to return completed and total security tasks

* refactor metrics fetch to use sql sproc for efficiency rather than having to pull all security task data

* add separate response model for security task metrics endpoint

* Pascal Case to match existing implementations

* refactor org to organization for consistency with other methods

* alter security task endpoint:
- remove "count" from variable naming
- update sproc naming

* remove enablement check

* replace orgId with organizationId
2025-08-13 08:23:22 -05:00

31 lines
1.4 KiB
C#

using Bit.Core.Vault.Commands;
using Bit.Core.Vault.Commands.Interfaces;
using Bit.Core.Vault.Queries;
using Microsoft.Extensions.DependencyInjection;
namespace Bit.Core.Vault;
public static class VaultServiceCollectionExtensions
{
public static IServiceCollection AddVaultServices(this IServiceCollection services)
{
services.AddVaultQueries();
return services;
}
private static void AddVaultQueries(this IServiceCollection services)
{
services.AddScoped<IOrganizationCiphersQuery, OrganizationCiphersQuery>();
services.AddScoped<IGetTaskDetailsForUserQuery, GetTaskDetailsForUserQuery>();
services.AddScoped<IMarkTaskAsCompleteCommand, MarkTaskAsCompletedCommand>();
services.AddScoped<IGetCipherPermissionsForUserQuery, GetCipherPermissionsForUserQuery>();
services.AddScoped<IGetTasksForOrganizationQuery, GetTasksForOrganizationQuery>();
services.AddScoped<IGetSecurityTasksNotificationDetailsQuery, GetSecurityTasksNotificationDetailsQuery>();
services.AddScoped<ICreateManyTaskNotificationsCommand, CreateManyTaskNotificationsCommand>();
services.AddScoped<ICreateManyTasksCommand, CreateManyTasksCommand>();
services.AddScoped<IMarkNotificationsForTaskAsDeletedCommand, MarkNotificationsForTaskAsDeletedCommand>();
services.AddScoped<IGetTaskMetricsForOrganizationQuery, GetTaskMetricsForOrganizationQuery>();
}
}