diff --git a/backend/api/Dtos/STEAProjectDtoBuilder.cs b/backend/api/Dtos/STEAProjectDtoBuilder.cs index 3ae1e5d87..4e8a94072 100644 --- a/backend/api/Dtos/STEAProjectDtoBuilder.cs +++ b/backend/api/Dtos/STEAProjectDtoBuilder.cs @@ -1,8 +1,6 @@ using api.Dtos; - -using Microsoft.IdentityModel.Tokens; - +using api.Helpers; namespace api.Adapters; public static class STEAProjectDtoBuilder diff --git a/backend/api/Dtos/TimeSeries/TimeSeriesDto.cs b/backend/api/Dtos/TimeSeries/TimeSeriesDto.cs index cb7a46cb0..b783ff294 100644 --- a/backend/api/Dtos/TimeSeries/TimeSeriesDto.cs +++ b/backend/api/Dtos/TimeSeries/TimeSeriesDto.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; +using api.Helpers; using api.Models; using Microsoft.IdentityModel.Tokens; diff --git a/backend/api/Helpers/CollectionUtilities.cs b/backend/api/Helpers/CollectionUtilities.cs new file mode 100644 index 000000000..728394fdf --- /dev/null +++ b/backend/api/Helpers/CollectionUtilities.cs @@ -0,0 +1,14 @@ +namespace api.Helpers +{ + public static class CollectionUtilities + { + public static bool IsNullOrEmpty(this IEnumerable enumerable) + { + if (enumerable != null) + { + return !enumerable.Any(); + } + return true; + } + } +} diff --git a/backend/api/Program.cs b/backend/api/Program.cs index a62ad9e09..c10f67397 100644 --- a/backend/api/Program.cs +++ b/backend/api/Program.cs @@ -140,7 +140,7 @@ options.UseDefaultEndpointResolver(fusionEnvironment); options.UseDefaultTokenProvider(opts => { - opts.ClientId = config["AzureAd:ClientId"]; + opts.ClientId = config["AzureAd:ClientId"] ?? throw new ArgumentNullException("AzureAd:ClientId"); opts.ClientSecret = config["AzureAd:ClientSecret"]; }); options.AddFusionRoles(); diff --git a/backend/api/api.csproj b/backend/api/api.csproj index 4329e9a4f..90b41cd84 100644 --- a/backend/api/api.csproj +++ b/backend/api/api.csproj @@ -25,10 +25,11 @@ - - + + + @@ -41,14 +42,14 @@ - - - - - - - - - + + + + + + + + +