add UserRendererService and improve errors

This commit is contained in:
sam 2024-05-28 17:09:50 +02:00
parent 6114f384a0
commit f674d059fd
14 changed files with 607 additions and 25 deletions

View file

@ -3,13 +3,14 @@ using Foxnouns.Backend.Database;
using Serilog;
using Foxnouns.Backend.Extensions;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
var builder = WebApplication.CreateBuilder(args);
var config = builder.AddConfiguration();
builder.AddSerilog(config.LogEventLevel);
builder.AddSerilog();
builder.Services
.AddControllers()
@ -25,6 +26,15 @@ builder.Services
);
});
// Set the default converter to snake case as we use it in a couple places.
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new SnakeCaseNamingStrategy()
}
};
builder.Services
.AddDbContext<DatabaseContext>()
.AddCustomServices()