Logging Enhancements (#1521)

* Recreated Kavita Logging with Serilog instead of Default. This needs to be move out of the appsettings now, to allow auto updater to patch.

* Refactored the code to be completely configured via Code rather than appsettings.json. This is a required step for Auto Updating.

* Added in the ability to send logs directly to the UI only for users on the log route. Stopping implementation as Alerts page will handle the rest of the implementation.

* Fixed up the backup service to not rely on Config from appsettings.json

* Tweaked the Logging levels available

* Moved everything over to File-scoped namespaces

* Moved everything over to File-scoped namespaces

* Code cleanup, removed an old migration and changed so debug logging doesn't print sensitive db data

* Removed dead code
This commit is contained in:
Joseph Milazzo 2022-09-12 19:25:48 -05:00 committed by GitHub
parent 9f715cc35f
commit d1a14f7e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
212 changed files with 16599 additions and 16834 deletions

View File

@ -1,8 +1,7 @@
namespace API.Benchmark namespace API.Benchmark;
{
public class ArchiveSerivceBenchmark public class ArchiveSerivceBenchmark
{ {
// Benchmark to test default GetNumberOfPages from archive // Benchmark to test default GetNumberOfPages from archive
// vs a new method where I try to open the archive and return said stream // vs a new method where I try to open the archive and return said stream
} }
}

View File

@ -5,8 +5,8 @@ using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order; using BenchmarkDotNet.Order;
namespace API.Benchmark namespace API.Benchmark;
{
[MemoryDiagnoser] [MemoryDiagnoser]
[Orderer(SummaryOrderPolicy.FastestToSlowest)] [Orderer(SummaryOrderPolicy.FastestToSlowest)]
[RankColumn] [RankColumn]
@ -76,4 +76,3 @@ namespace API.Benchmark
} }
}

View File

@ -1,7 +1,7 @@
using BenchmarkDotNet.Running; using BenchmarkDotNet.Running;
namespace API.Benchmark namespace API.Benchmark;
{
/// <summary> /// <summary>
/// To build this, cd into API.Benchmark directory and run /// To build this, cd into API.Benchmark directory and run
/// dotnet build -c Release /// dotnet build -c Release
@ -19,4 +19,3 @@ namespace API.Benchmark
} }
} }
}

View File

@ -6,8 +6,8 @@ using API.Extensions;
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Order; using BenchmarkDotNet.Order;
namespace API.Benchmark namespace API.Benchmark;
{
/// <summary> /// <summary>
/// This is used as a scratchpad for testing /// This is used as a scratchpad for testing
/// </summary> /// </summary>
@ -63,4 +63,3 @@ namespace API.Benchmark
} }
} }
}

View File

@ -2,8 +2,8 @@
using API.Comparators; using API.Comparators;
using Xunit; using Xunit;
namespace API.Tests.Comparers namespace API.Tests.Comparers;
{
public class ChapterSortComparerTest public class ChapterSortComparerTest
{ {
[Theory] [Theory]
@ -16,4 +16,3 @@ namespace API.Tests.Comparers
} }
} }
}

View File

@ -2,8 +2,8 @@
using API.Comparators; using API.Comparators;
using Xunit; using Xunit;
namespace API.Tests.Comparers namespace API.Tests.Comparers;
{
public class StringLogicalComparerTest public class StringLogicalComparerTest
{ {
[Theory] [Theory]
@ -31,4 +31,3 @@ namespace API.Tests.Comparers
} }
} }
} }
}

View File

@ -1,8 +1,8 @@
using API.Helpers.Converters; using API.Helpers.Converters;
using Xunit; using Xunit;
namespace API.Tests.Converters namespace API.Tests.Converters;
{
public class CronConverterTests public class CronConverterTests
{ {
[Theory] [Theory]
@ -16,4 +16,3 @@ namespace API.Tests.Converters
Assert.Equal(expected, CronConverter.ConvertToCronNotation(input)); Assert.Equal(expected, CronConverter.ConvertToCronNotation(input));
} }
} }
}

View File

@ -1,8 +1,8 @@
using API.Data; using API.Data;
using Xunit; using Xunit;
namespace API.Tests.Entities namespace API.Tests.Entities;
{
/// <summary> /// <summary>
/// Tests for <see cref="API.Entities.Series"/> /// Tests for <see cref="API.Entities.Series"/>
/// </summary> /// </summary>
@ -24,4 +24,3 @@ namespace API.Tests.Entities
Assert.Equal(key, series.NormalizedName); Assert.Equal(key, series.NormalizedName);
} }
} }
}

View File

@ -6,8 +6,8 @@ using API.Extensions;
using API.Parser; using API.Parser;
using Xunit; using Xunit;
namespace API.Tests.Extensions namespace API.Tests.Extensions;
{
public class ChapterListExtensionsTests public class ChapterListExtensionsTests
{ {
private static Chapter CreateChapter(string range, string number, MangaFile file, bool isSpecial) private static Chapter CreateChapter(string range, string number, MangaFile file, bool isSpecial)
@ -142,4 +142,3 @@ namespace API.Tests.Extensions
#endregion #endregion
} }
}

View File

@ -4,8 +4,8 @@ using System.IO;
using API.Extensions; using API.Extensions;
using Xunit; using Xunit;
namespace API.Tests.Extensions namespace API.Tests.Extensions;
{
public class FileInfoExtensionsTests public class FileInfoExtensionsTests
{ {
private static readonly string TestDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Extensions/Test Data/"); private static readonly string TestDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Extensions/Test Data/");
@ -30,4 +30,3 @@ namespace API.Tests.Extensions
Assert.True(new FileInfo(filepath).HasFileBeenModifiedSince(date)); Assert.True(new FileInfo(filepath).HasFileBeenModifiedSince(date));
} }
} }
}

View File

@ -10,8 +10,8 @@ using Microsoft.Extensions.Logging;
using NSubstitute; using NSubstitute;
using Xunit; using Xunit;
namespace API.Tests.Extensions namespace API.Tests.Extensions;
{
public class ParserInfoListExtensions public class ParserInfoListExtensions
{ {
private readonly IDefaultParser _defaultParser; private readonly IDefaultParser _defaultParser;
@ -50,4 +50,3 @@ namespace API.Tests.Extensions
Assert.Equal(expectedHasInfo, infos.HasInfo(chapter)); Assert.Equal(expectedHasInfo, infos.HasInfo(chapter));
} }
} }
}

