mirror of
https://github.com/bitwarden/server
synced 2026-02-21 11:53:42 +00:00
First pass at semaphore
This commit is contained in:
8
src/Core/Entities/DefaultCollectionSemaphore.cs
Normal file
8
src/Core/Entities/DefaultCollectionSemaphore.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Bit.Core.Entities;
|
||||
|
||||
public class DefaultCollectionSemaphore
|
||||
{
|
||||
public Guid OrganizationId { get; set; }
|
||||
public Guid OrganizationUserId { get; set; }
|
||||
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -65,10 +65,21 @@ public interface ICollectionRepository : IRepository<Collection, Guid>
|
||||
|
||||
/// <summary>
|
||||
/// Creates default user collections for the specified organization users if they do not already have one.
|
||||
/// Uses the stored procedure approach with semaphore-based duplicate prevention.
|
||||
/// </summary>
|
||||
/// <param name="organizationId">The Organization ID.</param>
|
||||
/// <param name="organizationUserIds">The Organization User IDs to create default collections for.</param>
|
||||
/// <param name="defaultCollectionName">The encrypted string to use as the default collection name.</param>
|
||||
/// <returns></returns>
|
||||
Task UpsertDefaultCollectionsAsync(Guid organizationId, IEnumerable<Guid> organizationUserIds, string defaultCollectionName);
|
||||
|
||||
/// <summary>
|
||||
/// Creates default user collections for the specified organization users using bulk insert operations.
|
||||
/// Inserts semaphore entries before collections to prevent duplicates.
|
||||
/// </summary>
|
||||
/// <param name="organizationId">The Organization ID.</param>
|
||||
/// <param name="organizationUserIds">The Organization User IDs to create default collections for.</param>
|
||||
/// <param name="defaultCollectionName">The encrypted string to use as the default collection name.</param>
|
||||
/// <returns></returns>
|
||||
Task UpsertDefaultCollectionsBulkAsync(Guid organizationId, IEnumerable<Guid> organizationUserIds, string defaultCollectionName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user