Skip to content

Commit f6cc2a6

Browse files
authored
Feature/220998 clean architecture (#16)
* Converted to Clean Architecture pattern * Added middleware to handle permission cache, host name and template id retrieval * Added dashboard and implement logic to read user's applications from the API * Added logic for the New Application button to create an application via API
1 parent 9d178a2 commit f6cc2a6

62 files changed

Lines changed: 1116 additions & 757 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
echo "checked-out-sha=${CHECKED_OUT_SHA}" >> $GITHUB_OUTPUT
4444
echo "image-name=${{ env.IMAGE_NAME }}" >> $GITHUB_OUTPUT
4545
46+
4647
build-import-deploy:
4748
name: Deploy to ${{ needs.set-env.outputs.environment }}
4849
runs-on: ubuntu-24.04
@@ -54,6 +55,9 @@ jobs:
5455
id-token: write
5556

5657
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
5761
- name: Build
5862
uses: DFE-Digital/deploy-azure-container-apps-action/.github/actions/build@v5.2.1
5963
with:

DfE.ExternalApplications.Web.sln

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,36 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.10.35122.118
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DfE.ExternalApplications.Web", "src\DfE.ExternalApplications.Web.csproj", "{122FBAC3-C50C-4BEB-A838-AAC742F3C8BD}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DfE.ExternalApplications.Web", "src\DfE.ExternalApplications.Web\DfE.ExternalApplications.Web.csproj", "{CA38CBED-6681-4A44-BEC8-832D5171D59F}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DfE.ExternalApplications.Domain", "src\DfE.ExternalApplications.Domain\DfE.ExternalApplications.Domain.csproj", "{F8DC3D4E-5AB5-4D9B-927D-63F0F8B2CFE7}"
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DfE.ExternalApplications.Application", "src\DfE.ExternalApplications.Application\DfE.ExternalApplications.Application.csproj", "{1DC38736-EF38-446D-B24E-E498E496F501}"
11+
EndProject
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DfE.ExternalApplications.Infrastructure", "src\DfE.ExternalApplications.Infrastructure\DfE.ExternalApplications.Infrastructure.csproj", "{72352B4A-6C2E-4800-B7E1-0B5E3111FE93}"
713
EndProject
814
Global
915
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1016
Debug|Any CPU = Debug|Any CPU
1117
Release|Any CPU = Release|Any CPU
1218
EndGlobalSection
1319
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{122FBAC3-C50C-4BEB-A838-AAC742F3C8BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{122FBAC3-C50C-4BEB-A838-AAC742F3C8BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{122FBAC3-C50C-4BEB-A838-AAC742F3C8BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{122FBAC3-C50C-4BEB-A838-AAC742F3C8BD}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{CA38CBED-6681-4A44-BEC8-832D5171D59F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{CA38CBED-6681-4A44-BEC8-832D5171D59F}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{CA38CBED-6681-4A44-BEC8-832D5171D59F}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{CA38CBED-6681-4A44-BEC8-832D5171D59F}.Release|Any CPU.Build.0 = Release|Any CPU
24+
{F8DC3D4E-5AB5-4D9B-927D-63F0F8B2CFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{F8DC3D4E-5AB5-4D9B-927D-63F0F8B2CFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{F8DC3D4E-5AB5-4D9B-927D-63F0F8B2CFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{F8DC3D4E-5AB5-4D9B-927D-63F0F8B2CFE7}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{1DC38736-EF38-446D-B24E-E498E496F501}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{1DC38736-EF38-446D-B24E-E498E496F501}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{1DC38736-EF38-446D-B24E-E498E496F501}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{1DC38736-EF38-446D-B24E-E498E496F501}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{72352B4A-6C2E-4800-B7E1-0B5E3111FE93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{72352B4A-6C2E-4800-B7E1-0B5E3111FE93}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{72352B4A-6C2E-4800-B7E1-0B5E3111FE93}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{72352B4A-6C2E-4800-B7E1-0B5E3111FE93}.Release|Any CPU.Build.0 = Release|Any CPU
1836
EndGlobalSection
1937
GlobalSection(SolutionProperties) = preSolution
2038
HideSolutionNode = FALSE

Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ ARG DOTNET_VERSION=8.0
55
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-azurelinux3.0 AS build
66
WORKDIR /build
77

8-
# Mount GitHub Token as a Docker secret so that NuGet Feed can be accessed
9-
RUN --mount=type=secret,id=github_token dotnet nuget add source --username USERNAME --password $(cat /run/secrets/github_token) --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json"
10-
11-
# Copy the application code
12-
COPY ./src/ ./
13-
14-
# Build and publish the dotnet solution
15-
RUN --mount=type=cache,target=/root/.nuget/packages \
16-
dotnet restore && \
17-
dotnet build --no-restore -c Release && \
18-
dotnet publish --no-build -o /app
8+
# Copy the solution file and source code
9+
COPY ./DfE.ExternalApplications.Web.sln ./
10+
COPY ./src/ ./src/
11+
12+
# Mount GitHub Token as a Docker secret, add NuGet source, and build the solution
13+
RUN --mount=type=secret,id=github_token \
14+
--mount=type=cache,target=/root/.nuget/packages \
15+
dotnet nuget add source --username USERNAME --password $(cat /run/secrets/github_token) --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json" && \
16+
dotnet restore DfE.ExternalApplications.Web.sln && \
17+
dotnet build DfE.ExternalApplications.Web.sln --no-restore -c Release && \
18+
dotnet publish DfE.ExternalApplications.Web.sln --no-build -o /app
1919

2020
# Stage 2 - Build a runtime environment
2121
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}-azurelinux3.0 AS final
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\DfE.ExternalApplications.Domain\DfE.ExternalApplications.Domain.csproj" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using DfE.ExternalApplications.Domain.Models;
2+
3+
namespace DfE.ExternalApplications.Application.Interfaces;
4+
5+
public interface IFormTemplateParser
6+
{
7+
Task<FormTemplate> ParseAsync(Stream templateStream, CancellationToken cancellationToken = default);
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using DfE.ExternalApplications.Domain.Models;
2+
3+
namespace DfE.ExternalApplications.Application.Interfaces;
4+
5+
public interface IFormTemplateProvider
6+
{
7+
Task<FormTemplate> GetTemplateAsync(string templateId, CancellationToken cancellationToken = default);
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace DfE.ExternalApplications.Application.Interfaces;
2+
3+
public interface ITemplateStore
4+
{
5+
Task<Stream> GetTemplateStreamAsync(string templateId, CancellationToken cancellationToken = default);
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
using System.Text.Json.Serialization;
3+
4+
namespace DfE.ExternalApplications.Domain.Models;
5+
6+
[ExcludeFromCodeCoverage]
7+
public class Condition
8+
{
9+
[JsonPropertyName("triggerField")]
10+
public required string TriggerField { get; set; }
11+
12+
[JsonPropertyName("operator")]
13+
public required string Operator { get; set; }
14+
15+
[JsonPropertyName("value")]
16+
public required object Value { get; set; }
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
using System.Text.Json.Serialization;
3+
4+
namespace DfE.ExternalApplications.Domain.Models;
5+
6+
[ExcludeFromCodeCoverage]
7+
public class ConditionGroup
8+
{
9+
[JsonPropertyName("logicalOperator")]
10+
public required string LogicalOperator { get; set; }
11+
12+
[JsonPropertyName("conditions")]
13+
public required List<Condition> Conditions { get; set; }
14+
}

0 commit comments

Comments
 (0)