Updated namespaces, consts, startup and warnings are now errors in the api project
This commit is contained in:
parent
2bc99afe63
commit
fa14562fd4
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -35,7 +35,7 @@ GlobalConfiguration.Configuration.UseSerilogLogProvider();
|
||||
|
||||
// Build Health Checks
|
||||
builder.Services.AddHealthChecks()
|
||||
.AddNpgSql(config.GetValue<string>(ConfigConnectionStringConst.Database) ?? "");
|
||||
.AddNpgSql(config.GetValue<string>(ConfigConst.ConnectionStringDatabase) ?? "");
|
||||
|
||||
|
||||
builder.Services.AddControllers();
|
||||
@ -109,7 +109,7 @@ static IConfiguration GetConfiguration()
|
||||
|
||||
static ILogger GetLogger(IConfiguration configuration)
|
||||
{
|
||||
var otel = configuration.GetValue<string>(ConfigConnectionStringConst.OpenTelemetry) ?? "";
|
||||
var otel = configuration.GetValue<string>(ConfigConst.ConnectionStringOpenTelemetry) ?? "";
|
||||
|
||||
if (otel == "")
|
||||
return Log.Logger = new LoggerConfiguration()
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user