View File

@ -7,8 +7,8 @@ using API.Parser;
using API.Services.Tasks.Scanner; using API.Services.Tasks.Scanner;
using Xunit; using Xunit;
namespace API.Tests.Extensions namespace API.Tests.Extensions;
{
public class SeriesExtensionsTests public class SeriesExtensionsTests
{ {
[Theory] [Theory]
@ -89,4 +89,3 @@ namespace API.Tests.Extensions
} }
}

View File

@ -4,8 +4,8 @@ using API.Entities;
using API.Entities.Enums; using API.Entities.Enums;
using API.Entities.Metadata; using API.Entities.Metadata;
namespace API.Tests.Helpers namespace API.Tests.Helpers;
{
/// <summary> /// <summary>
/// Used to help quickly create DB entities for Unit Testing /// Used to help quickly create DB entities for Unit Testing
/// </summary> /// </summary>
@ -80,4 +80,3 @@ namespace API.Tests.Helpers
}; };
} }
} }
}

View File

@ -6,8 +6,8 @@ using API.Entities.Enums;
using API.Parser; using API.Parser;
using API.Services.Tasks.Scanner; using API.Services.Tasks.Scanner;
namespace API.Tests.Helpers namespace API.Tests.Helpers;
{
public static class ParserInfoFactory public static class ParserInfoFactory
{ {
public static ParserInfo CreateParsedInfo(string series, string volumes, string chapters, string filename, bool isSpecial) public static ParserInfo CreateParsedInfo(string series, string volumes, string chapters, string filename, bool isSpecial)
@ -70,4 +70,3 @@ namespace API.Tests.Helpers
} }
} }
}

View File

@ -1,7 +1,7 @@
using System.IO; using System.IO;
namespace API.Tests.Helpers namespace API.Tests.Helpers;
{
/// <summary> /// <summary>
/// Given a -testcase.txt file, will generate a folder with fake archive or book files. These files are just renamed txt files. /// Given a -testcase.txt file, will generate a folder with fake archive or book files. These files are just renamed txt files.
/// <remarks>This currently is broken - you cannot create files from a unit test it seems</remarks> /// <remarks>This currently is broken - you cannot create files from a unit test it seems</remarks>
@ -50,4 +50,3 @@ namespace API.Tests.Helpers
return newDirectory; return newDirectory;
} }
} }
}

View File

@ -1,7 +1,7 @@
using Xunit; using Xunit;
namespace API.Tests.Parser namespace API.Tests.Parser;
{
public class BookParserTests public class BookParserTests
{ {
[Theory] [Theory]
@ -40,4 +40,3 @@ namespace API.Tests.Parser
// Assert.Equal(expected, actual); // Assert.Equal(expected, actual);
// } // }
} }
}

View File

@ -6,8 +6,8 @@ using NSubstitute;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace API.Tests.Parser namespace API.Tests.Parser;
{
public class ComicParserTests public class ComicParserTests
{ {
private readonly ITestOutputHelper _testOutputHelper; private readonly ITestOutputHelper _testOutputHelper;
@ -193,4 +193,3 @@ namespace API.Tests.Parser
Assert.Equal(expected, !string.IsNullOrEmpty(API.Services.Tasks.Scanner.Parser.Parser.ParseComicSpecial(input))); Assert.Equal(expected, !string.IsNullOrEmpty(API.Services.Tasks.Scanner.Parser.Parser.ParseComicSpecial(input)));
} }
} }
}

View File

@ -2,8 +2,8 @@ using API.Entities.Enums;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace API.Tests.Parser namespace API.Tests.Parser;
{
public class MangaParserTests public class MangaParserTests
{ {
private readonly ITestOutputHelper _testOutputHelper; private readonly ITestOutputHelper _testOutputHelper;
@ -317,5 +317,4 @@ namespace API.Tests.Parser
}
} }

View File

@ -2,8 +2,8 @@
using API.Parser; using API.Parser;
using Xunit; using Xunit;
namespace API.Tests.Parser namespace API.Tests.Parser;
{
public class ParserInfoTests public class ParserInfoTests
{ {
[Fact] [Fact]
@ -107,4 +107,3 @@ namespace API.Tests.Parser
Assert.Equal(expected.FullFilePath, actual.FullFilePath); Assert.Equal(expected.FullFilePath, actual.FullFilePath);
} }
} }
}

View File

@ -2,8 +2,8 @@ using System.Linq;
using Xunit; using Xunit;
using static API.Services.Tasks.Scanner.Parser.Parser; using static API.Services.Tasks.Scanner.Parser.Parser;
namespace API.Tests.Parser namespace API.Tests.Parser;
{
public class ParserTests public class ParserTests
{ {
[Theory] [Theory]
@ -231,4 +231,3 @@ namespace API.Tests.Parser
Assert.Equal(expected, NormalizePath(inputPath)); Assert.Equal(expected, NormalizePath(inputPath));
} }
} }
}

View File

@ -14,8 +14,8 @@ using NSubstitute.Extensions;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace API.Tests.Services namespace API.Tests.Services;
{
public class ArchiveServiceTests public class ArchiveServiceTests
{ {
private readonly ITestOutputHelper _testOutputHelper; private readonly ITestOutputHelper _testOutputHelper;
@ -327,4 +327,3 @@ namespace API.Tests.Services
#endregion #endregion
} }
}

View File

