diff --git a/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Startup.cs b/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Startup.cs index 45808f1f..35e02020 100644 --- a/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Startup.cs +++ b/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Startup.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using O2NextGen.SmallTalk.Api.Helpers; +using System.Threading.Tasks; namespace O2NextGen.SmallTalk.Api { @@ -32,7 +33,19 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseHsts(); } - app.UseHttpsRedirection(); + app.UseStaticFiles(); + + app.Use(async (context, next) => + { + context.Response.OnStarting(() => + { + context.Response.Headers.Add("X-Power-By", "O2NextGen: SmallTalk Api"); + return Task.CompletedTask; + }); + + await next.Invoke(); + }); + app.UseMvc(); } } diff --git a/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/ChatManager.cs b/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/ChatManager.cs index a19d61bd..8e96c2bb 100644 --- a/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/ChatManager.cs +++ b/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/ChatManager.cs @@ -22,7 +22,8 @@ public async Task AddMessage(long sessionId,ChatMessageModel c { var chatMessage = Creator.CreateObject(); chatMessage.Message = chatMessageModel.Message; - + chatMessage.SenderId = chatMessageModel.SenderId; + chatMessage.RecipientId = chatMessageModel.RecipientId; ChatSessionModel chatSession = null; //Checking if a session exists or not @@ -60,6 +61,11 @@ public async Task> GetMessages(long idSess return result; } + public Task GetSession(long sessionId, CancellationToken ct) + { + throw new System.NotImplementedException(); + } + public Task RemoveMessageAsync(long sessionId, long id, CancellationToken ct) { throw new System.NotImplementedException(); diff --git a/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/InMemorySessionManager.cs b/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/InMemorySessionManager.cs index f259ac39..5c5db9c4 100644 --- a/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/InMemorySessionManager.cs +++ b/src/Services/smalltalk/O2NextGen.SmallTalk.Impl/Services/InMemorySessionManager.cs @@ -94,13 +94,13 @@ public async Task AddSessionAsync(ChatSessionModel chatSession return await Task.FromResult(chatSession); } - public async Task ExistSessionAsync(long sessionId,CancellationToken ct) + public async Task ExistSessionAsync(long sessionId, CancellationToken ct) { var result = Sessions.Any(_ => _.Id == sessionId); return await Task.FromResult(result); } - public async Task GetSessionAsync(long sessionId,CancellationToken ct) + public async Task GetSessionAsync(long sessionId, CancellationToken ct) { var result = Sessions.Single(_ => _.Id == sessionId); return await Task.FromResult(result);