From 416fd94399bf0b58fc0d201c0294f0869517a743 Mon Sep 17 00:00:00 2001 From: transtrike Date: Fri, 26 Mar 2021 22:05:07 +0200 Subject: Rating's GetById and GetRatingByPostAndUser return null if User hasn't rated; Updated connection string --- src/Web/DevHive.Web/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Web/DevHive.Web') diff --git a/src/Web/DevHive.Web/appsettings.json b/src/Web/DevHive.Web/appsettings.json index fcf9805..053007d 100644 --- a/src/Web/DevHive.Web/appsettings.json +++ b/src/Web/DevHive.Web/appsettings.json @@ -5,7 +5,7 @@ "audience": "" }, "ConnectionStrings": { - "DEV": "Server=localhost;Port=5432;Database=API;User Id=postgres;Password=;" + "DEV": "Server=localhost;Port=5432;Database=DevHive API;User Id=postgres;Password=;" }, "Cloud": { "cloudName": "devhive", -- cgit v1.2.3 From 7d5544626c21b90da0b538da83c112c0f8adec9d Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 27 Mar 2021 08:48:49 +0200 Subject: Updated database name in appsettings and ConnectionString --- src/Data/DevHive.Data/ConnectionString.json | 4 ++-- src/Web/DevHive.Web/appsettings.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Web/DevHive.Web') diff --git a/src/Data/DevHive.Data/ConnectionString.json b/src/Data/DevHive.Data/ConnectionString.json index c8300b2..1281a1c 100644 --- a/src/Data/DevHive.Data/ConnectionString.json +++ b/src/Data/DevHive.Data/ConnectionString.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "DEV": "Server=localhost;Port=5432;Database=API;User Id=postgres;Password=password;" + "DEV": "Server=localhost;Port=5432;Database=DevHive_API;User Id=postgres;Password=password;" } -} \ No newline at end of file +} diff --git a/src/Web/DevHive.Web/appsettings.json b/src/Web/DevHive.Web/appsettings.json index 053007d..036af82 100644 --- a/src/Web/DevHive.Web/appsettings.json +++ b/src/Web/DevHive.Web/appsettings.json @@ -5,7 +5,7 @@ "audience": "" }, "ConnectionStrings": { - "DEV": "Server=localhost;Port=5432;Database=DevHive API;User Id=postgres;Password=;" + "DEV": "Server=localhost;Port=5432;Database=DevHive_API;User Id=postgres;Password=;" }, "Cloud": { "cloudName": "devhive", -- cgit v1.2.3 From 15904cb3d2ef9442b682322353c378ab321520e5 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 28 Mar 2021 17:43:41 +0300 Subject: Improved formating of response from exception middleware --- src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/Web/DevHive.Web') diff --git a/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs b/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs index f159b69..e2521bd 100644 --- a/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs +++ b/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs @@ -2,7 +2,7 @@ using System; using System.Net; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Logging; +using Newtonsoft.Json; namespace DevHive.Web.Middleware { @@ -32,11 +32,14 @@ namespace DevHive.Web.Middleware context.Response.ContentType = "application/json"; context.Response.StatusCode = (int)HttpStatusCode.BadRequest; - return context.Response.WriteAsync(new - { - context.Response.StatusCode, - exception.Message - }.ToString()); + // Made to ressemble the formatting of property validation errors (like [MinLength(3)]) + string message = JsonConvert.SerializeObject(new { + errors = new { + Exception = new String[] { exception.Message } + } + }); + + return context.Response.WriteAsync(message); } } } -- cgit v1.2.3