@ -135,17 +135,9 @@ public class BackupServiceTests
filesystem.AddFile($"{LogDirectory}kavita1.log", new MockFileData("")); filesystem.AddFile($"{LogDirectory}kavita1.log", new MockFileData(""));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem); var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
var inMemorySettings = new Dictionary<string, string> { var backupService = new BackupService(_logger, _unitOfWork, ds, _messageHub);
{"Logging:File:Path", "config/logs/kavita.log"},
{"Logging:File:MaxRollingFiles", "0"},
};
IConfiguration configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)
.Build();
var backupService = new BackupService(_logger, _unitOfWork, ds, configuration, _messageHub); var backupLogFiles = backupService.GetLogFiles(false).ToList();
var backupLogFiles = backupService.GetLogFiles(0, LogDirectory).ToList();
Assert.Single(backupLogFiles); Assert.Single(backupLogFiles);
Assert.Equal(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath($"{LogDirectory}kavita.log"), API.Services.Tasks.Scanner.Parser.Parser.NormalizePath(backupLogFiles.First())); Assert.Equal(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath($"{LogDirectory}kavita.log"), API.Services.Tasks.Scanner.Parser.Parser.NormalizePath(backupLogFiles.First()));
} }
@ -155,20 +147,12 @@ public class BackupServiceTests
{ {
var filesystem = CreateFileSystem(); var filesystem = CreateFileSystem();
filesystem.AddFile($"{LogDirectory}kavita.log", new MockFileData("")); filesystem.AddFile($"{LogDirectory}kavita.log", new MockFileData(""));
filesystem.AddFile($"{LogDirectory}kavita1.log", new MockFileData("")); filesystem.AddFile($"{LogDirectory}kavita20200213.log", new MockFileData(""));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem); var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
var inMemorySettings = new Dictionary<string, string> { var backupService = new BackupService(_logger, _unitOfWork, ds, _messageHub);
{"Logging:File:Path", "config/logs/kavita.log"},
{"Logging:File:MaxRollingFiles", "1"},
};
IConfiguration configuration = new ConfigurationBuilder()
.AddInMemoryCollection(inMemorySettings)
.Build();
var backupService = new BackupService(_logger, _unitOfWork, ds, configuration, _messageHub); var backupLogFiles = backupService.GetLogFiles().Select(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath).ToList();
var backupLogFiles = backupService.GetLogFiles(1, LogDirectory).Select(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath).ToList();
Assert.NotEmpty(backupLogFiles.Where(file => file.Equals(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath($"{LogDirectory}kavita.log")) || file.Equals(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath($"{LogDirectory}kavita1.log")))); Assert.NotEmpty(backupLogFiles.Where(file => file.Equals(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath($"{LogDirectory}kavita.log")) || file.Equals(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath($"{LogDirectory}kavita1.log"))));
} }

View File

@ -5,8 +5,8 @@ using Microsoft.Extensions.Logging;
using NSubstitute; using NSubstitute;
using Xunit; using Xunit;
namespace API.Tests.Services namespace API.Tests.Services;
{
public class BookServiceTests public class BookServiceTests
{ {
private readonly IBookService _bookService; private readonly IBookService _bookService;
@ -55,4 +55,3 @@ namespace API.Tests.Services
} }
} }
}

View File

@ -20,8 +20,8 @@ using Microsoft.Extensions.Logging;
using NSubstitute; using NSubstitute;
using Xunit; using Xunit;
namespace API.Tests.Services namespace API.Tests.Services;
{
internal class MockReadingItemServiceForCacheService : IReadingItemService internal class MockReadingItemServiceForCacheService : IReadingItemService
{ {
private readonly DirectoryService _directoryService; private readonly DirectoryService _directoryService;
@ -517,4 +517,3 @@ namespace API.Tests.Services
#endregion #endregion
} }
}

View File

@ -10,8 +10,7 @@ using Microsoft.Extensions.Logging;
using NSubstitute; using NSubstitute;
using Xunit; using Xunit;
namespace API.Tests.Services namespace API.Tests.Services;
{
public class DirectoryServiceTests public class DirectoryServiceTests
{ {
@ -997,4 +996,3 @@ namespace API.Tests.Services
#endregion #endregion
} }
}

View File

@ -5,8 +5,8 @@ using System.IO.Abstractions.TestingHelpers;
using API.Helpers; using API.Helpers;
using API.Services; using API.Services;
namespace API.Tests.Services namespace API.Tests.Services;
{
public class MetadataServiceTests public class MetadataServiceTests
{ {
private readonly string _testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ArchiveService/Archives"); private readonly string _testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ArchiveService/Archives");
@ -39,4 +39,3 @@ namespace API.Tests.Services
_cacheHelper = new CacheHelper(fileService); _cacheHelper = new CacheHelper(fileService);
} }
} }
}

View File

@ -9,8 +9,8 @@ using API.Services.Tasks.Scanner;
using API.Tests.Helpers; using API.Tests.Helpers;
using Xunit; using Xunit;
namespace API.Tests.Services namespace API.Tests.Services;
{
public class ScannerServiceTests public class ScannerServiceTests
{ {
[Fact] [Fact]
@ -129,4 +129,3 @@ namespace API.Tests.Services
// if I can do it without deleting the underlying chapter (aka id change) // if I can do it without deleting the underlying chapter (aka id change)
} }
}

View File

@ -73,6 +73,14 @@
<PackageReference Include="NetVips" Version="2.2.0" /> <PackageReference Include="NetVips" Version="2.2.0" />
<PackageReference Include="NetVips.Native" Version="8.13.0" /> <PackageReference Include="NetVips.Native" Version="8.13.0" />
<PackageReference Include="NReco.Logging.File" Version="1.1.5" /> <PackageReference Include="NReco.Logging.File" Version="1.1.5" />
<PackageReference Include="Serilog" Version="2.11.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.AspNetCore.SignalR" Version="0.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.SignalR.Core" Version="0.1.2" />
<PackageReference Include="SharpCompress" Version="0.32.2" /> <PackageReference Include="SharpCompress" Version="0.32.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" /> <PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.43.0.51858"> <PackageReference Include="SonarAnalyzer.CSharp" Version="8.43.0.51858">

View File

@ -1,5 +1,5 @@
namespace API.Archive namespace API.Archive;
{
/// <summary> /// <summary>
/// Represents which library should handle opening this library /// Represents which library should handle opening this library
/// </summary> /// </summary>
@ -18,4 +18,3 @@
/// </summary> /// </summary>
Default = 2 Default = 2
} }
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.Comparators namespace API.Comparators;
{
/// <summary> /// <summary>
/// Sorts chapters based on their Number. Uses natural ordering of doubles. /// Sorts chapters based on their Number. Uses natural ordering of doubles.
/// </summary> /// </summary>
@ -63,4 +63,3 @@ namespace API.Comparators
return x.CompareTo(y); return x.CompareTo(y);
} }
} }
}

View File

@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
namespace API.Comparators namespace API.Comparators;
{
public class NumericComparer : IComparer public class NumericComparer : IComparer
{ {
@ -14,4 +14,3 @@ namespace API.Comparators
return -1; return -1;
} }
} }
}

