Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ services:
container_name: db-migrations
build:
context: .
dockerfile: src/ServiceLayer.Mesh/Dockerfile.migrations
dockerfile: src/ServiceLayer.Common/Dockerfile.migrations
args:
DatabaseConnectionString: "${DatabaseConnectionString}"
depends_on:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace ServiceLayer.Mesh.Data;
namespace ServiceLayer.Data;

public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<ServiceLayerDbContext>
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ServiceLayer.Mesh.Data;
using ServiceLayer.Data;

#nullable disable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

namespace ServiceLayer.Mesh.Models;
namespace ServiceLayer.Data.Models;

public class MeshFile
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ServiceLayer.Mesh.Models;
namespace ServiceLayer.Data.Models;

public enum MeshFileStatus
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ServiceLayer.Mesh.Models;
namespace ServiceLayer.Data.Models;

public enum MeshFileType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using ServiceLayer.Mesh.Models;
using ServiceLayer.Data.Models;

namespace ServiceLayer.Mesh.Data;
namespace ServiceLayer.Data;

public class ServiceLayerDbContext(DbContextOptions<ServiceLayerDbContext> options) : DbContext(options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ RUN git submodule update --init --recursive
ARG DatabaseConnectionString
ENV DatabaseConnectionString=${DatabaseConnectionString}

RUN dotnet restore ./src/ServiceLayer.Mesh/ServiceLayer.Mesh.csproj && \
dotnet build ./src/ServiceLayer.Mesh/ServiceLayer.Mesh.csproj && \
RUN dotnet restore ./src/ServiceLayer.Common/ServiceLayer.Common.csproj && \
dotnet build ./src/ServiceLayer.Common/ServiceLayer.Common.csproj && \
dotnet tool install dotnet-ef --tool-path /tools

ENV PATH="/tools:$PATH" \
Expand All @@ -24,7 +24,7 @@ ENV PATH="/tools:$PATH" \
RUN mkdir -p /database && \
dotnet ef migrations script \
-o /database/migration.sql \
--project ./src/ServiceLayer.Mesh/
--project ./src/ServiceLayer.Common/

# Stage 2: Runtime - Apply Migration and Seed Data
FROM mcr.microsoft.com/mssql-tools:v1 AS migration-env
Expand Down
19 changes: 19 additions & 0 deletions src/ServiceLayer.Common/ServiceLayer.Common.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>ServiceLayer</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.5" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/ServiceLayer.Mesh/Functions/FileDiscoveryFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using NHS.MESH.Client.Contracts.Services;
using ServiceLayer.Data;
using ServiceLayer.Data.Models;
using ServiceLayer.Mesh.Configuration;
using ServiceLayer.Mesh.Data;
using ServiceLayer.Mesh.Messaging;
using ServiceLayer.Mesh.Models;

namespace ServiceLayer.Mesh.Functions
{
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceLayer.Mesh/Functions/FileExtractFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using NHS.MESH.Client.Contracts.Services;
using ServiceLayer.Data;
using ServiceLayer.Data.Models;
using ServiceLayer.Mesh.Configuration;
using ServiceLayer.Mesh.Data;
using ServiceLayer.Mesh.Messaging;
using ServiceLayer.Mesh.Models;
using ServiceLayer.Mesh.Storage;

namespace ServiceLayer.Mesh.Functions;
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceLayer.Mesh/Messaging/FileExtractQueueClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Azure.Storage.Queues;
using Microsoft.Extensions.Logging;
using ServiceLayer.Data.Models;
using ServiceLayer.Mesh.Configuration;
using ServiceLayer.Mesh.Models;

namespace ServiceLayer.Mesh.Messaging;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Azure.Storage.Queues;
using Microsoft.Extensions.Logging;
using ServiceLayer.Data.Models;
using ServiceLayer.Mesh.Configuration;
using ServiceLayer.Mesh.Models;

namespace ServiceLayer.Mesh.Messaging;

Expand Down
2 changes: 1 addition & 1 deletion src/ServiceLayer.Mesh/Messaging/IFileExtractQueueClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ServiceLayer.Mesh.Models;
using ServiceLayer.Data.Models;

namespace ServiceLayer.Mesh.Messaging;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ServiceLayer.Mesh.Models;
using ServiceLayer.Data.Models;

namespace ServiceLayer.Mesh.Messaging;

Expand Down
5 changes: 1 addition & 4 deletions src/ServiceLayer.Mesh/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Azure.Storage.Queues;
using Azure.Identity;
using Microsoft.EntityFrameworkCore;
using NHS.MESH.Client;
using ServiceLayer.Mesh.Data;
using Azure.Storage.Blobs;
using ServiceLayer.Mesh.Configuration;
using ServiceLayer.Mesh.Messaging;
using NHS.MESH.Client.Contracts.Services;
using NHS.MESH.Client.Services;
using ServiceLayer.Data;

var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
Expand Down
7 changes: 1 addition & 6 deletions src/ServiceLayer.Mesh/ServiceLayer.Mesh.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" Version="5.5.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand All @@ -36,6 +30,7 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServiceLayer.Common\ServiceLayer.Common.csproj" />
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
<ProjectReference Include="..\dotnet-mesh-client\application\DotNetMeshClient\NHS.Mesh.Client\NHS.Mesh.Client.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceLayer.Mesh/Storage/IMeshFilesBlobStore.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ServiceLayer.Mesh.Models;
using ServiceLayer.Data.Models;

namespace ServiceLayer.Mesh.Storage;

Expand Down
2 changes: 1 addition & 1 deletion src/ServiceLayer.Mesh/Storage/MeshFilesBlobStore.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Azure.Storage.Blobs;
using ServiceLayer.Mesh.Models;
using ServiceLayer.Data.Models;

namespace ServiceLayer.Mesh.Storage;

Expand Down
29 changes: 29 additions & 0 deletions src/ServiceLayer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceLayer.Mesh.Tests", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHS.Mesh.Client", "dotnet-mesh-client\application\DotNetMeshClient\NHS.Mesh.Client\NHS.Mesh.Client.csproj", "{F373FEBA-AD0B-4E0B-BEE3-31D22C7AD43D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceLayer.Common", "ServiceLayer.Common\ServiceLayer.Common.csproj", "{B086BBF9-1A41-48C9-B019-F9C75CA634AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceLayer.Common.Tests", "..\tests\ServiceLayer.Common.Tests\ServiceLayer.Common.Tests.csproj", "{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -85,13 +89,38 @@ Global
{F373FEBA-AD0B-4E0B-BEE3-31D22C7AD43D}.Release|x64.Build.0 = Release|Any CPU
{F373FEBA-AD0B-4E0B-BEE3-31D22C7AD43D}.Release|x86.ActiveCfg = Release|Any CPU
{F373FEBA-AD0B-4E0B-BEE3-31D22C7AD43D}.Release|x86.Build.0 = Release|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Debug|x64.ActiveCfg = Debug|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Debug|x64.Build.0 = Debug|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Debug|x86.Build.0 = Debug|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Release|Any CPU.Build.0 = Release|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Release|x64.ActiveCfg = Release|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Release|x64.Build.0 = Release|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Release|x86.ActiveCfg = Release|Any CPU
{B086BBF9-1A41-48C9-B019-F9C75CA634AF}.Release|x86.Build.0 = Release|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Debug|x64.ActiveCfg = Debug|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Debug|x64.Build.0 = Debug|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Debug|x86.ActiveCfg = Debug|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Debug|x86.Build.0 = Debug|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Release|Any CPU.Build.0 = Release|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Release|x64.ActiveCfg = Release|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Release|x64.Build.0 = Release|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Release|x86.ActiveCfg = Release|Any CPU
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BA052DAE-6FD1-483A-A0AF-DCBCF9E38C72} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{E5EF5B92-52DA-4EF3-956B-8AEE3D333428} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{9642EC3A-9BC3-4557-ACD1-807FE764D5F6} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EEE06B13-019F-4618-A6EB-FD834B6EA7D7}
Expand Down
28 changes: 28 additions & 0 deletions tests/ServiceLayer.Common.Tests/ServiceLayer.Common.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"/>
</ItemGroup>

