Add instructions management functionality and update related components
- Introduced new endpoints for managing instruction intros and tabs, allowing admins to create, update, and delete instructional content. - Enhanced the FactoryResetCommandHandler to include the seeding of instruction data during a factory reset. - Updated the database schema to include InstructionIntro and InstructionTab entities, with corresponding migrations. - Improved frontend routing and components to support the new instructions section, including a dedicated page for displaying instructions and tabs. - Enhanced API documentation to reflect the new instruction management features and their expected request/response formats. - Added localization support for the new instructions functionality in both Russian and English.
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PnvPanel.Application.Common.Interfaces;
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed class DeleteInstructionTabCommandHandler(IAppDbContext dbContext)
|
||||
: ICommandHandler<DeleteInstructionTabCommand, Result>
|
||||
{
|
||||
public async Task<Result> Handle(
|
||||
DeleteInstructionTabCommand command,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var tab = await dbContext.InstructionTabs.FirstOrDefaultAsync(
|
||||
t => t.Id == command.TabId,
|
||||
cancellationToken
|
||||
);
|
||||
if (tab is null)
|
||||
return Result.Failure(InstructionErrors.TabNotFound);
|
||||
|
||||
dbContext.InstructionTabs.Remove(tab);
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user