diff --git a/pipelines/templates/deploy-summary-function-pr-template.yml b/pipelines/templates/deploy-summary-function-pr-template.yml index a1e2cec21..7e39538c7 100644 --- a/pipelines/templates/deploy-summary-function-pr-template.yml +++ b/pipelines/templates/deploy-summary-function-pr-template.yml @@ -49,7 +49,7 @@ steps: $settings = @{ clientId = "${{ parameters.clientId }}" - departmentFilter = "PRD" + departmentFilter = "" projectTypeFilter = "PRD" secretIds = @{ clientSecret = "https://$envVaultName.vault.azure.net:443/secrets/AzureAd--ClientSecret" diff --git a/pipelines/templates/deploy-summary-function-template.yml b/pipelines/templates/deploy-summary-function-template.yml index f03d00709..d39bb8a42 100644 --- a/pipelines/templates/deploy-summary-function-template.yml +++ b/pipelines/templates/deploy-summary-function-template.yml @@ -47,7 +47,7 @@ steps: $settings = @{ clientId = "${{ parameters.clientId }}" - departmentFilter = "PRD" + departmentFilter = "" projectTypeFilter = "PRD" secretIds = @{ clientSecret = Get-SecretsId -secret AzureAd--ClientSecret diff --git a/src/Fusion.Resources.Functions.Common/ApiClients/LineOrgApiClient.cs b/src/Fusion.Resources.Functions.Common/ApiClients/LineOrgApiClient.cs index cd93f4707..5e2765d83 100644 --- a/src/Fusion.Resources.Functions.Common/ApiClients/LineOrgApiClient.cs +++ b/src/Fusion.Resources.Functions.Common/ApiClients/LineOrgApiClient.cs @@ -45,6 +45,7 @@ public class OrgUnits public string? FullDepartment { get; set; } public string? SapId { get; set; } public Management Management { get; set; } + public int Level { get; set; } } public class Management diff --git a/src/Fusion.Summary.Functions/Functions/DepartmentResourceOwnerSync.cs b/src/Fusion.Summary.Functions/Functions/DepartmentResourceOwnerSync.cs index 124649c92..d00d3445c 100644 --- a/src/Fusion.Summary.Functions/Functions/DepartmentResourceOwnerSync.cs +++ b/src/Fusion.Summary.Functions/Functions/DepartmentResourceOwnerSync.cs @@ -78,7 +78,8 @@ public async Task RunAsync( // Fetch all departments var departments = (await lineOrgApiClient.GetOrgUnitDepartmentsAsync()) .DistinctBy(d => d.SapId) - .Where(d => d.FullDepartment != null && d.SapId != null); + .Where(d => d.FullDepartment != null && d.SapId != null) + .Where(d => d.Level >= 4); if (_departmentFilter.Length != 0) departments = departments.Where(d => _departmentFilter.Any(df => d.FullDepartment!.Contains(df))); diff --git a/src/backend/function/Fusion.Resources.Functions/Functions/Notifications/ResourceOwner/WeeklyReport/ScheduledReportTimerTriggerFunction.cs b/src/backend/function/Fusion.Resources.Functions/Functions/Notifications/ResourceOwner/WeeklyReport/ScheduledReportTimerTriggerFunction.cs index 519497a48..26c1c24c5 100644 --- a/src/backend/function/Fusion.Resources.Functions/Functions/Notifications/ResourceOwner/WeeklyReport/ScheduledReportTimerTriggerFunction.cs +++ b/src/backend/function/Fusion.Resources.Functions/Functions/Notifications/ResourceOwner/WeeklyReport/ScheduledReportTimerTriggerFunction.cs @@ -88,7 +88,7 @@ private async Task SendResourceOwnersToQueue(ServiceBusSender sender, int totalB // Query departments from LineOrg var departments = (await _lineOrgClient.GetOrgUnitDepartmentsAsync()) .Where(d => d.FullDepartment != null) // Exclude departments with blank department name - .Where(d => d.FullDepartment.Contains("PRD")) + .Where(d => d.Level >= 4) // Only include departments of level 4 and up .Where(x => x.Management?.Persons.Length > 0) // Exclude departments with no receivers .ToList(); diff --git a/src/backend/function/Fusion.Resources.Functions/Fusion.Resources.Functions.csproj b/src/backend/function/Fusion.Resources.Functions/Fusion.Resources.Functions.csproj index b3c4693d3..d9504ad65 100644 --- a/src/backend/function/Fusion.Resources.Functions/Fusion.Resources.Functions.csproj +++ b/src/backend/function/Fusion.Resources.Functions/Fusion.Resources.Functions.csproj @@ -7,8 +7,8 @@ - - + +