Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into show-channel-status-on-overview-page
Browse files Browse the repository at this point in the history
  • Loading branch information
gogeterobert committed Jul 8, 2022
2 parents e954a43 + 811a044 commit 3ce8f0a
Show file tree
Hide file tree
Showing 56 changed files with 1,124 additions and 1,289 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/src/Core"
schedule:
interval: "weekly"
day: "monday"
time: "08:00"
- package-ecosystem: "nuget"
directory: "/src/Application"
schedule:
Expand Down Expand Up @@ -27,6 +33,15 @@ updates:
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
- package-ecosystem: "nuget"
directory: "/tests/Infrastructure.UnitTests"
schedule:
interval: "weekly"
day: "monday"
time: "08:00"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
- package-ecosystem: "nuget"
directory: "/tests/Application.UnitTests"
schedule:
Expand Down
7 changes: 7 additions & 0 deletions Hippo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.UnitTests", "tests\Cor
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hippo.FunctionalTests", "tests\Hippo.FunctionalTests\Hippo.FunctionalTests.csproj", "{8C25A909-52B2-4326-BF00-23C053376EB5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.UnitTests", "tests\Infrastructure.UnitTests\Infrastructure.UnitTests.csproj", "{4F25FBC8-3753-495C-8799-2DEE473D4764}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -58,6 +60,10 @@ Global
{8C25A909-52B2-4326-BF00-23C053376EB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C25A909-52B2-4326-BF00-23C053376EB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C25A909-52B2-4326-BF00-23C053376EB5}.Release|Any CPU.Build.0 = Release|Any CPU
{4F25FBC8-3753-495C-8799-2DEE473D4764}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F25FBC8-3753-495C-8799-2DEE473D4764}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F25FBC8-3753-495C-8799-2DEE473D4764}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F25FBC8-3753-495C-8799-2DEE473D4764}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{96764F9E-66BB-4F64-A1BA-DE92537996E1} = {A432DA6D-ADCE-4EA1-9697-7A637F75605D}
Expand All @@ -67,5 +73,6 @@ Global
{AE958DF1-B480-4556-A68C-E042072DB7A6} = {3043D016-B9BF-4706-9773-3D58457A78AC}
{0BFC9718-3107-4E48-B952-C0B345A55A20} = {3043D016-B9BF-4706-9773-3D58457A78AC}
{8C25A909-52B2-4326-BF00-23C053376EB5} = {3043D016-B9BF-4706-9773-3D58457A78AC}
{4F25FBC8-3753-495C-8799-2DEE473D4764} = {3043D016-B9BF-4706-9773-3D58457A78AC}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion src/Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MinVer" Version="4.0.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="4.1.0" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
Expand Down
36 changes: 16 additions & 20 deletions src/Application/Channels/Commands/PatchChannelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void UpdateEnvironmentVariables(PatchChannelCommand request, Channel cha
{
var existingVariables = GetExistingEnvironmentVariables(request.ChannelId);

var envVariablesToBeAdded = EnvironmentVariablesToBeAdded(request.EnvironmentVariables.Value, channel);
var envVariablesToBeAdded = EnvironmentVariablesToBeAdded(existingVariables, request.EnvironmentVariables.Value, channel);
var envVariablesToBeUpdated = EnvironmentVariablesToBeUpdated(existingVariables, request.EnvironmentVariables.Value);
var envVariablesToBeDeleted = EnvironmentVariablesToBeRemoved(existingVariables, request.EnvironmentVariables.Value);

Expand All @@ -79,7 +79,7 @@ private void UpdateEnvironmentVariables(PatchChannelCommand request, Channel cha
{
foreach (var environmentVariable in request.EnvironmentVariables.Value)
{
var updatedEnvVar = existingVariables.FirstOrDefault(v => v.Id == environmentVariable.Id);
var updatedEnvVar = existingVariables.FirstOrDefault(v => v.Key == environmentVariable.Key);

if (updatedEnvVar is null)
{
Expand Down Expand Up @@ -107,29 +107,25 @@ private List<EnvironmentVariable> GetExistingEnvironmentVariables(Guid channelId
.ToList();
}

private static List<EnvironmentVariable> EnvironmentVariablesToBeAdded(List<UpdateEnvironmentVariableDto>? environmentVariables, Channel channel)
private static List<EnvironmentVariable> EnvironmentVariablesToBeAdded(List<EnvironmentVariable> existingVariables,
List<UpdateEnvironmentVariableDto>? environmentVariables, Channel channel)
{
if (environmentVariables is null)
{
return new List<EnvironmentVariable>();
}

var toBeAdded = new List<EnvironmentVariable>();
var newVariables = environmentVariables.Where(v => v.Id is null);
var existingVariablesKeys = existingVariables.Select(v => v.Key);

foreach (var environmentVariable in newVariables)
{
var entity = new EnvironmentVariable
return environmentVariables
.Where(v => !existingVariablesKeys.Contains(v.Key))
.Select(entity => new EnvironmentVariable
{
Key = environmentVariable.Key,
Value = environmentVariable.Value,
Key = entity.Key,
Value = entity.Value,
Channel = channel
};

toBeAdded.Add(entity);
}

return toBeAdded;
})
.ToList();
}

private static List<EnvironmentVariable> EnvironmentVariablesToBeUpdated(List<EnvironmentVariable> existingVariables,
Expand All @@ -140,9 +136,9 @@ private static List<EnvironmentVariable> EnvironmentVariablesToBeUpdated(List<En
return new List<EnvironmentVariable>();
}

var environmentVariablesIds = environmentVariables.Select(v => v.Id);
var environmentVariablesKeys = environmentVariables.Select(v => v.Key);

return existingVariables.Where(v => environmentVariablesIds.Contains(v.Id)).ToList();
return existingVariables.Where(v => environmentVariablesKeys.Contains(v.Key)).ToList();
}

private static List<EnvironmentVariable> EnvironmentVariablesToBeRemoved(List<EnvironmentVariable> existingVariables,
Expand All @@ -153,8 +149,8 @@ private static List<EnvironmentVariable> EnvironmentVariablesToBeRemoved(List<En
environmentVariables = new List<UpdateEnvironmentVariableDto>();
}

var environmentVariablesIds = environmentVariables.Select(v => v.Id);
var environmentVariablesKeys = environmentVariables.Select(v => v.Key);

return existingVariables.Where(v => !environmentVariablesIds.Contains(v.Id)).ToList();
return existingVariables.Where(v => !environmentVariablesKeys.Contains(v.Key)).ToList();
}
}
4 changes: 2 additions & 2 deletions src/Application/Channels/Queries/ChannelItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ChannelItem : IMapFrom<Channel>
{
public ChannelItem()
{
EnvironmentVariables = new List<EnvironmentVariableDto>();
EnvironmentVariables = new List<EnvironmentVariableItem>();
}

[Required]
Expand All @@ -41,7 +41,7 @@ public ChannelItem()
public CertificateItem? Certificate { get; set; }

[Required]
public IList<EnvironmentVariableDto> EnvironmentVariables { get; set; }
public IList<EnvironmentVariableItem> EnvironmentVariables { get; set; }

[NoMap]
public AppSummaryDto? AppSummary { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Hippo.Application.Common.Behaviours;

public class AuthorizationBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : notnull
public class AuthorizationBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
{
private readonly ICurrentUserService _currentUserService;
private readonly IIdentityService _identityService;
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Common/Behaviours/PerformanceBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Hippo.Application.Common.Behaviours;

public class PerformanceBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : notnull
public class PerformanceBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
{
private readonly Stopwatch _timer;
private readonly ILogger<TRequest> _logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Hippo.Application.Common.Behaviours;

public class UnhandledExceptionBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : notnull
public class UnhandledExceptionBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
{
private readonly ILogger<TRequest> _logger;

Expand Down
3 changes: 1 addition & 2 deletions src/Application/Common/Behaviours/ValidationBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

namespace Hippo.Application.Common.Behaviours;

public class ValidationBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
where TRequest : notnull
public class ValidationBehaviour<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>
{
private readonly IEnumerable<IValidator<TRequest>> _validators;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace Hippo.Application.Common.Interfaces.StorageService;

public class RevisionSpinToml
{
public RevisionTrigger? Trigger { get; set; }

public Dictionary<string, Dictionary<string, string>> Config { get; set; } = new();

[Required]
public List<RevisionComponent> Component { get; set; } = new();
[DataMember(Name = "component")]
public List<RevisionComponent> Components { get; set; } = new();
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3ce8f0a

Please sign in to comment.