Changed the logic for super tenant

This commit is contained in:
ashutosh.nehete 2025-08-24 13:57:56 +05:30
parent 300f570907
commit 3864788d43

View File

@ -549,10 +549,6 @@ namespace Marco.Pms.Services.Controllers
using var scope = _serviceScopeFactory.CreateScope();
var generalHelper = scope.ServiceProvider.GetRequiredService<GeneralHelper>();
// Fetch features enabled for tenant
var featureIds = await generalHelper.GetFeatureIdsByTenentIdAsync(tenantId);
_logger.LogInfo("Enabled features for TenantId: {TenantId} -> {FeatureIds}", tenantId, string.Join(",", featureIds));
// Define static master menus for each feature section
var featureMenus = new Dictionary<Guid, List<MasterMenuVM>>
{
@ -586,6 +582,17 @@ namespace Marco.Pms.Services.Controllers
}
};
if (tenantId == superTenantId)
{
_logger.LogInfo("MasterMenu count for TenantId {TenantId}: {Count}", tenantId, featureMenus.Count);
return Ok(ApiResponse<object>.SuccessResponse(featureMenus, "Successfully fetched the master table list", 200));
}
// Fetch features enabled for tenant
var featureIds = await generalHelper.GetFeatureIdsByTenentIdAsync(tenantId);
_logger.LogInfo("Enabled features for TenantId: {TenantId} -> {FeatureIds}", tenantId, string.Join(",", featureIds));
// Aggregate menus based on enabled features
var response = featureIds
.Where(id => featureMenus.ContainsKey(id))