View File

@ -4,8 +4,8 @@
using static System.Char; using static System.Char;
namespace API.Comparators namespace API.Comparators;
{
public static class StringLogicalComparer public static class StringLogicalComparer
{ {
public static int Compare(string s1, string s2) public static int Compare(string s1, string s2)
@ -127,4 +127,3 @@ namespace API.Comparators
} }
} }
} }
}

View File

@ -1,7 +1,7 @@
using System.Collections.Immutable; using System.Collections.Immutable;
namespace API.Constants namespace API.Constants;
{
/// <summary> /// <summary>
/// Role-based Security /// Role-based Security
/// </summary> /// </summary>
@ -31,4 +31,3 @@ namespace API.Constants
public static readonly ImmutableArray<string> ValidRoles = public static readonly ImmutableArray<string> ValidRoles =
ImmutableArray.Create(AdminRole, PlebRole, DownloadRole, ChangePasswordRole, BookmarkRole); ImmutableArray.Create(AdminRole, PlebRole, DownloadRole, ChangePasswordRole, BookmarkRole);
} }
}

View File

@ -26,8 +26,8 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace API.Controllers namespace API.Controllers;
{
/// <summary> /// <summary>
/// All Account matters /// All Account matters
/// </summary> /// </summary>
@ -774,4 +774,3 @@ namespace API.Controllers
} }
} }
}

View File

@ -4,8 +4,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace API.Controllers namespace API.Controllers;
{
public class AdminController : BaseApiController public class AdminController : BaseApiController
{ {
private readonly UserManager<AppUser> _userManager; private readonly UserManager<AppUser> _userManager;
@ -27,4 +27,3 @@ namespace API.Controllers
return users.Count > 0; return users.Count > 0;
} }
} }
}

View File

@ -1,12 +1,11 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace API.Controllers namespace API.Controllers;
{
[ApiController] [ApiController]
[Route("api/[controller]")] [Route("api/[controller]")]
[Authorize] [Authorize]
public class BaseApiController : ControllerBase public class BaseApiController : ControllerBase
{ {
} }
}

View File

@ -13,8 +13,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using VersOne.Epub; using VersOne.Epub;
namespace API.Controllers namespace API.Controllers;
{
public class BookController : BaseApiController public class BookController : BaseApiController
{ {
private readonly IBookService _bookService; private readonly IBookService _bookService;
@ -160,4 +160,3 @@ namespace API.Controllers
} }
} }
}

View File

@ -11,8 +11,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
namespace API.Controllers namespace API.Controllers;
{
/// <summary> /// <summary>
/// APIs for Collections /// APIs for Collections
/// </summary> /// </summary>
@ -189,4 +189,3 @@ namespace API.Controllers
return BadRequest("Something went wrong. Please try again."); return BadRequest("Something went wrong. Please try again.");
} }
} }
}

View File

@ -16,8 +16,8 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace API.Controllers namespace API.Controllers;
{
/// <summary> /// <summary>
/// All APIs related to downloading entities from the system. Requires Download Role or Admin Role. /// All APIs related to downloading entities from the system. Requires Download Role or Admin Role.
/// </summary> /// </summary>
@ -222,4 +222,3 @@ namespace API.Controllers
} }
} }
}

View File

@ -7,8 +7,8 @@ using API.Services;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace API.Controllers namespace API.Controllers;
{
/// <summary> /// <summary>
/// Responsible for servicing up images stored in Kavita for entities /// Responsible for servicing up images stored in Kavita for entities
/// </summary> /// </summary>
@ -150,4 +150,3 @@ namespace API.Controllers
return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path)); return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
} }
} }
}

View File

@ -22,8 +22,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using TaskScheduler = API.Services.TaskScheduler; using TaskScheduler = API.Services.TaskScheduler;
namespace API.Controllers namespace API.Controllers;
{
[Authorize] [Authorize]
public class LibraryController : BaseApiController public class LibraryController : BaseApiController
{ {
@ -341,4 +341,3 @@ namespace API.Controllers
return Ok(await _unitOfWork.LibraryRepository.GetLibraryTypeAsync(libraryId)); return Ok(await _unitOfWork.LibraryRepository.GetLibraryTypeAsync(libraryId));
} }
} }
}

View File

@ -7,8 +7,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace API.Controllers namespace API.Controllers;
{
public class PluginController : BaseApiController public class PluginController : BaseApiController
{ {
private readonly IUnitOfWork _unitOfWork; private readonly IUnitOfWork _unitOfWork;
@ -47,4 +47,3 @@ namespace API.Controllers
}; };
} }
} }
}

View File

@ -17,8 +17,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace API.Controllers namespace API.Controllers;
{
/// <summary> /// <summary>
/// For all things regarding reading, mainly focusing on non-Book related entities /// For all things regarding reading, mainly focusing on non-Book related entities
/// </summary> /// </summary>
@ -769,4 +769,3 @@ namespace API.Controllers
} }
} }
}

View File

@ -13,8 +13,8 @@ using API.SignalR;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace API.Controllers namespace API.Controllers;
{
[Authorize] [Authorize]
public class ReadingListController : BaseApiController public class ReadingListController : BaseApiController
{ {
@ -492,4 +492,3 @@ namespace API.Controllers
return Ok(-1); return Ok(-1);
} }
} }
}

View File

@ -19,8 +19,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace API.Controllers namespace API.Controllers;
{
public class SeriesController : BaseApiController public class SeriesController : BaseApiController
{ {
private readonly ILogger<SeriesController> _logger; private readonly ILogger<SeriesController> _logger;
@ -495,4 +495,3 @@ namespace API.Controllers
} }
} }
} }
}

View File

