mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Fixed the constraint issue with Metadata and ensure we log parameters on development modes. (#273)
This commit is contained in:
parent
ee3cb9ede8
commit
f0f74e867e
@ -106,6 +106,8 @@ namespace API.Data
|
|||||||
.Where(x => x.Id == libraryId)
|
.Where(x => x.Id == libraryId)
|
||||||
.Include(f => f.Folders)
|
.Include(f => f.Folders)
|
||||||
.Include(l => l.Series)
|
.Include(l => l.Series)
|
||||||
|
.ThenInclude(s => s.Metadata)
|
||||||
|
.Include(l => l.Series)
|
||||||
.ThenInclude(s => s.Volumes)
|
.ThenInclude(s => s.Volumes)
|
||||||
.ThenInclude(v => v.Chapters)
|
.ThenInclude(v => v.Chapters)
|
||||||
.ThenInclude(c => c.Files)
|
.ThenInclude(c => c.Files)
|
||||||
|
@ -4,16 +4,18 @@ using API.Interfaces;
|
|||||||
using API.Interfaces.Services;
|
using API.Interfaces.Services;
|
||||||
using API.Services;
|
using API.Services;
|
||||||
using API.Services.Tasks;
|
using API.Services.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace API.Extensions
|
namespace API.Extensions
|
||||||
{
|
{
|
||||||
public static class ApplicationServiceExtensions
|
public static class ApplicationServiceExtensions
|
||||||
{
|
{
|
||||||
public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config)
|
public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration config, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
services.AddAutoMapper(typeof(AutoMapperProfiles).Assembly);
|
services.AddAutoMapper(typeof(AutoMapperProfiles).Assembly);
|
||||||
services.AddScoped<ITaskScheduler, TaskScheduler>();
|
services.AddScoped<ITaskScheduler, TaskScheduler>();
|
||||||
@ -32,6 +34,7 @@ namespace API.Extensions
|
|||||||
services.AddDbContext<DataContext>(options =>
|
services.AddDbContext<DataContext>(options =>
|
||||||
{
|
{
|
||||||
options.UseSqlite(config.GetConnectionString("DefaultConnection"));
|
options.UseSqlite(config.GetConnectionString("DefaultConnection"));
|
||||||
|
options.EnableSensitiveDataLogging(env.IsDevelopment());
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddLogging(loggingBuilder =>
|
services.AddLogging(loggingBuilder =>
|
||||||
|
@ -228,6 +228,7 @@ namespace API.Services.Tasks
|
|||||||
|
|
||||||
existingSeries.NormalizedName = Parser.Parser.Normalize(existingSeries.Name);
|
existingSeries.NormalizedName = Parser.Parser.Normalize(existingSeries.Name);
|
||||||
existingSeries.OriginalName ??= infos[0].Series;
|
existingSeries.OriginalName ??= infos[0].Series;
|
||||||
|
existingSeries.Metadata ??= DbFactory.SeriesMetadata(new List<CollectionTag>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, we only have to deal with series that exist on disk. Let's recalculate the volumes for each series
|
// Now, we only have to deal with series that exist on disk. Let's recalculate the volumes for each series
|
||||||
|
@ -24,16 +24,18 @@ namespace API
|
|||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
private readonly IConfiguration _config;
|
private readonly IConfiguration _config;
|
||||||
|
private readonly IWebHostEnvironment _env;
|
||||||
|
|
||||||
public Startup(IConfiguration config)
|
public Startup(IConfiguration config, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_env = env;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddApplicationServices(_config);
|
services.AddApplicationServices(_config, _env);
|
||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
services.Configure<ForwardedHeadersOptions>(options =>
|
services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user