mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-09 00:24:15 -04:00
* Moved logic from TachiyomiController.cs to TachiyomiService.cs * Added GetLatestChapter Unit Tests * Tachiyomi more tests. Implemented test for yearly volumes * MarkVolumesUntilAsRead unit test * Registered tachiyomi service. Added new test * Fixed test pages * Added missing check if its single-file volume * Removed dead code * Added method documentation and breaked thousands with `_` * Review details and renamed test method to be more descriptive * Review changes - Removed automapper - Added spaces after commas - Added class documentation (copied from controller) - Made Culture static - Added 'R' doc linking to docs.ms - Added trycatch to service when saving progress and logged - Removed redundant qualifiers * finishing touches Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com>
77 lines
3.2 KiB
C#
77 lines
3.2 KiB
C#
using System.IO.Abstractions;
|
|
using API.Data;
|
|
using API.Helpers;
|
|
using API.Services;
|
|
using API.Services.Tasks;
|
|
using API.Services.Tasks.Metadata;
|
|
using API.Services.Tasks.Scanner;
|
|
using API.SignalR;
|
|
using API.SignalR.Presence;
|
|
using Kavita.Common;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace API.Extensions;
|
|
|
|
public static class ApplicationServiceExtensions
|
|
{
|
|
public static void AddApplicationServices(this IServiceCollection services, IConfiguration config, IWebHostEnvironment env)
|
|
{
|
|
services.AddAutoMapper(typeof(AutoMapperProfiles).Assembly);
|
|
|
|
services.AddScoped<IUnitOfWork, UnitOfWork>();
|
|
services.AddScoped<IDirectoryService, DirectoryService>();
|
|
services.AddScoped<ITokenService, TokenService>();
|
|
services.AddScoped<IFileSystem, FileSystem>();
|
|
services.AddScoped<IFileService, FileService>();
|
|
services.AddScoped<ICacheHelper, CacheHelper>();
|
|
|
|
services.AddScoped<IStatsService, StatsService>();
|
|
services.AddScoped<ITaskScheduler, TaskScheduler>();
|
|
services.AddScoped<ICacheService, CacheService>();
|
|
services.AddScoped<IArchiveService, ArchiveService>();
|
|
services.AddScoped<IBackupService, BackupService>();
|
|
services.AddScoped<ICleanupService, CleanupService>();
|
|
services.AddScoped<IBookService, BookService>();
|
|
services.AddScoped<IImageService, ImageService>();
|
|
services.AddScoped<IVersionUpdaterService, VersionUpdaterService>();
|
|
services.AddScoped<IDownloadService, DownloadService>();
|
|
services.AddScoped<IReaderService, ReaderService>();
|
|
services.AddScoped<IReadingItemService, ReadingItemService>();
|
|
services.AddScoped<IAccountService, AccountService>();
|
|
services.AddScoped<IEmailService, EmailService>();
|
|
services.AddScoped<IBookmarkService, BookmarkService>();
|
|
services.AddScoped<IThemeService, ThemeService>();
|
|
services.AddScoped<ISeriesService, SeriesService>();
|
|
services.AddScoped<IProcessSeries, ProcessSeries>();
|
|
services.AddScoped<IReadingListService, ReadingListService>();
|
|
|
|
services.AddScoped<IScannerService, ScannerService>();
|
|
services.AddScoped<IMetadataService, MetadataService>();
|
|
services.AddScoped<IWordCountAnalyzerService, WordCountAnalyzerService>();
|
|
services.AddScoped<ILibraryWatcher, LibraryWatcher>();
|
|
services.AddScoped<ITachiyomiService, TachiyomiService>();
|
|
|
|
services.AddScoped<IPresenceTracker, PresenceTracker>();
|
|
services.AddScoped<IEventHub, EventHub>();
|
|
|
|
services.AddSqLite(config, env);
|
|
services.AddSignalR(opt => opt.EnableDetailedErrors = true);
|
|
}
|
|
|
|
private static void AddSqLite(this IServiceCollection services, IConfiguration config,
|
|
IHostEnvironment env)
|
|
{
|
|
services.AddDbContext<DataContext>(options =>
|
|
{
|
|
options.UseSqlite("Data source=config/kavita.db");
|
|
options.EnableDetailedErrors();
|
|
options.EnableSensitiveDataLogging(env.IsDevelopment());
|
|
});
|
|
}
|
|
}
|