@ -8,6 +8,7 @@ using API.DTOs.Jobs;
using API.DTOs.Stats; using API.DTOs.Stats;
using API.DTOs.Update; using API.DTOs.Update;
using API.Extensions; using API.Extensions;
using API.Logging;
using API.Services; using API.Services;
using API.Services.Tasks; using API.Services.Tasks;
using Hangfire; using Hangfire;
@ -20,14 +21,13 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using TaskScheduler = System.Threading.Tasks.TaskScheduler; using TaskScheduler = System.Threading.Tasks.TaskScheduler;
namespace API.Controllers namespace API.Controllers;
{
[Authorize(Policy = "RequireAdminRole")] [Authorize(Policy = "RequireAdminRole")]
public class ServerController : BaseApiController public class ServerController : BaseApiController
{ {
private readonly IHostApplicationLifetime _applicationLifetime; private readonly IHostApplicationLifetime _applicationLifetime;
private readonly ILogger<ServerController> _logger; private readonly ILogger<ServerController> _logger;
private readonly IConfiguration _config;
private readonly IBackupService _backupService; private readonly IBackupService _backupService;
private readonly IArchiveService _archiveService; private readonly IArchiveService _archiveService;
private readonly IVersionUpdaterService _versionUpdaterService; private readonly IVersionUpdaterService _versionUpdaterService;
@ -36,13 +36,12 @@ namespace API.Controllers
private readonly IEmailService _emailService; private readonly IEmailService _emailService;
private readonly IBookmarkService _bookmarkService; private readonly IBookmarkService _bookmarkService;
public ServerController(IHostApplicationLifetime applicationLifetime, ILogger<ServerController> logger, IConfiguration config, public ServerController(IHostApplicationLifetime applicationLifetime, ILogger<ServerController> logger,
IBackupService backupService, IArchiveService archiveService, IVersionUpdaterService versionUpdaterService, IStatsService statsService, IBackupService backupService, IArchiveService archiveService, IVersionUpdaterService versionUpdaterService, IStatsService statsService,
ICleanupService cleanupService, IEmailService emailService, IBookmarkService bookmarkService) ICleanupService cleanupService, IEmailService emailService, IBookmarkService bookmarkService)
{ {
_applicationLifetime = applicationLifetime; _applicationLifetime = applicationLifetime;
_logger = logger; _logger = logger;
_config = config;
_backupService = backupService; _backupService = backupService;
_archiveService = archiveService; _archiveService = archiveService;
_versionUpdaterService = versionUpdaterService; _versionUpdaterService = versionUpdaterService;
@ -114,7 +113,7 @@ namespace API.Controllers
[HttpGet("logs")] [HttpGet("logs")]
public ActionResult GetLogs() public ActionResult GetLogs()
{ {
var files = _backupService.GetLogFiles(_config.GetMaxRollingFiles(), _config.GetLoggingFileName()); var files = _backupService.GetLogFiles();
try try
{ {
var zipPath = _archiveService.CreateZipForDownload(files, "logs"); var zipPath = _archiveService.CreateZipForDownload(files, "logs");
@ -155,7 +154,7 @@ namespace API.Controllers
[HttpGet("jobs")] [HttpGet("jobs")]
public ActionResult<IEnumerable<JobDto>> GetJobs() public ActionResult<IEnumerable<JobDto>> GetJobs()
{ {
var recurringJobs = Hangfire.JobStorage.Current.GetConnection().GetRecurringJobs().Select( var recurringJobs = JobStorage.Current.GetConnection().GetRecurringJobs().Select(
dto => dto =>
new JobDto() { new JobDto() {
Id = dto.Id, Id = dto.Id,
@ -171,4 +170,3 @@ namespace API.Controllers
} }
} }
}

View File

@ -9,6 +9,7 @@ using API.DTOs.Settings;
using API.Entities.Enums; using API.Entities.Enums;
using API.Extensions; using API.Extensions;
using API.Helpers.Converters; using API.Helpers.Converters;
using API.Logging;
using API.Services; using API.Services;
using API.Services.Tasks.Scanner; using API.Services.Tasks.Scanner;
using AutoMapper; using AutoMapper;
@ -20,8 +21,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace API.Controllers namespace API.Controllers;
{
public class SettingsController : BaseApiController public class SettingsController : BaseApiController
{ {
private readonly ILogger<SettingsController> _logger; private readonly ILogger<SettingsController> _logger;
@ -159,7 +160,7 @@ namespace API.Controllers
if (setting.Key == ServerSettingKey.LoggingLevel && updateSettingsDto.LoggingLevel + string.Empty != setting.Value) if (setting.Key == ServerSettingKey.LoggingLevel && updateSettingsDto.LoggingLevel + string.Empty != setting.Value)
{ {
setting.Value = updateSettingsDto.LoggingLevel + string.Empty; setting.Value = updateSettingsDto.LoggingLevel + string.Empty;
Configuration.LogLevel = updateSettingsDto.LoggingLevel; LogLevelOptions.SwitchLogLevel(updateSettingsDto.LoggingLevel);
_unitOfWork.SettingsRepository.Update(setting); _unitOfWork.SettingsRepository.Update(setting);
} }
@ -301,4 +302,3 @@ namespace API.Controllers
return Ok(settingsDto.EnableOpds); return Ok(settingsDto.EnableOpds);
} }
} }
}

View File

@ -12,8 +12,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NetVips; using NetVips;
namespace API.Controllers namespace API.Controllers;
{
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -306,4 +306,3 @@ namespace API.Controllers
} }
} }
}

View File

@ -13,8 +13,8 @@ using AutoMapper;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace API.Controllers namespace API.Controllers;
{
[Authorize] [Authorize]
public class UsersController : BaseApiController public class UsersController : BaseApiController
{ {
@ -121,4 +121,3 @@ namespace API.Controllers
} }
} }
}

View File

@ -1,8 +1,7 @@
namespace API.DTOs.Account namespace API.DTOs.Account;
{
public class LoginDto public class LoginDto
{ {
public string Username { get; init; } public string Username { get; init; }
public string Password { get; set; } public string Password { get; set; }
} }
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace API.DTOs.Account namespace API.DTOs.Account;
{
public class ResetPasswordDto public class ResetPasswordDto
{ {
/// <summary> /// <summary>
@ -20,4 +20,3 @@ namespace API.DTOs.Account
/// </summary> /// </summary>
public string OldPassword { get; init; } public string OldPassword { get; init; }
} }
}

View File

@ -5,8 +5,8 @@ using API.DTOs.Reader;
using API.Entities.Enums; using API.Entities.Enums;
using API.Entities.Interfaces; using API.Entities.Interfaces;
namespace API.DTOs namespace API.DTOs;
{
/// <summary> /// <summary>
/// A Chapter is the lowest grouping of a reading medium. A Chapter contains a set of MangaFiles which represents the underlying /// A Chapter is the lowest grouping of a reading medium. A Chapter contains a set of MangaFiles which represents the underlying
/// file (abstracted from type). /// file (abstracted from type).
@ -90,4 +90,3 @@ namespace API.DTOs
/// <inheritdoc cref="IHasReadTimeEstimate.AvgHoursToRead"/> /// <inheritdoc cref="IHasReadTimeEstimate.AvgHoursToRead"/>
public int AvgHoursToRead { get; set; } public int AvgHoursToRead { get; set; }
} }
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.CollectionTags namespace API.DTOs.CollectionTags;
{
public class CollectionTagBulkAddDto public class CollectionTagBulkAddDto
{ {
/// <summary> /// <summary>
@ -15,4 +15,3 @@ namespace API.DTOs.CollectionTags
/// </summary> /// </summary>
public IEnumerable<int> SeriesIds { get; init; } public IEnumerable<int> SeriesIds { get; init; }
} }
}

View File

@ -1,5 +1,5 @@
namespace API.DTOs.CollectionTags namespace API.DTOs.CollectionTags;
{
public class CollectionTagDto public class CollectionTagDto
{ {
public int Id { get; set; } public int Id { get; set; }
@ -12,4 +12,3 @@
public string CoverImage { get; set; } public string CoverImage { get; set; }
public bool CoverImageLocked { get; set; } public bool CoverImageLocked { get; set; }
} }
}

View File

@ -1,10 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.CollectionTags namespace API.DTOs.CollectionTags;
{
public class UpdateSeriesForTagDto public class UpdateSeriesForTagDto
{ {
public CollectionTagDto Tag { get; init; } public CollectionTagDto Tag { get; init; }
public IEnumerable<int> SeriesIdsToRemove { get; init; } public IEnumerable<int> SeriesIdsToRemove { get; init; }
} }
}

View File

@ -2,8 +2,8 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs namespace API.DTOs;
{
public class CreateLibraryDto public class CreateLibraryDto
{ {
[Required] [Required]
@ -14,4 +14,3 @@ namespace API.DTOs
[MinLength(1)] [MinLength(1)]
public IEnumerable<string> Folders { get; init; } public IEnumerable<string> Folders { get; init; }
} }
}

View File

@ -1,9 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs namespace API.DTOs;
{
public class DeleteSeriesDto public class DeleteSeriesDto
{ {
public IList<int> SeriesIds { get; set; } public IList<int> SeriesIds { get; set; }
} }
}

View File

@ -2,11 +2,10 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using API.DTOs.Reader; using API.DTOs.Reader;
namespace API.DTOs.Downloads namespace API.DTOs.Downloads;
{
public class DownloadBookmarkDto public class DownloadBookmarkDto
{ {
[Required] [Required]
public IEnumerable<BookmarkDto> Bookmarks { get; set; } public IEnumerable<BookmarkDto> Bookmarks { get; set; }
} }
}

View File

@ -3,8 +3,8 @@ using System.Runtime.InteropServices;
using API.Entities; using API.Entities;
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs.Filtering namespace API.DTOs.Filtering;
{
public class FilterDto public class FilterDto
{ {
/// <summary> /// <summary>
@ -100,4 +100,3 @@ namespace API.DTOs.Filtering
/// </summary> /// </summary>
public string SeriesNameQuery { get; init; } = string.Empty; public string SeriesNameQuery { get; init; } = string.Empty;
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs namespace API.DTOs;
{
public class LibraryDto public class LibraryDto
{ {
public int Id { get; init; } public int Id { get; init; }
@ -15,4 +15,3 @@ namespace API.DTOs
public LibraryType Type { get; init; } public LibraryType Type { get; init; }
public ICollection<string> Folders { get; init; } public ICollection<string> Folders { get; init; }
} }
}

View File

@ -1,8 +1,8 @@
using System; using System;
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs namespace API.DTOs;
{
public class MangaFileDto public class MangaFileDto
{ {
public int Id { get; init; } public int Id { get; init; }
@ -12,4 +12,3 @@ namespace API.DTOs
public DateTime Created { get; init; } public DateTime Created { get; init; }
} }
}

View File

@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs namespace API.DTOs;
{
/// <summary> /// <summary>
/// Represents a member of a Kavita server. /// Represents a member of a Kavita server.
/// </summary> /// </summary>
@ -16,4 +16,3 @@ namespace API.DTOs
public IEnumerable<LibraryDto> Libraries { get; init; } public IEnumerable<LibraryDto> Libraries { get; init; }
public IEnumerable<string> Roles { get; init; } public IEnumerable<string> Roles { get; init; }
} }
}

View File

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs.Metadata namespace API.DTOs.Metadata;
{
/// <summary> /// <summary>
/// Exclusively metadata about a given chapter /// Exclusively metadata about a given chapter
/// </summary> /// </summary>
@ -53,4 +53,3 @@ namespace API.DTOs.Metadata
public long WordCount { get; set; } public long WordCount { get; set; }
} }
}

View File

@ -1,8 +1,7 @@
namespace API.DTOs.Metadata namespace API.DTOs.Metadata;
{
public class GenreTagDto public class GenreTagDto
{ {
public int Id { get; set; } public int Id { get; set; }
public string Title { get; set; } public string Title { get; set; }
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -59,4 +59,3 @@ namespace API.DTOs.OPDS
return StartIndex.HasValue; return StartIndex.HasValue;
} }
} }
}

