mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
912 B
24 lines
912 B
using ErsatzTV.Core.Domain; |
|
using ErsatzTV.Core.Interfaces.Repositories; |
|
using Serilog.Events; |
|
|
|
namespace ErsatzTV.Application.Configuration; |
|
|
|
public class GetGeneralSettingsHandler : IRequestHandler<GetGeneralSettings, GeneralSettingsViewModel> |
|
{ |
|
private readonly IConfigElementRepository _configElementRepository; |
|
|
|
public GetGeneralSettingsHandler(IConfigElementRepository configElementRepository) => |
|
_configElementRepository = configElementRepository; |
|
|
|
public async Task<GeneralSettingsViewModel> Handle(GetGeneralSettings request, CancellationToken cancellationToken) |
|
{ |
|
Option<LogEventLevel> maybeLogLevel = |
|
await _configElementRepository.GetValue<LogEventLevel>(ConfigElementKey.MinimumLogLevel); |
|
|
|
return new GeneralSettingsViewModel |
|
{ |
|
MinimumLogLevel = await maybeLogLevel.IfNoneAsync(LogEventLevel.Information) |
|
}; |
|
} |
|
}
|
|
|