using DotBased.Monads; using Manager.App.Models.Library; using Manager.App.Models.Settings; using Manager.Data.Contexts; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; namespace Manager.App.Services; public class LibraryService : ILibraryService { private readonly ILogger _logger; private readonly LibrarySettings _librarySettings; private readonly IDbContextFactory _dbContextFactory; private readonly DirectoryInfo _libraryDirectory; private const string SubDirMedia = "Media"; private const string SubDirChannels = "Channels"; public LibraryService(ILogger logger, IOptions librarySettings, IDbContextFactory contextFactory) { _logger = logger; _librarySettings = librarySettings.Value; _dbContextFactory = contextFactory; _libraryDirectory = Directory.CreateDirectory(Path.Combine(_librarySettings.Path, SubDirMedia)); _libraryDirectory = Directory.CreateDirectory(Path.Combine(_librarySettings.Path, SubDirChannels)); } public async Task> GetLibraryInfoAsync() { await using var context = await _dbContextFactory.CreateDbContextAsync(); //TODO: Get library info return ResultError.Fail("Not implemented!"); } }