View File

@ -1,7 +1,7 @@
using System.Xml.Serialization; using System.Xml.Serialization;
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
public class FeedAuthor public class FeedAuthor
{ {
[XmlElement("name")] [XmlElement("name")]
@ -9,4 +9,3 @@ namespace API.DTOs.OPDS
[XmlElement("uri")] [XmlElement("uri")]
public string Uri { get; set; } public string Uri { get; set; }
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
public class FeedEntry public class FeedEntry
{ {
[XmlElement("updated")] [XmlElement("updated")]
@ -48,4 +48,3 @@ namespace API.DTOs.OPDS
// [XmlElement("category")] // [XmlElement("category")]
// public List<FeedCategory> Categories = new List<FeedCategory>(); // public List<FeedCategory> Categories = new List<FeedCategory>();
} }
}

View File

@ -1,7 +1,7 @@
using System.Xml.Serialization; using System.Xml.Serialization;
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
public class FeedEntryContent public class FeedEntryContent
{ {
[XmlAttribute("type")] [XmlAttribute("type")]
@ -9,4 +9,3 @@ namespace API.DTOs.OPDS
[XmlText] [XmlText]
public string Text; public string Text;
} }
}

View File

@ -1,7 +1,7 @@
using System.Xml.Serialization; using System.Xml.Serialization;
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
public class FeedLink public class FeedLink
{ {
/// <summary> /// <summary>
@ -30,4 +30,3 @@ namespace API.DTOs.OPDS
return TotalPages > 0; return TotalPages > 0;
} }
} }
}

