first commit

This commit is contained in:
Dhananjaya99
2026-09-28 11:44:26 +05:30
parent 721743ae6b
commit bffc9b1686
424 changed files with 46474 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
namespace Fitness_core_BE.Infra.Tenancy
{
// Request-scoped tenant info, populated once per request by TenantResolutionAttribute
// (Helpers/TenantResolutionAttribute.cs) so downstream repos/services can read the
// caller's resolved TenantId instead of re-deriving ClientId ad hoc via UserRoleHelper.
public interface ITenantContext
{
// Client owner / Staff: their one gym. Customer: the gym validated from X-Tenant-Id
// for this request, if any was sent. Admin: always null (see IsPlatformAdmin).
Guid? TenantId { get; }
bool IsPlatformAdmin { get; }
bool IsResolved { get; }
void SetTenant(Guid? tenantId, bool isPlatformAdmin);
}
public class TenantContext : ITenantContext
{
public Guid? TenantId { get; private set; }
public bool IsPlatformAdmin { get; private set; }
public bool IsResolved { get; private set; }
public void SetTenant(Guid? tenantId, bool isPlatformAdmin)
{
TenantId = tenantId;
IsPlatformAdmin = isPlatformAdmin;
IsResolved = true;
}
}
}