<ItemGroup>
<Using Include="Xunit"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\ServiceLayer.Common\ServiceLayer.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
using Moq;
using NHS.MESH.Client.Contracts.Services;
using NHS.MESH.Client.Models;
using ServiceLayer.Data;
using ServiceLayer.Data.Models;
using ServiceLayer.Mesh.Configuration;
using ServiceLayer.Mesh.Data;
using ServiceLayer.Mesh.Functions;
using ServiceLayer.Mesh.Messaging;
using ServiceLayer.Mesh.Models;

namespace ServiceLayer.Mesh.Tests.Functions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using System.Globalization;
using Google.Protobuf.WellKnownTypes;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Moq;
using NHS.MESH.Client.Contracts.Services;
using NHS.MESH.Client.Models;
using ServiceLayer.Data;
using ServiceLayer.Data.Models;
using ServiceLayer.Mesh.Configuration;
using ServiceLayer.Mesh.Data;
using ServiceLayer.Mesh.Functions;
using ServiceLayer.Mesh.Messaging;
using ServiceLayer.Mesh.Models;
using ServiceLayer.Mesh.Storage;

namespace ServiceLayer.Mesh.Tests.Functions;
Expand All @@ -20,7 +19,6 @@ public class FileExtractFunctionTests
private readonly Mock<IMeshInboxService> _meshInboxServiceMock;
private readonly Mock<IFileTransformQueueClient> _fileTransformQueueClientMock;
private readonly Mock<IFileExtractQueueClient> _fileExtractQueueClientMock;
private readonly Mock<IFileExtractFunctionConfiguration> _configurationMock;
private readonly Mock<IMeshFilesBlobStore> _blobStoreMock;
private readonly ServiceLayerDbContext _dbContext;
private readonly FileExtractFunction _function;
Expand All @@ -32,7 +30,6 @@ public FileExtractFunctionTests()
_fileExtractQueueClientMock = new Mock<IFileExtractQueueClient>();
_fileTransformQueueClientMock = new Mock<IFileTransformQueueClient>();
_blobStoreMock = new Mock<IMeshFilesBlobStore>();
_configurationMock = new Mock<IFileExtractFunctionConfiguration>();

var options = new DbContextOptionsBuilder<ServiceLayerDbContext>()
.UseInMemoryDatabase(Guid.NewGuid().ToString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.3" />
Expand Down
Loading