Files
PnvPanel/backend/src/PnvPanel.Application/Instructions/ListInstructionTabsQueryHandler.cs
T
Leonid Pershin bef3880593
CI / Backend (build + test) (push) Successful in 1m17s
CI / Frontend (lint + typecheck + build) (push) Successful in 32s
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.
2026-07-14 22:20:10 +03:00

32 lines
1015 B
C#

using Microsoft.EntityFrameworkCore;
using PnvPanel.Application.Common.Interfaces;
using PnvPanel.Application.Common.Messaging;
using PnvPanel.Application.Common.Models;
namespace PnvPanel.Application.Instructions;
public sealed class ListInstructionTabsQueryHandler(IAppDbContext dbContext)
: IQueryHandler<ListInstructionTabsQuery, Result<IReadOnlyList<InstructionTabDto>>>
{
public async Task<Result<IReadOnlyList<InstructionTabDto>>> Handle(
ListInstructionTabsQuery query,
CancellationToken cancellationToken
)
{
var tabs = await dbContext
.InstructionTabs.AsNoTracking()
.OrderBy(t => t.SortOrder)
.Select(t => new InstructionTabDto(
t.Id,
t.Title,
t.Body,
t.SortOrder,
t.CreatedAt,
t.UpdatedAt
))
.ToListAsync(cancellationToken);
return Result.Success<IReadOnlyList<InstructionTabDto>>(tabs);
}
}