In progress
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled

This commit is contained in:
Yaojia Wang
2025-11-03 14:00:24 +01:00
parent fe8ad1c1f9
commit 1f66b25f30
74 changed files with 9609 additions and 28 deletions

View File

@@ -0,0 +1,59 @@
using ColaFlow.Modules.Identity.Domain.Aggregates.Tenants;
using ColaFlow.Modules.Identity.Domain.Aggregates.Users;
namespace ColaFlow.Modules.Identity.Domain.Repositories;
/// <summary>
/// Repository interface for User aggregate
/// </summary>
public interface IUserRepository
{
/// <summary>
/// Get user by ID
/// </summary>
Task<User?> GetByIdAsync(UserId userId, CancellationToken cancellationToken = default);
/// <summary>
/// Get user by email within a tenant
/// </summary>
Task<User?> GetByEmailAsync(TenantId tenantId, Email email, CancellationToken cancellationToken = default);
/// <summary>
/// Get user by external SSO ID within a tenant
/// </summary>
Task<User?> GetByExternalIdAsync(
TenantId tenantId,
AuthenticationProvider provider,
string externalUserId,
CancellationToken cancellationToken = default);
/// <summary>
/// Check if an email already exists within a tenant
/// </summary>
Task<bool> ExistsByEmailAsync(TenantId tenantId, Email email, CancellationToken cancellationToken = default);
/// <summary>
/// Get all users for a tenant
/// </summary>
Task<IReadOnlyList<User>> GetAllByTenantAsync(TenantId tenantId, CancellationToken cancellationToken = default);
/// <summary>
/// Get active users count for a tenant
/// </summary>
Task<int> GetActiveUsersCountAsync(TenantId tenantId, CancellationToken cancellationToken = default);
/// <summary>
/// Add a new user
/// </summary>
Task AddAsync(User user, CancellationToken cancellationToken = default);
/// <summary>
/// Update an existing user
/// </summary>
Task UpdateAsync(User user, CancellationToken cancellationToken = default);
/// <summary>
/// Delete a user (hard delete)
/// </summary>
Task DeleteAsync(User user, CancellationToken cancellationToken = default);
}