diff --git a/Newsbot.Collector.Api/Controllers/v1/UserController.cs b/Newsbot.Collector.Api/Controllers/v1/UserController.cs
index 9125463..04285b3 100644
--- a/Newsbot.Collector.Api/Controllers/v1/UserController.cs
+++ b/Newsbot.Collector.Api/Controllers/v1/UserController.cs
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newsbot.Collector.Api.Authentication;
+using Newsbot.Collector.Api.Middleware;
using Newsbot.Collector.Domain.Entities;
using Newsbot.Collector.Domain.Interfaces;
diff --git a/Newsbot.Collector.Api/Middleware/JwtUserIdExtension.cs b/Newsbot.Collector.Api/Middleware/JwtUserIdExtension.cs
index 80c0e09..041440a 100644
--- a/Newsbot.Collector.Api/Middleware/JwtUserIdExtension.cs
+++ b/Newsbot.Collector.Api/Middleware/JwtUserIdExtension.cs
@@ -1,14 +1,9 @@
-namespace Newsbot.Collector.Api.Authentication;
+namespace Newsbot.Collector.Api.Middleware;
public static class JwtUserIdExtension
{
public static string GetUserId(this HttpContext context)
{
- if (context.User == null)
- {
- return string.Empty;
- }
-
return context.User.Claims.Single(x => x.Type == "id").Value;
}
}
\ No newline at end of file
diff --git a/Newsbot.Collector.Api/Newsbot.Collector.Api.csproj b/Newsbot.Collector.Api/Newsbot.Collector.Api.csproj
index 969a610..76badf8 100644
--- a/Newsbot.Collector.Api/Newsbot.Collector.Api.csproj
+++ b/Newsbot.Collector.Api/Newsbot.Collector.Api.csproj
@@ -4,6 +4,8 @@
net7.0
enable
enable
+
+ true
diff --git a/Newsbot.Collector.Api/Program.cs b/Newsbot.Collector.Api/Program.cs
index e3ae5fc..f35dbc3 100644
--- a/Newsbot.Collector.Api/Program.cs
+++ b/Newsbot.Collector.Api/Program.cs
@@ -35,7 +35,7 @@ GlobalConfiguration.Configuration.UseSerilogLogProvider();
// Build Health Checks
builder.Services.AddHealthChecks()
- .AddNpgSql(config.GetValue(ConfigConnectionStringConst.Database) ?? "");
+ .AddNpgSql(config.GetValue(ConfigConst.ConnectionStringDatabase) ?? "");
builder.Services.AddControllers();
@@ -109,7 +109,7 @@ static IConfiguration GetConfiguration()
static ILogger GetLogger(IConfiguration configuration)
{
- var otel = configuration.GetValue(ConfigConnectionStringConst.OpenTelemetry) ?? "";
+ var otel = configuration.GetValue(ConfigConst.ConnectionStringOpenTelemetry) ?? "";
if (otel == "")
return Log.Logger = new LoggerConfiguration()
diff --git a/Newsbot.Collector.Api/Startup/DatabaseStartup.cs b/Newsbot.Collector.Api/Startup/DatabaseStartup.cs
index 04495ae..f5f60c3 100644
--- a/Newsbot.Collector.Api/Startup/DatabaseStartup.cs
+++ b/Newsbot.Collector.Api/Startup/DatabaseStartup.cs
@@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Newsbot.Collector.Api.Domain;
-using Newsbot.Collector.Api.Services;
using Newsbot.Collector.Database;
using Newsbot.Collector.Database.Repositories;
using Newsbot.Collector.Domain.Interfaces;
+using Newsbot.Collector.Services;
namespace Newsbot.Collector.Api.Startup;