Skip to content

Commit

Permalink
Merge pull request #11 from IliyanIlievPH/10
Browse files Browse the repository at this point in the history
Closes #10
  • Loading branch information
PaterSantyago committed Jul 21, 2020
2 parents af1c896 + ea73869 commit 624b786
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.207
dotnet-version: 3.1.302
- name: Install dependencies
run: dotnet restore
- name: Build solution
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.207
dotnet-version: 3.1.302
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<None Remove="MAVN.Service.NotificationSystemBroker.Client.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lykke.HttpClientGenerator" Version="2.5.0" />
<PackageReference Include="Lykke.SettingsReader" Version="5.2.0" />
<PackageReference Include="Lykke.HttpClientGenerator" Version="3.1.0" />
<PackageReference Include="Lykke.SettingsReader" Version="5.3.0" />
<PackageReference Include="Refit" Version="4.6.107" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<None Remove="MAVN.Service.NotificationSystemBroker.PushProviderClient.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lykke.HttpClientGenerator" Version="2.5.0" />
<PackageReference Include="Lykke.HttpClientGenerator" Version="3.1.0" />
<PackageReference Include="Refit" Version="4.6.107" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<None Remove="MAVN.Service.NotificationSystemBroker.SmsProviderClient.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lykke.HttpClientGenerator" Version="2.5.0" />
<PackageReference Include="Lykke.HttpClientGenerator" Version="3.1.0" />
<PackageReference Include="Refit" Version="4.6.107" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lykke.HttpClientGenerator" Version="2.5.0" />
<PackageReference Include="Lykke.HttpClientGenerator" Version="3.1.0" />
<PackageReference Include="Refit" Version="4.6.107" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Lykke.Common" Version="7.5.0" />
<PackageReference Include="Lykke.RabbitMqBroker" Version="7.13.1" />
<PackageReference Include="MailKit" Version="2.5.1" />
<PackageReference Include="Lykke.RabbitMqBroker" Version="7.13.3" />
<PackageReference Include="MailKit" Version="2.7.0" />
<PackageReference Include="MAVN.Service.NotificationSystem.Contract" Version="1.3.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autofac;
using Autofac;
using MAVN.Service.NotificationSystemBroker.Domain.Services;
using MAVN.Service.NotificationSystemBroker.DomainServices.Services;
using MailKit.Net.Smtp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0</Version>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Autofac;
using MAVN.Common.MsSql;
using Autofac;
using MAVN.Persistence.PostgreSQL.Legacy;
using MAVN.Service.NotificationSystemBroker.Domain.Repositories;
using MAVN.Service.NotificationSystemBroker.MsSqlRepositories.Repositories;

Expand All @@ -16,7 +16,7 @@ public AutofacModule(string connectionString)

