Skip to content
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
4 changes: 2 additions & 2 deletions src/Services/auth/O2NextGen.Auth.Web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /src
COPY ["Services/auth/O2NextGen.Auth.Web/O2NextGen.Auth.Web.csproj", "Services/auth/O2NextGen.Auth.Web/"]
RUN dotnet restore "Services/auth/O2NextGen.Auth.Web/O2NextGen.Auth.Web.csproj"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /src
COPY ["Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj", "Services/c-gen/O2NextGen.CertificateManagement.Api/"]
COPY ["Services/c-gen/O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj", "Services/c-gen/O2NextGen.CertificateManagement.Data/"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"FromLogContext"
],
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "Logs/log.txt",
"formatter": "O2NextGen.ESender.Api.Logging.ElasticJsonFormatter, O2NextGen.ESender.Api"
}
},
//{
// "Name": "File",
// "Args": {
// "path": "Logs/log.txt",
// "formatter": "O2NextGen.ESender.Api.Logging.ElasticJsonFormatter, O2NextGen.ESender.Api"
// }
//},
{
"Name": "Console"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Services/e-sender/O2NextGen.ESender.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /src
COPY ["Services/e-sender/O2NextGen.ESender.Api/O2NextGen.ESender.Api.csproj", "Services/e-sender/O2NextGen.ESender.Api/"]
COPY ["Services/e-sender/O2NextGen.ESender.Impl/O2NextGen.ESender.Impl.csproj", "Services/e-sender/O2NextGen.ESender.Impl/"]
Expand Down
2 changes: 0 additions & 2 deletions src/Services/e-sender/O2NextGen.ESender.Api/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using O2NextGen.ESender.Api.Helpers;
using O2NextGen.ESender.Api.IoC;
using O2NextGen.ESender.Api.Setup;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace O2NextGen.SmallTalk.Api.Controllers
{
public class ChatController : ControllerBase
{
#region Fields

private readonly IHostingEnvironment _environment;
private readonly ILogger<VersionController> _logger;

#endregion


#region Ctors

public ChatController(IHostingEnvironment environment, ILogger<VersionController> logger)
{
_environment = environment;
_logger = logger;
}

#endregion


#region Methods



#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public VersionController(IHostingEnvironment environment, ILogger<VersionControl

#endregion


[HttpGet("[controller]")]
public object Index()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Services/smalltalk/O2NextGen.SmallTalk.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:2.2 AS base
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:2.2 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /src
COPY ["Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj", "Services/smalltalk/O2NextGen.SmallTalk.Api/"]
COPY ["Services/smalltalk/O2NextGen.SmallTalk.Data/O2NextGen.SmallTalk.Data.csproj", "Services/smalltalk/O2NextGen.SmallTalk.Data/"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using O2NextGen.SmallTalk.Api.Services;
using System;

namespace O2NextGen.SmallTalk.Api.Helpers
{
public static class ServiceCollectionExtensions
{
// ReSharper disable once InconsistentNaming
public static TConfig ConfigurePOCO<TConfig>(this IServiceCollection services, IConfiguration configuration)
where TConfig : class, new()
{
if (services == null)
throw new ArgumentNullException(nameof(services));

if (configuration == null)
throw new ArgumentNullException(nameof(configuration));

var config = new TConfig();
configuration.Bind(config);
services.AddSingleton(config);
return config;
}


public static IServiceCollection AddBusiness(this IServiceCollection services)
{
// services.AddSingleton<IEmailSenderService, InMemoryEmailSenderService>();
// Include DataLayer
//services.AddScoped<IChatService, InMemoryChatService>();
//more business services...

services.AddSingleton<IChatService, InMemoryChatService>();
return services;
}

public static IServiceCollection AddRequiredMvcComponents(this IServiceCollection services)
{
//services.AddTransient<ApiExceptionFilter>();

var mvcBuilder = services.AddMvc(options =>
{
// options.Filters.Add<ApiExceptionFilter>();
});
mvcBuilder.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

return services;
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace O2NextGen.SmallTalk.Api.Services
{
public class ChatSession
{
public long Id { get; set; }
public string Name { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace O2NextGen.SmallTalk.Api.Services
{
public interface IChatService
{
Task<IReadOnlyCollection<ChatSession>> GetAllAsync(CancellationToken ct);
Task<ChatSession> GetByIdAsync(long id, CancellationToken ct);
Task<ChatSession> UpdateAsync(ChatSession certificate, CancellationToken ct);
Task<ChatSession> AddAsync(ChatSession certificate, CancellationToken ct);
Task RemoveAsync(long id, CancellationToken ct);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace O2NextGen.SmallTalk.Api.Services
{
public class InMemoryChatService : IChatService
{
#region Fields

private static readonly List<ChatSession> Sessions = new List<ChatSession>()
{
new ChatSession()
{
Id = 1, Name = "First"
}
};
private long _currentId;

#endregion


#region Ctors

public InMemoryChatService()
{
_currentId = Sessions.Count();
}

#endregion


#region Methods
public async Task<IReadOnlyCollection<ChatSession>> GetAllAsync(CancellationToken ct)
{
await Task.Delay(3000, ct);
return await Task.FromResult<IReadOnlyCollection<ChatSession>>(Sessions.AsReadOnly());
}

public async Task<ChatSession> GetByIdAsync(long id, CancellationToken ct)
{
await Task.Delay(3000, ct);
return await Task.FromResult(Sessions.SingleOrDefault(g => g.Id == id));
}

public async Task<ChatSession> UpdateAsync(ChatSession certificate, CancellationToken ct)
{
await Task.Delay(5000, ct);
var toUpdate = Sessions.SingleOrDefault(g => g.Id == certificate.Id);
if (toUpdate == null)
return null;

toUpdate.Name = certificate.Name;

return await Task.FromResult(toUpdate);
}

public async Task<ChatSession> AddAsync(ChatSession certificate, CancellationToken ct)
{
await Task.Delay(3000, ct);
certificate.Id = ++_currentId;
Sessions.Add(certificate);
return await Task.FromResult(certificate);
}

public Task RemoveAsync(long id, CancellationToken ct)
{
throw new System.NotImplementedException();
}

#endregion
}
}
16 changes: 4 additions & 12 deletions src/Services/smalltalk/O2NextGen.SmallTalk.Api/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using O2NextGen.SmallTalk.Api.Helpers;

namespace O2NextGen.SmallTalk.Api
{
Expand All @@ -22,13 +15,12 @@ public Startup(IConfiguration configuration)

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddRequiredMvcComponents();
services.AddBusiness();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
Expand Down
Loading