View File

@ -1,5 +1,5 @@
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
public static class FeedLinkRelation public static class FeedLinkRelation
{ {
public const string Debug = "debug"; public const string Debug = "debug";
@ -21,4 +21,3 @@
public const string Stream = "http://vaemendis.net/opds-pse/stream"; public const string Stream = "http://vaemendis.net/opds-pse/stream";
#pragma warning restore S1075 #pragma warning restore S1075
} }
}

View File

@ -1,5 +1,5 @@
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
public static class FeedLinkType public static class FeedLinkType
{ {
public const string Atom = "application/atom+xml"; public const string Atom = "application/atom+xml";
@ -8,4 +8,3 @@
public const string AtomAcquisition = "application/atom+xml;profile=opds-catalog;kind=acquisition"; public const string AtomAcquisition = "application/atom+xml;profile=opds-catalog;kind=acquisition";
public const string Image = "image/jpeg"; public const string Image = "image/jpeg";
} }
}

View File

@ -1,7 +1,7 @@
using System.Xml.Serialization; using System.Xml.Serialization;
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
[XmlRoot("OpenSearchDescription", Namespace = "http://a9.com/-/spec/opensearch/1.1/")] [XmlRoot("OpenSearchDescription", Namespace = "http://a9.com/-/spec/opensearch/1.1/")]
public class OpenSearchDescription public class OpenSearchDescription
{ {
@ -39,4 +39,3 @@ namespace API.DTOs.OPDS
public string Developer { get; set; } = "kavitareader.com"; public string Developer { get; set; } = "kavitareader.com";
} }
}

View File

@ -1,7 +1,7 @@
using System.Xml.Serialization; using System.Xml.Serialization;
namespace API.DTOs.OPDS namespace API.DTOs.OPDS;
{
public class SearchLink public class SearchLink
{ {
[XmlAttribute("type")] [XmlAttribute("type")]
@ -13,4 +13,3 @@ namespace API.DTOs.OPDS
[XmlAttribute("template")] [XmlAttribute("template")]
public string Template { get; set; } public string Template { get; set; }
} }
}

View File

@ -1,11 +1,10 @@
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs namespace API.DTOs;
{
public class PersonDto public class PersonDto
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public PersonRole Role { get; set; } public PersonRole Role { get; set; }
} }
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace API.DTOs namespace API.DTOs;
{
public class ProgressDto public class ProgressDto
{ {
[Required] [Required]
@ -18,4 +18,3 @@ namespace API.DTOs
/// </summary> /// </summary>
public string BookScrollId { get; set; } public string BookScrollId { get; set; }
} }
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class BookChapterItem public class BookChapterItem
{ {
/// <summary> /// <summary>
@ -18,4 +18,3 @@ namespace API.DTOs.Reader
public int Page { get; set; } public int Page { get; set; }
public ICollection<BookChapterItem> Children { get; set; } public ICollection<BookChapterItem> Children { get; set; }
} }
}

View File

@ -1,7 +1,7 @@
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class BookInfoDto : IChapterInfoDto public class BookInfoDto : IChapterInfoDto
{ {
public string BookTitle { get; set; } public string BookTitle { get; set; }
@ -16,4 +16,3 @@ namespace API.DTOs.Reader
public bool IsSpecial { get; set; } public bool IsSpecial { get; set; }
public string ChapterTitle { get; set; } public string ChapterTitle { get; set; }
} }
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class BookmarkDto public class BookmarkDto
{ {
public int Id { get; set; } public int Id { get; set; }
@ -14,4 +14,3 @@ namespace API.DTOs.Reader
[Required] [Required]
public int ChapterId { get; set; } public int ChapterId { get; set; }
} }
}

View File

@ -1,9 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class BulkRemoveBookmarkForSeriesDto public class BulkRemoveBookmarkForSeriesDto
{ {
public ICollection<int> SeriesIds { get; init; } public ICollection<int> SeriesIds { get; init; }
} }
}

View File

@ -1,7 +1,7 @@
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public interface IChapterInfoDto public interface IChapterInfoDto
{ {
public int SeriesId { get; set; } public int SeriesId { get; set; }
@ -16,4 +16,3 @@ namespace API.DTOs.Reader
public string ChapterTitle { get; set; } public string ChapterTitle { get; set; }
} }
}

View File

@ -1,9 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class MarkMultipleSeriesAsReadDto public class MarkMultipleSeriesAsReadDto
{ {
public IReadOnlyList<int> SeriesIds { get; init; } public IReadOnlyList<int> SeriesIds { get; init; }
} }
}

View File

@ -1,7 +1,6 @@
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class MarkReadDto public class MarkReadDto
{ {
public int SeriesId { get; init; } public int SeriesId { get; init; }
} }
}

View File

@ -1,8 +1,7 @@
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class MarkVolumeReadDto public class MarkVolumeReadDto
{ {
public int SeriesId { get; init; } public int SeriesId { get; init; }
public int VolumeId { get; init; } public int VolumeId { get; init; }
} }
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
/// <summary> /// <summary>
/// This is used for bulk updating a set of volume and or chapters in one go /// This is used for bulk updating a set of volume and or chapters in one go
/// </summary> /// </summary>
@ -17,4 +17,3 @@ namespace API.DTOs.Reader
/// </summary> /// </summary>
public IReadOnlyList<int> ChapterIds { get; set; } public IReadOnlyList<int> ChapterIds { get; set; }
} }
}

View File

@ -1,7 +1,6 @@
namespace API.DTOs.Reader namespace API.DTOs.Reader;
{
public class RemoveBookmarkForSeriesDto public class RemoveBookmarkForSeriesDto
{ {
public int SeriesId { get; init; } public int SeriesId { get; init; }
} }
}

