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
15 changes: 14 additions & 1 deletion src/Services/smalltalk/O2NextGen.SmallTalk.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public async Task<ChatMessageModel> AddMessage(long sessionId,ChatMessageModel c
{
var chatMessage = Creator<ChatMessageModel>.CreateObject();
chatMessage.Message = chatMessageModel.Message;

chatMessage.SenderId = chatMessageModel.SenderId;
chatMessage.RecipientId = chatMessageModel.RecipientId;

ChatSessionModel chatSession = null;
//Checking if a session exists or not
Expand Down Expand Up @@ -60,6 +61,11 @@ public async Task<IReadOnlyCollection<ChatMessageModel>> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ public async Task<ChatSessionModel> AddSessionAsync(ChatSessionModel chatSession
return await Task.FromResult(chatSession);
}

public async Task<bool> ExistSessionAsync(long sessionId,CancellationToken ct)
public async Task<bool> ExistSessionAsync(long sessionId, CancellationToken ct)
{
var result = Sessions.Any(_ => _.Id == sessionId);
return await Task.FromResult<bool>(result);
}

public async Task<ChatSessionModel> GetSessionAsync(long sessionId,CancellationToken ct)
public async Task<ChatSessionModel> GetSessionAsync(long sessionId, CancellationToken ct)
{
var result = Sessions.Single(_ => _.Id == sessionId);
return await Task.FromResult(result);
Expand Down