protected override void Load(ContainerBuilder builder)
{
builder.RegisterMsSql(
builder.RegisterPostgreSQL(
_connectionString,
connString => new NotificationSystemBrokerContext(connString, false),
dbConn => new NotificationSystemBrokerContext(dbConn));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="MAVN.Common.MsSql" Version="3.0.0" />
<PackageReference Include="MAVN.Persistence.PostgreSQL.Legacy" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Data.Common;
using System.Data.Common;
using JetBrains.Annotations;
using MAVN.Common.MsSql;
using MAVN.Persistence.PostgreSQL.Legacy;
using MAVN.Service.NotificationSystemBroker.MsSqlRepositories.Entities;
using Microsoft.EntityFrameworkCore;

namespace MAVN.Service.NotificationSystemBroker.MsSqlRepositories
{
public class NotificationSystemBrokerContext : MsSqlContext
public class NotificationSystemBrokerContext : PostgreSQLContext
{
private const string Schema = "notification_system_broker";

Expand Down Expand Up @@ -34,7 +34,7 @@ public NotificationSystemBrokerContext(DbConnection dbConnection)
{
}

protected override void OnLykkeModelCreating(ModelBuilder modelBuilder)
protected override void OnMAVNModelCreating(ModelBuilder modelBuilder)
{
var emailMessageEntityBuilder = modelBuilder.Entity<EmailMessageEntity>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using MAVN.Common.MsSql;
using MAVN.Persistence.PostgreSQL.Legacy;
using MAVN.Service.NotificationSystemBroker.Domain.Entities;
using MAVN.Service.NotificationSystemBroker.Domain.Repositories;
using MAVN.Service.NotificationSystemBroker.MsSqlRepositories.Entities;
Expand All @@ -13,10 +13,10 @@ namespace MAVN.Service.NotificationSystemBroker.MsSqlRepositories.Repositories
{
public class EmailMessageRepository : IEmailMessageRepository
{
private readonly MsSqlContextFactory<NotificationSystemBrokerContext> _msSqlContextFactory;
private readonly PostgreSQLContextFactory<NotificationSystemBrokerContext> _msSqlContextFactory;
private readonly IMapper _mapper;

public EmailMessageRepository(MsSqlContextFactory<NotificationSystemBrokerContext> msSqlContextFactory,
public EmailMessageRepository(PostgreSQLContextFactory<NotificationSystemBrokerContext> msSqlContextFactory,
IMapper mapper)
{
_msSqlContextFactory = msSqlContextFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/MAVN.Service.NotificationSystemBroker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM microsoft/dotnet:2.2-aspnetcore-runtime
FROM microsoft/dotnet:3.1-aspnetcore-runtime
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "MAVN.Service.NotificationSystemBroker.dll"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<OutputType>Exe</OutputType>
<Version>1.0.0</Version>
</PropertyGroup>
Expand Down Expand Up @@ -31,9 +31,8 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Lykke.Sdk" Version="5.17.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Lykke.Logs" Version="7.4.0" />
<PackageReference Include="LykkeBiz.Sdk" Version="5.18.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\client\MAVN.Service.NotificationSystemBroker.Client\MAVN.Service.NotificationSystemBroker.Client.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/MAVN.Service.NotificationSystemBroker/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Threading.Tasks;
using Lykke.Sdk;
using System.Threading.Tasks;

namespace MAVN.Service.NotificationSystemBroker
{
Expand Down
48 changes: 32 additions & 16 deletions src/MAVN.Service.NotificationSystemBroker/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
using System;
using System;
using Autofac;
using AutoMapper;
using JetBrains.Annotations;
using Lykke.Sdk;
using Lykke.SettingsReader;
using MAVN.Service.NotificationSystemBroker.Profiles;
using MAVN.Service.NotificationSystemBroker.Settings;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace MAVN.Service.NotificationSystemBroker
{
[UsedImplicitly]
public class Startup
{
private IConfigurationRoot _configurationRoot;
private IReloadingManager<AppSettings> _settingsManager;

private readonly LykkeSwaggerOptions _swaggerOptions = new LykkeSwaggerOptions
{
ApiTitle = "NotificationSystemBroker API",
ApiVersion = "v1"
};

[UsedImplicitly]
public IServiceProvider ConfigureServices(IServiceCollection services)
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddMvc().AddNewtonsoftJson();

return services.BuildServiceProvider<AppSettings>(options =>
(_configurationRoot, _settingsManager) = services.BuildServiceProvider<AppSettings>(options =>
{
options.Extend = (serviceCollection, settings) =>
{
serviceCollection.AddAutoMapper(
typeof(AutoMapperProfile),
typeof(MsSqlRepositories.AutoMapperProfile));
};
options.SwaggerOptions = _swaggerOptions;
options.Logs = logs =>
Expand All @@ -40,6 +40,13 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
logs.AzureTableConnectionStringResolver = settings => settings.NotificationSystemBrokerService.Db.LogsConnString;
};
options.Extend = (serviceCollection, settings) =>
{
serviceCollection.AddAutoMapper(
typeof(AutoMapperProfile),
typeof(MsSqlRepositories.AutoMapperProfile));
};
options.Swagger = swagger =>
{
swagger.IgnoreObsoleteActions();
Expand All @@ -48,16 +55,25 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
}

[UsedImplicitly]
public void Configure(IApplicationBuilder app, IMapper mapper)
public void ConfigureContainer(ContainerBuilder builder)
{
app.UseMvc();
builder.ConfigureLykkeContainer(
_configurationRoot,
_settingsManager);
}

app.UseLykkeConfiguration(options =>
[UsedImplicitly]
public void Configure(
IApplicationBuilder app,
IMapper mapper,
IApplicationLifetime appLifetime)
{
mapper.ConfigurationProvider.AssertConfigurationIsValid();
app.UseRouting().UseEndpoints(endpoints => { endpoints.MapControllers(); });
app.UseLykkeConfiguration(appLifetime, options =>
{
options.SwaggerOptions = _swaggerOptions;
});

mapper.ConfigurationProvider.AssertConfigurationIsValid();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0</Version>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.11.0" />
<PackageReference Include="coverlet.msbuild" Version="2.8.1">
<PackageReference Include="AutoFixture" Version="4.12.0" />
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Lykke.Logs" Version="7.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="Lykke.Logs" Version="7.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 624b786

Please sign in to comment.