View File

@ -1,7 +1,6 @@
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class CreateReadingListDto public class CreateReadingListDto
{ {
public string Title { get; init; } public string Title { get; init; }
} }
}

View File

@ -1,5 +1,5 @@
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class ReadingListDto public class ReadingListDto
{ {
public int Id { get; init; } public int Id { get; init; }
@ -15,4 +15,3 @@
/// </summary> /// </summary>
public string CoverImage { get; set; } = string.Empty; public string CoverImage { get; set; } = string.Empty;
} }
}

View File

@ -1,7 +1,7 @@
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class ReadingListItemDto public class ReadingListItemDto
{ {
public int Id { get; init; } public int Id { get; init; }
@ -22,4 +22,3 @@ namespace API.DTOs.ReadingLists
/// </summary> /// </summary>
public int ReadingListId { get; set; } public int ReadingListId { get; set; }
} }
}

View File

@ -1,9 +1,8 @@
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class UpdateReadingListByChapterDto public class UpdateReadingListByChapterDto
{ {
public int ChapterId { get; init; } public int ChapterId { get; init; }
public int SeriesId { get; init; } public int SeriesId { get; init; }
public int ReadingListId { get; init; } public int ReadingListId { get; init; }
} }
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class UpdateReadingListByMultipleDto public class UpdateReadingListByMultipleDto
{ {
public int SeriesId { get; init; } public int SeriesId { get; init; }
@ -9,4 +9,3 @@ namespace API.DTOs.ReadingLists
public IReadOnlyList<int> VolumeIds { get; init; } public IReadOnlyList<int> VolumeIds { get; init; }
public IReadOnlyList<int> ChapterIds { get; init; } public IReadOnlyList<int> ChapterIds { get; init; }
} }
}

View File

@ -1,10 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class UpdateReadingListByMultipleSeriesDto public class UpdateReadingListByMultipleSeriesDto
{ {
public int ReadingListId { get; init; } public int ReadingListId { get; init; }
public IReadOnlyList<int> SeriesIds { get; init; } public IReadOnlyList<int> SeriesIds { get; init; }
} }
}

View File

@ -1,8 +1,7 @@
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class UpdateReadingListBySeriesDto public class UpdateReadingListBySeriesDto
{ {
public int SeriesId { get; init; } public int SeriesId { get; init; }
public int ReadingListId { get; init; } public int ReadingListId { get; init; }
} }
}

View File

@ -1,9 +1,8 @@
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class UpdateReadingListByVolumeDto public class UpdateReadingListByVolumeDto
{ {
public int VolumeId { get; init; } public int VolumeId { get; init; }
public int SeriesId { get; init; } public int SeriesId { get; init; }
public int ReadingListId { get; init; } public int ReadingListId { get; init; }
} }
}

View File

@ -1,5 +1,5 @@
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
public class UpdateReadingListDto public class UpdateReadingListDto
{ {
public int ReadingListId { get; set; } public int ReadingListId { get; set; }
@ -8,4 +8,3 @@
public bool Promoted { get; set; } public bool Promoted { get; set; }
public bool CoverImageLocked { get; set; } public bool CoverImageLocked { get; set; }
} }
}

View File

@ -1,18 +1,14 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace API.DTOs.ReadingLists namespace API.DTOs.ReadingLists;
{
/// <summary> /// <summary>
/// DTO for moving a reading list item to another position within the same list /// DTO for moving a reading list item to another position within the same list
/// </summary> /// </summary>
public class UpdateReadingListPosition public class UpdateReadingListPosition
{ {
[Required] [Required] public int ReadingListId { get; set; }
public int ReadingListId { get; set; } [Required] public int ReadingListItemId { get; set; }
[Required]
public int ReadingListItemId { get; set; }
public int FromPosition { get; set; } public int FromPosition { get; set; }
[Required] [Required] public int ToPosition { get; set; }
public int ToPosition { get; set; }
}
} }

View File

@ -1,5 +1,5 @@
namespace API.DTOs namespace API.DTOs;
{
/// <summary> /// <summary>
/// Used for running some task against a Series. /// Used for running some task against a Series.
/// </summary> /// </summary>
@ -19,4 +19,3 @@
/// <remarks>This is expensive if true. Defaults to true.</remarks> /// <remarks>This is expensive if true. Defaults to true.</remarks>
public bool ForceUpdate { get; init; } = true; public bool ForceUpdate { get; init; } = true;
} }
}

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace API.DTOs namespace API.DTOs;
{
public class RegisterDto public class RegisterDto
{ {
[Required] [Required]
@ -12,4 +12,3 @@ namespace API.DTOs
[StringLength(32, MinimumLength = 6)] [StringLength(32, MinimumLength = 6)]
public string Password { get; set; } public string Password { get; set; }
} }
}

View File

@ -1,7 +1,7 @@
using API.Entities.Enums; using API.Entities.Enums;
namespace API.DTOs.Search namespace API.DTOs.Search;
{
public class SearchResultDto public class SearchResultDto
{ {
public int SeriesId { get; init; } public int SeriesId { get; init; }
@ -15,4 +15,3 @@ namespace API.DTOs.Search
public string LibraryName { get; set; } public string LibraryName { get; set; }
public int LibraryId { get; set; } public int LibraryId { get; set; }
} }
}

View File

@ -1,7 +1,6 @@
namespace API.DTOs namespace API.DTOs;
{
public class SeriesByIdsDto public class SeriesByIdsDto
{ {
public int[] SeriesIds { get; init; } public int[] SeriesIds { get; init; }
} }
}

View File

@ -2,8 +2,8 @@
using API.Entities.Enums; using API.Entities.Enums;
using API.Entities.Interfaces; using API.Entities.Interfaces;
namespace API.DTOs namespace API.DTOs;
{
public class SeriesDto : IHasReadTimeEstimate public class SeriesDto : IHasReadTimeEstimate
{ {
public int Id { get; init; } public int Id { get; init; }
@ -63,4 +63,3 @@ namespace API.DTOs
/// </summary> /// </summary>
public DateTime LastFolderScanned { get; set; } public DateTime LastFolderScanned { get; set; }
} }
}

Some files were not shown because too many files have changed in this diff Show More