1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 16:42:50 -05:00
Files
bitwarden/src/Core/Vault/VaultServiceCollectionExtensions.cs
Nick Krantz 69b7600eab [PM-20041] Deleting Notifications when Task is completed (#5896)
* mark all notifications associated with a security task as deleted when the task is completed

* fix spelling

* formatting

* refactor "Active" to "NonDeleted"

* refactor "Active" to "NonDeleted" for stored procedure

* only send notifications per user for each notification

* move notification status updates into the DB layer to save on multiple queries and insertions from the C#

* Only return UserIds from db layer

* omit userId from `MarkTaskAsCompletedCommand` query.

The userId from the notification will be used

* update UserIds

* consistency in comments regarding `taskId` and `UserId`
2025-06-27 16:04:47 -05:00

30 lines
1.3 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>();
}
}