mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* Implemented methods to parse out the whole ComicInfo file and a mock ComicInfo from epub files. * Removed unused imports. ScanSeries needs to cleanup deleted chapters and call RefreshMetadata. Ensure after scan we cleanup tags without any series. * Random cleanup * Added some comments about data getting stale and not updating. * Removed old Summary methods in favor of the ComicInfo versions * Added a missing property * Fixed unit test
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using API.DTOs.Settings;
|
|
using API.Entities;
|
|
using API.Entities.Enums;
|
|
using API.Interfaces.Repositories;
|
|
using AutoMapper;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace API.Data.Repositories
|
|
{
|
|
public class SettingsRepository : ISettingsRepository
|
|
{
|
|
private readonly DataContext _context;
|
|
private readonly IMapper _mapper;
|
|
|
|
public SettingsRepository(DataContext context, IMapper mapper)
|
|
{
|
|
_context = context;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
public void Update(ServerSetting settings)
|
|
{
|
|
_context.Entry(settings).State = EntityState.Modified;
|
|
}
|
|
|
|
public async Task<ServerSettingDto> GetSettingsDtoAsync()
|
|
{
|
|
var settings = await _context.ServerSetting
|
|
.Select(x => x)
|
|
.AsNoTracking()
|
|
.ToListAsync();
|
|
return _mapper.Map<ServerSettingDto>(settings);
|
|
}
|
|
|
|
public Task<ServerSetting> GetSettingAsync(ServerSettingKey key)
|
|
{
|
|
return _context.ServerSetting.SingleOrDefaultAsync(x => x.Key == key);
|
|
}
|
|
|
|
public async Task<IEnumerable<ServerSetting>> GetSettingsAsync()
|
|
{
|
|
return await _context.ServerSetting.ToListAsync();
|
|
}
|
|
}
|
|
}
|