Skip to content

Commit

Permalink
core: split file things to separated project
Browse files Browse the repository at this point in the history
SQS stuff is not inside Exchange project, there is not reason to S3
stuff to be there
  • Loading branch information
darakeon committed Aug 24, 2024
1 parent b0b2938 commit 4a9330d
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 20 deletions.
1 change: 1 addition & 0 deletions core/BusinessLogic/BusinessLogic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ProjectReference Include="..\Email\Email.csproj" />
<ProjectReference Include="..\Entities\Entities.csproj" />
<ProjectReference Include="..\Exchange\Exchange.csproj" />
<ProjectReference Include="..\Files\Files.csproj" />
<ProjectReference Include="..\Language\Language.csproj" />
<ProjectReference Include="..\Queue\Queue.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion core/BusinessLogic/Repositories/Repos.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using DFM.Authentication;
using DFM.BusinessLogic.Response;
using DFM.Exchange.Exporter;
using DFM.BusinessLogic.Validators;
using DFM.Files;

namespace DFM.BusinessLogic.Repositories
{
Expand Down
1 change: 1 addition & 0 deletions core/BusinessLogic/Repositories/WipeRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using DFM.Entities.Bases;
using DFM.Entities.Enums;
using DFM.Exchange.Exporter;
using DFM.Files;
using Keon.Util.Crypto;
using Keon.Util.DB;
using Keon.Util.Extensions;
Expand Down
2 changes: 1 addition & 1 deletion core/BusinessLogic/ServiceAccess.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Runtime.CompilerServices;
using DFM.BusinessLogic.Repositories;
using DFM.BusinessLogic.Services;
using DFM.Exchange.Exporter;
using DFM.BusinessLogic.Validators;
using DFM.Files;
using DFM.Queue;

[assembly: InternalsVisibleTo("DFM.BusinessLogic.Tests")]
Expand Down
8 changes: 8 additions & 0 deletions core/Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Queue", "Queue\Queue.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Queue.TestApp", "Tests\Queue.TestApp\Queue.TestApp.csproj", "{60CC8C3A-E427-418D-BF79-279DB588BAE2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Files", "Files\Files.csproj", "{2D492082-2389-4EB9-8345-3F8E6022B6CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
BrowserTests|Any CPU = BrowserTests|Any CPU
Expand Down Expand Up @@ -143,6 +145,12 @@ Global
{60CC8C3A-E427-418D-BF79-279DB588BAE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60CC8C3A-E427-418D-BF79-279DB588BAE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60CC8C3A-E427-418D-BF79-279DB588BAE2}.Release|Any CPU.Build.0 = Release|Any CPU
{2D492082-2389-4EB9-8345-3F8E6022B6CB}.BrowserTests|Any CPU.ActiveCfg = Debug|Any CPU
{2D492082-2389-4EB9-8345-3F8E6022B6CB}.BrowserTests|Any CPU.Build.0 = Debug|Any CPU
{2D492082-2389-4EB9-8345-3F8E6022B6CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D492082-2389-4EB9-8345-3F8E6022B6CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D492082-2389-4EB9-8345-3F8E6022B6CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D492082-2389-4EB9-8345-3F8E6022B6CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 0 additions & 1 deletion core/Exchange/Exchange.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.402" />
<PackageReference Include="CsvHelper" Version="33.0.1" />
</ItemGroup>

Expand Down
21 changes: 21 additions & 0 deletions core/Files/Files.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>DFM.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>DFM.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<AssemblyVersion>12.1.0.0</AssemblyVersion>
<FileVersion>12.1.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.402" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Generic\Generic.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace DFM.Exchange.Exporter;
namespace DFM.Files;

public interface IFileService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System;
using System.IO;
using CsvHelper.Configuration;
using DFM.Generic;
using DFM.Generic;

namespace DFM.Exchange.Exporter
namespace DFM.Files
{
public class LocalFileService : IFileService
{
public LocalFileService()
{
if (!Cfg.S3.LocalFilled)
throw new ConfigurationException("Must have section S3 whole configured for local files");
throw new SystemError("Must have section S3 whole configured for local files");
}

public void Upload(String path)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
using System;
using System.IO;
using System.Net;
using System.Net;
using Amazon;
using Amazon.S3;
using Amazon.S3.Transfer;
using CsvHelper.Configuration;
using DFM.Generic;

namespace DFM.Exchange.Exporter
namespace DFM.Files
{
public class S3Service : IDisposable, IFileService
{
public S3Service()
{
if (!Cfg.S3.S3Filled)
throw new ConfigurationException("Must have section S3 whole configured for aws");
throw new SystemError("Must have section S3 whole configured for aws");

var region = RegionEndpoint.GetBySystemName(Cfg.S3.Region);
var accessKey = Cfg.S3.AccessKey;
Expand Down
6 changes: 6 additions & 0 deletions core/Queue/LocalQueueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ namespace DFM.Queue;

public class LocalQueueService : IQueueService
{
public LocalQueueService()
{
if (!Cfg.SQS.LocalFilled)
throw new SystemError("Must have section SQS whole configured for local files");
}

private IDictionary<String, IDictionary<String, String>> queues =
new Dictionary<String, IDictionary<String, String>>
{
Expand Down
3 changes: 3 additions & 0 deletions core/Queue/SQSService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class SQSService : IQueueService, IDisposable
{
public SQSService()
{
if (!Cfg.SQS.SQSFilled)
throw new SystemError("Must have section SQS whole configured for aws");

var region = RegionEndpoint.GetBySystemName(Cfg.SQS.Region);
var accessKey = Cfg.SQS.AccessKey;
var secretKey = Cfg.SQS.SecretKey;
Expand Down
4 changes: 2 additions & 2 deletions core/Tests/BusinessLogic/Steps/BaseStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using DFM.Entities;
using DFM.Entities.Bases;
using DFM.Entities.Enums;
using DFM.Exchange.Exporter;
using DFM.Files;
using DFM.Generic;
using DFM.Generic.Datetime;
using DFM.Queue;
Expand All @@ -34,7 +34,7 @@ protected BaseStep(ScenarioContext context)

private protected static Valids valids;
private protected static Repos repos;
private protected static IFileService fileService;
private protected static LocalFileService fileService;
private protected static LocalQueueService queueService;

private static String logFileName;
Expand Down

0 comments on commit 4a9330d

Please sign in to comment.