This commit is contained in:
2025-04-30 09:51:36 +08:00
parent 561881c9aa
commit 09afa239a6
848 changed files with 385870 additions and 205 deletions

View File

@@ -0,0 +1,30 @@
namespace Yes.Application.Admins.Themes
{
public record UpdateThemeCommand(
string Theme
) : IRequest<Unit>;
public class UpdateThemeCommandHandler(
IOptionsMonitor<BlogSettings> options,
IMapper mapper,
IThemeService themeService,
IConfigurationService configurationService
) : IRequestHandler<UpdateThemeCommand, Unit>
{
private readonly BlogSettings _settings = options.CurrentValue;
private readonly IMapper _mapper = mapper;
private readonly IThemeService _themeService = themeService;
private readonly IConfigurationService _configurationService = configurationService;
public async Task<Unit> Handle(UpdateThemeCommand request, CancellationToken cancellationToken)
{
_themeService.CheckThemeExists(request.Theme);
_mapper.Map(request, _settings);
await _configurationService.SaveConfiguration(_settings);
return new Unit();
}
}
}