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:
@@ -0,0 +1,68 @@
|
||||
using PnvPanel.Api.Common;
|
||||
using PnvPanel.Application.Admin.Instructions;
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Instructions;
|
||||
using PnvPanel.Infrastructure.Identity;
|
||||
|
||||
namespace PnvPanel.Api.Endpoints;
|
||||
|
||||
public static class AdminInstructionEndpoints
|
||||
{
|
||||
public static IEndpointRouteBuilder MapAdminInstructionEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
var admin = app.MapGroup("/api/admin/instructions")
|
||||
.WithTags("Admin.Instructions")
|
||||
.RequireAuthorization(policy => policy.RequireRole(RoleNames.Admin));
|
||||
|
||||
admin.MapPut("/intro", UpdateIntro).Produces<InstructionIntroDto>();
|
||||
admin.MapPost("/tabs", CreateTab).Produces<InstructionTabDto>();
|
||||
admin.MapPut("/tabs/{id:guid}", UpdateTab).Produces<InstructionTabDto>();
|
||||
admin.MapDelete("/tabs/{id:guid}", DeleteTab).Produces(StatusCodes.Status204NoContent);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
private static async Task<IResult> UpdateIntro(
|
||||
UpdateInstructionIntroCommand command,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(command, cancellationToken);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> CreateTab(
|
||||
CreateInstructionTabCommand command,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(command, cancellationToken);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> UpdateTab(
|
||||
Guid id,
|
||||
UpdateInstructionTabBody body,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var command = new UpdateInstructionTabCommand(id, body.Title, body.Body, body.SortOrder);
|
||||
var result = await sender.Send(command, cancellationToken);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> DeleteTab(
|
||||
Guid id,
|
||||
ISender sender,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var result = await sender.Send(new DeleteInstructionTabCommand(id), cancellationToken);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed record UpdateInstructionTabBody(string Title, string Body, int SortOrder);
|
||||
@@ -0,0 +1,32 @@
|
||||
using PnvPanel.Api.Common;
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Instructions;
|
||||
|
||||
namespace PnvPanel.Api.Endpoints;
|
||||
|
||||
public static class InstructionEndpoints
|
||||
{
|
||||
public static IEndpointRouteBuilder MapInstructionEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
var group = app.MapGroup("/api/instructions")
|
||||
.WithTags("Instructions")
|
||||
.RequireAuthorization();
|
||||
|
||||
group.MapGet("/intro", GetIntro).Produces<InstructionIntroDto>();
|
||||
group.MapGet("/tabs", ListTabs).Produces<IReadOnlyList<InstructionTabDto>>();
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
private static async Task<IResult> GetIntro(ISender sender, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await sender.Send(new GetInstructionIntroQuery(), cancellationToken);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
|
||||
private static async Task<IResult> ListTabs(ISender sender, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await sender.Send(new ListInstructionTabsQuery(), cancellationToken);
|
||||
return result.ToHttpResult();
|
||||
}
|
||||
}
|
||||
@@ -185,10 +185,12 @@ app.MapConfigEndpoints();
|
||||
app.MapSubscriptionEndpoints();
|
||||
app.MapAppEndpoints();
|
||||
app.MapNewsEndpoints();
|
||||
app.MapInstructionEndpoints();
|
||||
app.MapAdminUserEndpoints();
|
||||
app.MapAdminStatsEndpoints();
|
||||
app.MapAdminAppEndpoints();
|
||||
app.MapAdminNewsEndpoints();
|
||||
app.MapAdminInstructionEndpoints();
|
||||
app.MapSupportEndpoints();
|
||||
app.MapAdminSupportEndpoints();
|
||||
app.MapAdminMaintenanceEndpoints();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
using PnvPanel.Application.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed record CreateInstructionTabCommand(string Title, string Body, int SortOrder)
|
||||
: ICommand<Result<InstructionTabDto>>;
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using PnvPanel.Application.Common.Interfaces;
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
using PnvPanel.Application.Instructions;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed class CreateInstructionTabCommandHandler(IAppDbContext dbContext)
|
||||
: ICommandHandler<CreateInstructionTabCommand, Result<InstructionTabDto>>
|
||||
{
|
||||
public Task<Result<InstructionTabDto>> Handle(
|
||||
CreateInstructionTabCommand command,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var tab = InstructionTab.Create(command.Title, command.Body, command.SortOrder);
|
||||
dbContext.InstructionTabs.Add(tab);
|
||||
|
||||
return Task.FromResult(Result.Success(InstructionTabDto.FromDomain(tab)));
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed class CreateInstructionTabCommandValidator
|
||||
: AbstractValidator<CreateInstructionTabCommand>
|
||||
{
|
||||
public CreateInstructionTabCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.Title).NotEmpty().MaximumLength(100);
|
||||
RuleFor(x => x.Body).NotEmpty().MaximumLength(20000);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed record DeleteInstructionTabCommand(Guid TabId) : ICommand<Result>;
|
||||
+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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using PnvPanel.Application.Common.Models;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public static class InstructionErrors
|
||||
{
|
||||
public static readonly Error TabNotFound = Error.NotFound(
|
||||
"Instructions.TabNotFound",
|
||||
"Вкладка инструкций не найдена."
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
using PnvPanel.Application.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed record UpdateInstructionIntroCommand(string Body)
|
||||
: ICommand<Result<InstructionIntroDto>>;
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PnvPanel.Application.Common.Interfaces;
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
using PnvPanel.Application.Instructions;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed class UpdateInstructionIntroCommandHandler(IAppDbContext dbContext)
|
||||
: ICommandHandler<UpdateInstructionIntroCommand, Result<InstructionIntroDto>>
|
||||
{
|
||||
public async Task<Result<InstructionIntroDto>> Handle(
|
||||
UpdateInstructionIntroCommand command,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var intro = await dbContext.InstructionIntros.FirstOrDefaultAsync(cancellationToken);
|
||||
if (intro is null)
|
||||
{
|
||||
intro = InstructionIntro.Create(command.Body);
|
||||
dbContext.InstructionIntros.Add(intro);
|
||||
}
|
||||
else
|
||||
{
|
||||
intro.Update(command.Body);
|
||||
}
|
||||
|
||||
return Result.Success(InstructionIntroDto.FromDomain(intro));
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed class UpdateInstructionIntroCommandValidator
|
||||
: AbstractValidator<UpdateInstructionIntroCommand>
|
||||
{
|
||||
public UpdateInstructionIntroCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.Body).NotEmpty().MaximumLength(20000);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
using PnvPanel.Application.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed record UpdateInstructionTabCommand(
|
||||
Guid TabId,
|
||||
string Title,
|
||||
string Body,
|
||||
int SortOrder
|
||||
) : ICommand<Result<InstructionTabDto>>;
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PnvPanel.Application.Common.Interfaces;
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
using PnvPanel.Application.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed class UpdateInstructionTabCommandHandler(IAppDbContext dbContext)
|
||||
: ICommandHandler<UpdateInstructionTabCommand, Result<InstructionTabDto>>
|
||||
{
|
||||
public async Task<Result<InstructionTabDto>> Handle(
|
||||
UpdateInstructionTabCommand command,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var tab = await dbContext.InstructionTabs.FirstOrDefaultAsync(
|
||||
t => t.Id == command.TabId,
|
||||
cancellationToken
|
||||
);
|
||||
if (tab is null)
|
||||
return Result.Failure<InstructionTabDto>(InstructionErrors.TabNotFound);
|
||||
|
||||
tab.Update(command.Title, command.Body, command.SortOrder);
|
||||
|
||||
return Result.Success(InstructionTabDto.FromDomain(tab));
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace PnvPanel.Application.Admin.Instructions;
|
||||
|
||||
public sealed class UpdateInstructionTabCommandValidator
|
||||
: AbstractValidator<UpdateInstructionTabCommand>
|
||||
{
|
||||
public UpdateInstructionTabCommandValidator()
|
||||
{
|
||||
RuleFor(x => x.Title).NotEmpty().MaximumLength(100);
|
||||
RuleFor(x => x.Body).NotEmpty().MaximumLength(20000);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public sealed class FactoryResetCommandHandler(
|
||||
IXuiPanelGateway gateway,
|
||||
IFileStorage fileStorage,
|
||||
IClientAppCatalogSeeder catalogSeeder,
|
||||
IInstructionIntroSeeder instructionIntroSeeder,
|
||||
ICurrentUser currentUser
|
||||
) : ICommandHandler<FactoryResetCommand, Result>
|
||||
{
|
||||
@@ -44,8 +45,9 @@ public sealed class FactoryResetCommandHandler(
|
||||
foreach (var role in roles.Where(r => !r.IsSystem))
|
||||
await roleService.DeleteRoleAsync(role.Id, cancellationToken);
|
||||
|
||||
// ClientApps уже пуста (удалена в WipeApplicationData + сохранена выше) — пересеиваем.
|
||||
// ClientApps/InstructionIntros уже пусты (удалены в WipeApplicationData + сохранено выше) — пересеиваем.
|
||||
await catalogSeeder.SeedIfEmptyAsync(cancellationToken);
|
||||
await instructionIntroSeeder.SeedIfEmptyAsync(cancellationToken);
|
||||
|
||||
// Финальная запись — уже после очистки самого журнала, чтобы отметить факт сброса.
|
||||
dbContext.AuditLogs.Add(
|
||||
@@ -116,6 +118,8 @@ public sealed class FactoryResetCommandHandler(
|
||||
dbContext.TelegramLinkTokens.RemoveRange(dbContext.TelegramLinkTokens);
|
||||
dbContext.NewsPosts.RemoveRange(dbContext.NewsPosts);
|
||||
dbContext.ClientApps.RemoveRange(dbContext.ClientApps);
|
||||
dbContext.InstructionIntros.RemoveRange(dbContext.InstructionIntros);
|
||||
dbContext.InstructionTabs.RemoveRange(dbContext.InstructionTabs);
|
||||
dbContext.AuditLogs.RemoveRange(dbContext.AuditLogs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using PnvPanel.Domain.Apps;
|
||||
using PnvPanel.Domain.Audit;
|
||||
using PnvPanel.Domain.Configs;
|
||||
using PnvPanel.Domain.Inbounds;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
using PnvPanel.Domain.News;
|
||||
using PnvPanel.Domain.Nodes;
|
||||
using PnvPanel.Domain.Support;
|
||||
@@ -40,6 +41,10 @@ public interface IAppDbContext
|
||||
|
||||
DbSet<TicketAttachment> TicketAttachments { get; }
|
||||
|
||||
DbSet<InstructionIntro> InstructionIntros { get; }
|
||||
|
||||
DbSet<InstructionTab> InstructionTabs { get; }
|
||||
|
||||
/// <summary>Нужен для advisory-lock при проверке квоты конфигов (см. CreateVpnConfigCommandHandler).</summary>
|
||||
DatabaseFacade Database { get; }
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace PnvPanel.Application.Common.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Сидинг дефолтного вводного текста страницы инструкций. Идемпотентно — не трогает таблицу, если
|
||||
/// в ней уже есть строка (используется и при старте, и после полного сброса панели).
|
||||
/// </summary>
|
||||
public interface IInstructionIntroSeeder
|
||||
{
|
||||
Task SeedIfEmptyAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
|
||||
namespace PnvPanel.Application.Instructions;
|
||||
|
||||
public sealed record GetInstructionIntroQuery
|
||||
: IQuery<Result<InstructionIntroDto>>,
|
||||
IRequiresActivation;
|
||||
@@ -0,0 +1,27 @@
|
||||
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 GetInstructionIntroQueryHandler(IAppDbContext dbContext)
|
||||
: IQueryHandler<GetInstructionIntroQuery, Result<InstructionIntroDto>>
|
||||
{
|
||||
public async Task<Result<InstructionIntroDto>> Handle(
|
||||
GetInstructionIntroQuery query,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var intro = await dbContext
|
||||
.InstructionIntros.AsNoTracking()
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
// Ещё не сидировано/не сохранено ни разу — пустой текст, а не ошибка (страница не должна падать).
|
||||
return Result.Success(
|
||||
intro is null
|
||||
? new InstructionIntroDto(Guid.Empty, string.Empty, DateTimeOffset.MinValue)
|
||||
: InstructionIntroDto.FromDomain(intro)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using PnvPanel.Domain.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Instructions;
|
||||
|
||||
public sealed record InstructionIntroDto(Guid Id, string Body, DateTimeOffset UpdatedAt)
|
||||
{
|
||||
public static InstructionIntroDto FromDomain(InstructionIntro intro) =>
|
||||
new(intro.Id, intro.Body, intro.UpdatedAt);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using PnvPanel.Domain.Instructions;
|
||||
|
||||
namespace PnvPanel.Application.Instructions;
|
||||
|
||||
/// <summary>Один DTO на пользовательскую страницу и админку — у вкладки нет полей, скрытых от юзера
|
||||
/// (нет статуса черновик/опубликовано, см. InstructionTab).</summary>
|
||||
public sealed record InstructionTabDto(
|
||||
Guid Id,
|
||||
string Title,
|
||||
string Body,
|
||||
int SortOrder,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset? UpdatedAt
|
||||
)
|
||||
{
|
||||
public static InstructionTabDto FromDomain(InstructionTab tab) =>
|
||||
new(tab.Id, tab.Title, tab.Body, tab.SortOrder, tab.CreatedAt, tab.UpdatedAt);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using PnvPanel.Application.Common.Messaging;
|
||||
using PnvPanel.Application.Common.Models;
|
||||
|
||||
namespace PnvPanel.Application.Instructions;
|
||||
|
||||
public sealed record ListInstructionTabsQuery
|
||||
: IQuery<Result<IReadOnlyList<InstructionTabDto>>>,
|
||||
IRequiresActivation;
|
||||
@@ -0,0 +1,31 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using PnvPanel.Domain.Common;
|
||||
|
||||
namespace PnvPanel.Domain.Instructions;
|
||||
|
||||
/// <summary>
|
||||
/// Единственная строка в таблице — вводный markdown-текст на странице инструкций (над каталогом
|
||||
/// приложений), редактируется админом. Никакой поддержки нескольких версий/языков нет намеренно.
|
||||
/// </summary>
|
||||
public sealed class InstructionIntro : Entity
|
||||
{
|
||||
public string Body { get; private set; } = string.Empty;
|
||||
public DateTimeOffset UpdatedAt { get; private set; }
|
||||
|
||||
private InstructionIntro() { }
|
||||
|
||||
public static InstructionIntro Create(string body)
|
||||
{
|
||||
return new InstructionIntro
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Body = body,
|
||||
UpdatedAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(string body)
|
||||
{
|
||||
Body = body;
|
||||
UpdatedAt = DateTimeOffset.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using PnvPanel.Domain.Common;
|
||||
|
||||
namespace PnvPanel.Domain.Instructions;
|
||||
|
||||
/// <summary>
|
||||
/// Дополнительная вкладка на странице инструкций — заголовок + markdown-текст, ведёт админ.
|
||||
/// Порядок среди вкладок — SortOrder (та же конвенция, что у ClientApp). Публикация мгновенная,
|
||||
/// как у NewsPost — нет статуса черновик/опубликовано.
|
||||
/// </summary>
|
||||
public sealed class InstructionTab : Entity
|
||||
{
|
||||
public string Title { get; private set; } = string.Empty;
|
||||
public string Body { get; private set; } = string.Empty;
|
||||
public int SortOrder { get; private set; }
|
||||
public DateTimeOffset CreatedAt { get; private set; }
|
||||
public DateTimeOffset? UpdatedAt { get; private set; }
|
||||
|
||||
private InstructionTab() { }
|
||||
|
||||
public static InstructionTab Create(string title, string body, int sortOrder)
|
||||
{
|
||||
return new InstructionTab
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Title = title,
|
||||
Body = body,
|
||||
SortOrder = sortOrder,
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(string title, string body, int sortOrder)
|
||||
{
|
||||
Title = title;
|
||||
Body = body;
|
||||
SortOrder = sortOrder;
|
||||
UpdatedAt = DateTimeOffset.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using PnvPanel.Application.Common.Interfaces;
|
||||
using PnvPanel.Infrastructure.Apps;
|
||||
using PnvPanel.Infrastructure.BackgroundJobs;
|
||||
using PnvPanel.Infrastructure.Identity;
|
||||
using PnvPanel.Infrastructure.Instructions;
|
||||
using PnvPanel.Infrastructure.Persistence;
|
||||
using PnvPanel.Infrastructure.Security;
|
||||
using PnvPanel.Infrastructure.Storage;
|
||||
@@ -137,6 +138,7 @@ public static class DependencyInjection
|
||||
services.AddScoped<IRefreshTokenService, RefreshTokenService>();
|
||||
services.AddScoped<IRoleService, RoleService>();
|
||||
services.AddScoped<IClientAppCatalogSeeder, ClientAppCatalogSeeder>();
|
||||
services.AddScoped<IInstructionIntroSeeder, InstructionIntroSeeder>();
|
||||
// Один и тот же экземпляр CurrentUser на scope — и как ICurrentUser (чтение), и как
|
||||
// ICurrentUserSetter (запись, только для Telegram-бота, см. TelegramBotHostedService).
|
||||
services.AddScoped<CurrentUser>();
|
||||
|
||||
@@ -11,6 +11,7 @@ public sealed class DbInitializer(
|
||||
RoleManager<AppRole> roleManager,
|
||||
UserManager<AppUser> userManager,
|
||||
IClientAppCatalogSeeder clientAppCatalogSeeder,
|
||||
IInstructionIntroSeeder instructionIntroSeeder,
|
||||
IOptions<AdminSeedOptions> adminSeedOptions,
|
||||
IOptions<RolesOptions> rolesOptions,
|
||||
ILogger<DbInitializer> logger
|
||||
@@ -32,6 +33,7 @@ public sealed class DbInitializer(
|
||||
);
|
||||
await SeedAdminAsync();
|
||||
await clientAppCatalogSeeder.SeedIfEmptyAsync(cancellationToken);
|
||||
await instructionIntroSeeder.SeedIfEmptyAsync(cancellationToken);
|
||||
}
|
||||
|
||||
private async Task EnsureRoleAsync(string name, int maxConfigs, int maxIpLimit, bool isSystem)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PnvPanel.Application.Common.Interfaces;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
using PnvPanel.Infrastructure.Persistence;
|
||||
|
||||
namespace PnvPanel.Infrastructure.Instructions;
|
||||
|
||||
internal sealed class InstructionIntroSeeder(
|
||||
AppDbContext dbContext,
|
||||
ILogger<InstructionIntroSeeder> logger
|
||||
) : IInstructionIntroSeeder
|
||||
{
|
||||
private const string DefaultBody = """
|
||||
Как подключиться за три шага — на любом устройстве.
|
||||
|
||||
1. Установите приложение для вашей ОС из списка ниже.
|
||||
2. На странице «Мои конфиги» скопируйте ссылку или откройте QR-код нужного конфига.
|
||||
3. Импортируйте ссылку или отсканируйте QR в приложении — готово.
|
||||
""";
|
||||
|
||||
public async Task SeedIfEmptyAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (await dbContext.InstructionIntros.AnyAsync(cancellationToken))
|
||||
return;
|
||||
|
||||
dbContext.InstructionIntros.Add(InstructionIntro.Create(DefaultBody));
|
||||
await dbContext.SaveChangesAsync(cancellationToken);
|
||||
logger.LogInformation("Seeded default instruction intro");
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using PnvPanel.Domain.Apps;
|
||||
using PnvPanel.Domain.Audit;
|
||||
using PnvPanel.Domain.Configs;
|
||||
using PnvPanel.Domain.Inbounds;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
using PnvPanel.Domain.News;
|
||||
using PnvPanel.Domain.Nodes;
|
||||
using PnvPanel.Domain.Support;
|
||||
@@ -50,6 +51,10 @@ public class AppDbContext(DbContextOptions<AppDbContext> options)
|
||||
|
||||
public DbSet<TicketAttachment> TicketAttachments => Set<TicketAttachment>();
|
||||
|
||||
public DbSet<InstructionIntro> InstructionIntros => Set<InstructionIntro>();
|
||||
|
||||
public DbSet<InstructionTab> InstructionTabs => Set<InstructionTab>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
|
||||
namespace PnvPanel.Infrastructure.Persistence.Configurations;
|
||||
|
||||
public class InstructionIntroConfiguration : IEntityTypeConfiguration<InstructionIntro>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<InstructionIntro> builder)
|
||||
{
|
||||
builder.ToTable("InstructionIntros");
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Body).IsRequired().HasMaxLength(20000);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
|
||||
namespace PnvPanel.Infrastructure.Persistence.Configurations;
|
||||
|
||||
public class InstructionTabConfiguration : IEntityTypeConfiguration<InstructionTab>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<InstructionTab> builder)
|
||||
{
|
||||
builder.ToTable("InstructionTabs");
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Title).IsRequired().HasMaxLength(100);
|
||||
builder.Property(x => x.Body).IsRequired().HasMaxLength(20000);
|
||||
|
||||
builder.HasIndex(x => x.SortOrder);
|
||||
}
|
||||
}
|
||||
+941
@@ -0,0 +1,941 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using PnvPanel.Infrastructure.Persistence;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PnvPanel.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260714174326_AddInstructions")]
|
||||
partial class AddInstructions
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Activation.ActivationRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("DecidedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DecidedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("RejectionReason")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("ActivationRequests", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Apps.ClientApp", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(300)
|
||||
.HasColumnType("character varying(300)");
|
||||
|
||||
b.Property<string>("DownloadUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<string>("IconUrl")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRecommended")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("OperatingSystem")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ClientApps", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Audit.AuditLog", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Action")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<Guid?>("ActorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Metadata")
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<string>("Source")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("TargetId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("TargetType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedAt");
|
||||
|
||||
b.ToTable("AuditLogs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Configs.TrafficSample", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<Guid>("ConfigId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("DownBytes")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset>("Timestamp")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("UpBytes")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConfigId", "Timestamp");
|
||||
|
||||
b.ToTable("TrafficSamples", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Configs.VpnConfig", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ClientEmail")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("ClientExternalId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("InboundId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastSyncAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Protocol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("SubscriptionToken")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<long>("UsedDownBytes")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("UsedUpBytes")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InboundId");
|
||||
|
||||
b.HasIndex("SubscriptionToken")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("VpnConfigs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Inbounds.Inbound", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.PrimitiveCollection<Guid[]>("AllowedRoleIds")
|
||||
.IsRequired()
|
||||
.HasColumnType("uuid[]");
|
||||
|
||||
b.Property<string>("DisplayName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<bool>("IsPublished")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastSyncAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("MaxClients")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("NodeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Port")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Protocol")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("Remark")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("RemoteInboundId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NodeId", "RemoteInboundId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Inbounds", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Instructions.InstructionIntro", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20000)
|
||||
.HasColumnType("character varying(20000)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("InstructionIntros", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Instructions.InstructionTab", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20000)
|
||||
.HasColumnType("character varying(20000)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SortOrder");
|
||||
|
||||
b.ToTable("InstructionTabs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.News.NewsPost", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20000)
|
||||
.HasColumnType("character varying(20000)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedAt");
|
||||
|
||||
b.ToTable("NewsPosts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Nodes.Node", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("BaseAddress")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastSyncAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Nodes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Support.SupportTicket", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("ProposedMaxConfigs")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ProposedMaxIpLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProposedRoleName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<Guid?>("RequestedRoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Type", "Status");
|
||||
|
||||
b.HasIndex("UserId", "Status");
|
||||
|
||||
b.ToTable("SupportTickets", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Support.TicketAttachment", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("CommentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ContentType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("FileName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<long>("SizeBytes")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("StoredFileName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CommentId");
|
||||
|
||||
b.HasIndex("StoredFileName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TicketAttachments", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Support.TicketComment", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AuthorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4000)
|
||||
.HasColumnType("character varying(4000)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("TicketId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TicketId", "CreatedAt");
|
||||
|
||||
b.ToTable("TicketComments", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Telegram.TelegramLinkToken", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("ConsumedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Token")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Token")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TelegramLinkTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Telegram.TelegramLoginRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Context")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(32)
|
||||
.HasColumnType("character varying(32)");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TelegramLoginRequests", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Infrastructure.Identity.AppRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsSystem")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MaxConfigs")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxIpLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Infrastructure.Identity.AppUser", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset?>("ActivatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("ActivatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsActivated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsBlocked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SubscriptionToken")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset?>("TelegramLinkedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long?>("TelegramUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("TelegramUsername")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.HasIndex("SubscriptionToken")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("TelegramUserId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Infrastructure.Identity.RefreshToken", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ReplacedByTokenHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset?>("RevokedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("TokenHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TokenHash")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("RefreshTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("PnvPanel.Infrastructure.Identity.AppRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("PnvPanel.Infrastructure.Identity.AppUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("PnvPanel.Infrastructure.Identity.AppUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("PnvPanel.Infrastructure.Identity.AppRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PnvPanel.Infrastructure.Identity.AppUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
|
||||
{
|
||||
b.HasOne("PnvPanel.Infrastructure.Identity.AppUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Nodes.Node", b =>
|
||||
{
|
||||
b.OwnsOne("PnvPanel.Domain.Nodes.NodeCredentials", "Credentials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("NodeId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("ProtectedPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("CredentialsProtectedPassword");
|
||||
|
||||
b1.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("CredentialsUsername");
|
||||
|
||||
b1.HasKey("NodeId");
|
||||
|
||||
b1.ToTable("Nodes");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("NodeId");
|
||||
});
|
||||
|
||||
b.Navigation("Credentials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PnvPanel.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddInstructions : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InstructionIntros",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Body = table.Column<string>(type: "character varying(20000)", maxLength: 20000, nullable: false),
|
||||
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InstructionIntros", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InstructionTabs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Title = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
Body = table.Column<string>(type: "character varying(20000)", maxLength: 20000, nullable: false),
|
||||
SortOrder = table.Column<int>(type: "integer", nullable: false),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InstructionTabs", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InstructionTabs_SortOrder",
|
||||
table: "InstructionTabs",
|
||||
column: "SortOrder");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "InstructionIntros");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InstructionTabs");
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -397,6 +397,57 @@ namespace PnvPanel.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("Inbounds", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Instructions.InstructionIntro", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20000)
|
||||
.HasColumnType("character varying(20000)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("InstructionIntros", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.Instructions.InstructionTab", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20000)
|
||||
.HasColumnType("character varying(20000)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("SortOrder")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SortOrder");
|
||||
|
||||
b.ToTable("InstructionTabs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PnvPanel.Domain.News.NewsPost", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
using PnvPanel.Application.Admin.Instructions;
|
||||
using PnvPanel.Application.Tests.TestSupport;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
using Xunit;
|
||||
|
||||
namespace PnvPanel.Application.Tests.Admin.Instructions;
|
||||
|
||||
public class InstructionTabCommandHandlerTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Create_AddsTab()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var handler = new CreateInstructionTabCommandHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(
|
||||
new CreateInstructionTabCommand("Настройка роутера", "текст", 10),
|
||||
CancellationToken.None
|
||||
);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal("Настройка роутера", result.Value.Title);
|
||||
Assert.Single(dbContext.InstructionTabs);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Update_ReplacesFields()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var tab = InstructionTab.Create("Старое", "старый текст", 10);
|
||||
dbContext.InstructionTabs.Add(tab);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
var handler = new UpdateInstructionTabCommandHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(
|
||||
new UpdateInstructionTabCommand(tab.Id, "Новое", "новый текст", 20),
|
||||
CancellationToken.None
|
||||
);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal("Новое", result.Value.Title);
|
||||
Assert.Equal("новый текст", result.Value.Body);
|
||||
Assert.Equal(20, result.Value.SortOrder);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Update_WhenTabMissing_ReturnsNotFound()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var handler = new UpdateInstructionTabCommandHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(
|
||||
new UpdateInstructionTabCommand(Guid.NewGuid(), "Новое", "текст", 10),
|
||||
CancellationToken.None
|
||||
);
|
||||
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.Equal(InstructionErrors.TabNotFound, result.Error);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Delete_RemovesTab()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var tab = InstructionTab.Create("Удалить меня", "текст", 10);
|
||||
dbContext.InstructionTabs.Add(tab);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
var handler = new DeleteInstructionTabCommandHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(
|
||||
new DeleteInstructionTabCommand(tab.Id),
|
||||
CancellationToken.None
|
||||
);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Empty(dbContext.InstructionTabs);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Delete_WhenTabMissing_ReturnsNotFound()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var handler = new DeleteInstructionTabCommandHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(
|
||||
new DeleteInstructionTabCommand(Guid.NewGuid()),
|
||||
CancellationToken.None
|
||||
);
|
||||
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.Equal(InstructionErrors.TabNotFound, result.Error);
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using PnvPanel.Application.Admin.Instructions;
|
||||
using PnvPanel.Application.Tests.TestSupport;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
using Xunit;
|
||||
|
||||
namespace PnvPanel.Application.Tests.Admin.Instructions;
|
||||
|
||||
public class UpdateInstructionIntroCommandHandlerTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Handle_WhenNoIntroExists_CreatesIt()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var handler = new UpdateInstructionIntroCommandHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(
|
||||
new UpdateInstructionIntroCommand("Новый текст"),
|
||||
CancellationToken.None
|
||||
);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal("Новый текст", result.Value.Body);
|
||||
Assert.Single(dbContext.InstructionIntros);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenIntroExists_UpdatesItInPlace()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var intro = InstructionIntro.Create("Старый текст");
|
||||
dbContext.InstructionIntros.Add(intro);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
var handler = new UpdateInstructionIntroCommandHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(
|
||||
new UpdateInstructionIntroCommand("Обновлённый текст"),
|
||||
CancellationToken.None
|
||||
);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal(intro.Id, result.Value.Id);
|
||||
Assert.Equal("Обновлённый текст", result.Value.Body);
|
||||
// Не создаётся вторая строка — обновляется существующая (singleton).
|
||||
Assert.Single(dbContext.InstructionIntros);
|
||||
}
|
||||
}
|
||||
+4
@@ -21,6 +21,8 @@ public class FactoryResetCommandHandlerTests
|
||||
private readonly IFileStorage _fileStorage = Substitute.For<IFileStorage>();
|
||||
private readonly IClientAppCatalogSeeder _catalogSeeder =
|
||||
Substitute.For<IClientAppCatalogSeeder>();
|
||||
private readonly IInstructionIntroSeeder _instructionIntroSeeder =
|
||||
Substitute.For<IInstructionIntroSeeder>();
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WipesEverythingExceptCurrentAdminAndSystemRoles()
|
||||
@@ -101,6 +103,7 @@ public class FactoryResetCommandHandlerTests
|
||||
_gateway,
|
||||
_fileStorage,
|
||||
_catalogSeeder,
|
||||
_instructionIntroSeeder,
|
||||
currentUser
|
||||
);
|
||||
|
||||
@@ -140,5 +143,6 @@ public class FactoryResetCommandHandlerTests
|
||||
);
|
||||
await _fileStorage.Received(1).DeleteAsync("stored-name", Arg.Any<CancellationToken>());
|
||||
await _catalogSeeder.Received(1).SeedIfEmptyAsync(Arg.Any<CancellationToken>());
|
||||
await _instructionIntroSeeder.Received(1).SeedIfEmptyAsync(Arg.Any<CancellationToken>());
|
||||
}
|
||||
}
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using PnvPanel.Application.Instructions;
|
||||
using PnvPanel.Application.Tests.TestSupport;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
using Xunit;
|
||||
|
||||
namespace PnvPanel.Application.Tests.Instructions;
|
||||
|
||||
public class GetInstructionIntroQueryHandlerTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Handle_WhenNoIntroSeeded_ReturnsEmptyDefault()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var handler = new GetInstructionIntroQueryHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(new GetInstructionIntroQuery(), CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal(string.Empty, result.Value.Body);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenIntroExists_ReturnsIt()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var intro = InstructionIntro.Create("Привет, это инструкция.");
|
||||
dbContext.InstructionIntros.Add(intro);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
var handler = new GetInstructionIntroQueryHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(new GetInstructionIntroQuery(), CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal("Привет, это инструкция.", result.Value.Body);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using PnvPanel.Application.Instructions;
|
||||
using PnvPanel.Application.Tests.TestSupport;
|
||||
using PnvPanel.Domain.Instructions;
|
||||
using Xunit;
|
||||
|
||||
namespace PnvPanel.Application.Tests.Instructions;
|
||||
|
||||
public class ListInstructionTabsQueryHandlerTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task Handle_ReturnsTabsOrderedBySortOrder()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
dbContext.InstructionTabs.AddRange(
|
||||
InstructionTab.Create("Второй", "текст", 20),
|
||||
InstructionTab.Create("Первый", "текст", 10),
|
||||
InstructionTab.Create("Третий", "текст", 30)
|
||||
);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
var handler = new ListInstructionTabsQueryHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(new ListInstructionTabsQuery(), CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal(["Первый", "Второй", "Третий"], result.Value.Select(t => t.Title));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Handle_WhenNoTabs_ReturnsEmptyList()
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var handler = new ListInstructionTabsQueryHandler(dbContext);
|
||||
|
||||
var result = await handler.Handle(new ListInstructionTabsQuery(), CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Empty(result.Value);
|
||||
}
|
||||
}
|
||||
+26
-3
@@ -105,6 +105,27 @@ status, createdAt }`. `expiresAt` всегда `null` (лимиты по сро
|
||||
```
|
||||
Значение `OsPlatform` в C#/JSON — `IOS` (не `iOS`).
|
||||
|
||||
## Instructions — страница инструкций
|
||||
|
||||
Вводный markdown-текст (singleton) над вкладками + дополнительные вкладки, обе части редактируются
|
||||
из админки. Встроенная вкладка «Приложения» (каталог `ClientApp`) в этот API не входит — фронт
|
||||
всегда рисует её первой, сама её достаёт через `GET /api/apps`.
|
||||
|
||||
| Метод | Путь | Роль | Тело запроса | Тело ответа |
|
||||
| ------ | ------------------------------------- | ----- | ----------------------------------- | ------------- |
|
||||
| GET | `/api/instructions/intro` | user | — | `InstructionIntroDto` |
|
||||
| GET | `/api/instructions/tabs` | user | — | `InstructionTabDto[]` (сортировка `SortOrder asc`) |
|
||||
| PUT | `/api/admin/instructions/intro` | admin | `{ body }` | `InstructionIntroDto` |
|
||||
| POST | `/api/admin/instructions/tabs` | admin | `{ title, body, sortOrder }` | `InstructionTabDto` |
|
||||
| PUT | `/api/admin/instructions/tabs/{id}` | admin | `{ title, body, sortOrder }` | `InstructionTabDto` |
|
||||
| DELETE | `/api/admin/instructions/tabs/{id}` | admin | — | `204 No Content` |
|
||||
|
||||
`PUT /api/admin/instructions/intro` — get-or-create (строка одна на всю систему; если её ещё нет,
|
||||
создаётся, иначе обновляется на месте). `GET /api/instructions/intro` никогда не 404-ит — если строка
|
||||
ещё не создана, отдаёт `{ id: "00000000-0000-0000-0000-000000000000", body: "", updatedAt: <MinValue> }`,
|
||||
чтобы публичная страница не падала. Вкладки — обычный CRUD без статуса черновик/опубликовано, как
|
||||
у `NewsPostDto`.
|
||||
|
||||
## News — лента новостей
|
||||
|
||||
| Метод | Путь | Роль | Тело запроса | Тело ответа |
|
||||
@@ -200,9 +221,11 @@ Support.CannotRequestAdminRole`), либо все три поля новой р
|
||||
(«Опасная зона») и требует ввести фразу-подтверждение в диалоге (не просто `confirm()`). Удаляет:
|
||||
всех пользователей кроме текущего админа, все `VpnConfig`/`TrafficSample` (конфиги сначала best-effort
|
||||
отзываются на нодах через `IXuiPanelGateway.RemoveClientAsync` — недоступная нода не блокирует сброс),
|
||||
все `Node`/`Inbound`, тикеты с перепиской/вложениями (+файлы), `NewsPost`, весь `AuditLog`, все
|
||||
кастомные роли (`AppRole.IsSystem == false`) и `ClientApp` — каталог приложений затем пересеивается
|
||||
через `IClientAppCatalogSeeder` (тот же сервис, что использует `DbInitializer` при первом старте).
|
||||
все `Node`/`Inbound`, тикеты с перепиской/вложениями (+файлы), `NewsPost`, `InstructionIntro`/
|
||||
`InstructionTab`, весь `AuditLog`, все кастомные роли (`AppRole.IsSystem == false`) и `ClientApp` —
|
||||
каталог приложений и вводный текст инструкций затем пересеиваются дефолтными значениями через
|
||||
`IClientAppCatalogSeeder`/`IInstructionIntroSeeder` (те же сервисы, что использует `DbInitializer`
|
||||
при первом старте); вкладки инструкций дефолтами не пересеиваются, как и новости.
|
||||
Не атомарно целиком (несколько `SaveChangesAsync` внутри хендлера, как и в `DeleteUserCommandHandler`) —
|
||||
при сбое посередине возможно частичное состояние, компенсации нет, это осознанный компромисс для
|
||||
редкой ручной админской операции. Финальная запись `FactoryReset` в аудит добавляется уже после
|
||||
|
||||
+36
-3
@@ -159,6 +159,38 @@ AppUser
|
||||
Массовая очистка отключённых (`IsEnabled = false`) — вкладка «Обслуживание»,
|
||||
`DELETE /api/admin/maintenance/apps/disabled`.
|
||||
|
||||
### InstructionIntro — вводный текст страницы инструкций
|
||||
Единственная строка в таблице (singleton) — markdown-текст над вкладками на странице «Инструкции»,
|
||||
редактируется админом. Никакой поддержки нескольких версий/языков нет.
|
||||
|
||||
| Поле | Тип | Заметки |
|
||||
| ----------- | ----------------- | ------------------------------------------------ |
|
||||
| `Id` | `Guid` | PK |
|
||||
| `Body` | `string` | Markdown-текст |
|
||||
| `UpdatedAt` | `DateTimeOffset` | |
|
||||
|
||||
`GET /api/instructions/intro` (активированным) читает; `PUT /api/admin/instructions/intro` (админ)
|
||||
делает get-or-create — если строки ещё нет (не сидировано), создаёт, иначе обновляет на месте.
|
||||
Сидируется дефолтным текстом при старте (`IInstructionIntroSeeder`, если таблица пуста) и заново
|
||||
после полного сброса панели (см. «Полный сброс панели» выше).
|
||||
|
||||
### InstructionTab — дополнительные вкладки инструкций
|
||||
Заголовок + markdown-текст, ведёт админ; на странице «Инструкции» отображаются вкладками рядом с
|
||||
встроенной вкладкой «Приложения» (каталог `ClientApp`, не хранится как `InstructionTab`).
|
||||
|
||||
| Поле | Тип | Заметки |
|
||||
| ----------- | ----------------- | ------------------------------------------------------- |
|
||||
| `Id` | `Guid` | PK |
|
||||
| `Title` | `string` | Заголовок вкладки |
|
||||
| `Body` | `string` | Markdown-текст |
|
||||
| `SortOrder` | `int` | Порядок вкладок (та же конвенция, что у `ClientApp`) |
|
||||
| `CreatedAt` | `DateTimeOffset` | |
|
||||
| `UpdatedAt` | `DateTimeOffset?` | |
|
||||
|
||||
Нет статуса черновик/опубликовано — публикация мгновенная, как у `NewsPost`. Полный CRUD только
|
||||
у админа (`/api/admin/instructions/tabs`); чтение — `GET /api/instructions/tabs` (активированным).
|
||||
Не пересеивается дефолтными вкладками — при полном сбросе панели просто удаляются.
|
||||
|
||||
### NewsPost — новости для пользователей
|
||||
Публикуются админом немедленно, видны всем залогиненным пользователям в хронологической ленте.
|
||||
|
||||
@@ -197,9 +229,10 @@ AppUser
|
||||
Вкладка «Обслуживание» → «Опасная зона» (спойлер + подтверждение фразой в диалоге, не просто
|
||||
`confirm()`) — `DELETE /api/admin/maintenance/factory-reset`. Возвращает панель к состоянию свежего
|
||||
деплоя: удаляет всех пользователей кроме текущего админа, конфиги (сначала best-effort отзываются
|
||||
на нодах 3x-ui), ноды/инбаунды, тикеты, новости, весь аудит и кастомные роли; каталог приложений
|
||||
пересеивается из `seed/client-apps.json`. Необратимо, не атомарно целиком — подробности и полный
|
||||
список удаляемого см. [api-design.md](api-design.md#admin--maintenance).
|
||||
на нодах 3x-ui), ноды/инбаунды, тикеты, новости, вводный текст и вкладки инструкций, весь аудит и
|
||||
кастомные роли; каталог приложений и вводный текст инструкций пересеиваются дефолтными значениями,
|
||||
вкладки инструкций — нет (пусто, как у новостей). Необратимо, не атомарно целиком — подробности и
|
||||
полный список удаляемого см. [api-design.md](api-design.md#admin--maintenance).
|
||||
|
||||
### AppUser — расширения (Identity)
|
||||
`AppUser` живёт в Identity (`Infrastructure`). **Логин — по `UserName`** (уникальный, обязательный).
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import { useState } from 'react'
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import { toast } from '@/shared/ui/toast-store'
|
||||
import { Button } from '@/shared/ui/button'
|
||||
import { Textarea } from '@/shared/ui/textarea'
|
||||
import { HttpError } from '@/shared/api/client'
|
||||
import type { InstructionIntroDto } from '@/shared/api/types'
|
||||
import { updateInstructionIntro } from './api'
|
||||
|
||||
export function InstructionIntroEditor({ intro }: { intro: InstructionIntroDto }) {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
const [body, setBody] = useState(intro.body)
|
||||
const [previewMode, setPreviewMode] = useState(false)
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: () => updateInstructionIntro(body.trim()),
|
||||
onSuccess: async () => {
|
||||
toast.success(t('admin.instructions.introSaved'))
|
||||
await queryClient.invalidateQueries({ queryKey: ['instruction-intro'] })
|
||||
},
|
||||
onError: (error) => toast.error(error instanceof HttpError ? error.detail : t('auth.genericError')),
|
||||
})
|
||||
|
||||
const isDirty = body.trim() !== intro.body.trim()
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-sm text-muted-foreground">{t('admin.instructions.introHint')}</p>
|
||||
<Button type="button" size="sm" variant="ghost" onClick={() => setPreviewMode((v) => !v)}>
|
||||
{t('admin.news.preview')}
|
||||
</Button>
|
||||
</div>
|
||||
{previewMode ? (
|
||||
<div className="flex min-h-32 flex-col gap-2 rounded-md border border-border px-3 py-2 text-sm [&_a]:text-primary [&_a]:hover:underline [&_li]:ml-4 [&_ul]:list-disc [&_ol]:list-decimal">
|
||||
<ReactMarkdown remarkPlugins={[remarkGfm]}>{body || t('admin.instructions.tabBody')}</ReactMarkdown>
|
||||
</div>
|
||||
) : (
|
||||
<Textarea value={body} onChange={(e) => setBody(e.target.value)} rows={8} />
|
||||
)}
|
||||
<div>
|
||||
<Button disabled={!body.trim() || !isDirty || mutation.isPending} onClick={() => mutation.mutate()}>
|
||||
{t('admin.roles.save')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
import { useState } from 'react'
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import { toast } from '@/shared/ui/toast-store'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/shared/ui/dialog'
|
||||
import { Button } from '@/shared/ui/button'
|
||||
import { Input } from '@/shared/ui/input'
|
||||
import { Label } from '@/shared/ui/label'
|
||||
import { Textarea } from '@/shared/ui/textarea'
|
||||
import { HttpError } from '@/shared/api/client'
|
||||
import type { InstructionTabDto } from '@/shared/api/types'
|
||||
import { createInstructionTab, updateInstructionTab } from './api'
|
||||
|
||||
export function InstructionTabFormDialog({
|
||||
tab,
|
||||
open,
|
||||
onOpenChange,
|
||||
}: {
|
||||
tab?: InstructionTabDto
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
const [internalOpen, setInternalOpen] = useState(false)
|
||||
const [title, setTitle] = useState(tab?.title ?? '')
|
||||
const [body, setBody] = useState(tab?.body ?? '')
|
||||
const [sortOrder, setSortOrder] = useState(String(tab?.sortOrder ?? 0))
|
||||
const [previewMode, setPreviewMode] = useState(false)
|
||||
|
||||
const isControlled = open !== undefined
|
||||
const dialogOpen = isControlled ? open : internalOpen
|
||||
const setDialogOpen = isControlled ? onOpenChange! : setInternalOpen
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: () =>
|
||||
tab
|
||||
? updateInstructionTab(tab.id, title.trim(), body.trim(), Number(sortOrder))
|
||||
: createInstructionTab(title.trim(), body.trim(), Number(sortOrder)),
|
||||
onSuccess: async () => {
|
||||
toast.success(tab ? t('admin.instructions.tabUpdated') : t('admin.instructions.tabCreated'))
|
||||
await queryClient.invalidateQueries({ queryKey: ['instruction-tabs'] })
|
||||
setDialogOpen(false)
|
||||
},
|
||||
onError: (error) => toast.error(error instanceof HttpError ? error.detail : t('auth.genericError')),
|
||||
})
|
||||
|
||||
const canSubmit = title.trim() && body.trim()
|
||||
|
||||
return (
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
{!isControlled && (
|
||||
<DialogTrigger asChild>
|
||||
<Button size="sm">{t('admin.instructions.createTab')}</Button>
|
||||
</DialogTrigger>
|
||||
)}
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{tab ? tab.title : t('admin.instructions.createTab')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<form
|
||||
className="flex flex-col gap-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault()
|
||||
if (canSubmit) mutation.mutate()
|
||||
}}
|
||||
>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor="tabTitle">{t('admin.instructions.tabTitle')}</Label>
|
||||
<Input id="tabTitle" value={title} onChange={(e) => setTitle(e.target.value)} required />
|
||||
</div>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label htmlFor="tabBody">{t('admin.instructions.tabBody')}</Label>
|
||||
<Button type="button" size="sm" variant="ghost" onClick={() => setPreviewMode((v) => !v)}>
|
||||
{t('admin.news.preview')}
|
||||
</Button>
|
||||
</div>
|
||||
{previewMode ? (
|
||||
<div className="flex min-h-32 flex-col gap-2 rounded-md border border-border px-3 py-2 text-sm [&_a]:text-primary [&_a]:hover:underline [&_li]:ml-4 [&_ul]:list-disc [&_ol]:list-decimal">
|
||||
<ReactMarkdown remarkPlugins={[remarkGfm]}>{body || t('admin.instructions.tabBody')}</ReactMarkdown>
|
||||
</div>
|
||||
) : (
|
||||
<Textarea id="tabBody" value={body} onChange={(e) => setBody(e.target.value)} required />
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Label htmlFor="tabSortOrder">{t('admin.apps.sortOrder')}</Label>
|
||||
<Input id="tabSortOrder" type="number" min={0} value={sortOrder} onChange={(e) => setSortOrder(e.target.value)} />
|
||||
</div>
|
||||
<Button type="submit" disabled={!canSubmit || mutation.isPending}>
|
||||
{tab ? t('admin.roles.save') : t('admin.instructions.createTab')}
|
||||
</Button>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { apiRequest } from '@/shared/api/client'
|
||||
import type { InstructionIntroDto, InstructionTabDto } from '@/shared/api/types'
|
||||
|
||||
export function updateInstructionIntro(body: string) {
|
||||
return apiRequest<InstructionIntroDto>('/admin/instructions/intro', { method: 'PUT', body: { body } })
|
||||
}
|
||||
|
||||
export function createInstructionTab(title: string, body: string, sortOrder: number) {
|
||||
return apiRequest<InstructionTabDto>('/admin/instructions/tabs', {
|
||||
method: 'POST',
|
||||
body: { title, body, sortOrder },
|
||||
})
|
||||
}
|
||||
|
||||
export function updateInstructionTab(id: string, title: string, body: string, sortOrder: number) {
|
||||
return apiRequest<InstructionTabDto>(`/admin/instructions/tabs/${id}`, {
|
||||
method: 'PUT',
|
||||
body: { title, body, sortOrder },
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteInstructionTab(id: string) {
|
||||
return apiRequest<void>(`/admin/instructions/tabs/${id}`, { method: 'DELETE' })
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { apiRequest } from '@/shared/api/client'
|
||||
import type { InstructionIntroDto, InstructionTabDto } from '@/shared/api/types'
|
||||
|
||||
export function getInstructionIntro() {
|
||||
return apiRequest<InstructionIntroDto>('/instructions/intro')
|
||||
}
|
||||
|
||||
export function listInstructionTabs() {
|
||||
return apiRequest<InstructionTabDto[]>('/instructions/tabs')
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import { Route as AdminRolesRouteImport } from './routes/admin/roles'
|
||||
import { Route as AdminNodesRouteImport } from './routes/admin/nodes'
|
||||
import { Route as AdminNewsRouteImport } from './routes/admin/news'
|
||||
import { Route as AdminMaintenanceRouteImport } from './routes/admin/maintenance'
|
||||
import { Route as AdminInstructionsRouteImport } from './routes/admin/instructions'
|
||||
import { Route as AdminConfigsRouteImport } from './routes/admin/configs'
|
||||
import { Route as AdminAuditRouteImport } from './routes/admin/audit'
|
||||
import { Route as AdminAppsRouteImport } from './routes/admin/apps'
|
||||
@@ -110,6 +111,11 @@ const AdminMaintenanceRoute = AdminMaintenanceRouteImport.update({
|
||||
path: '/maintenance',
|
||||
getParentRoute: () => AdminRoute,
|
||||
} as any)
|
||||
const AdminInstructionsRoute = AdminInstructionsRouteImport.update({
|
||||
id: '/instructions',
|
||||
path: '/instructions',
|
||||
getParentRoute: () => AdminRoute,
|
||||
} as any)
|
||||
const AdminConfigsRoute = AdminConfigsRouteImport.update({
|
||||
id: '/configs',
|
||||
path: '/configs',
|
||||
@@ -145,6 +151,7 @@ export interface FileRoutesByFullPath {
|
||||
'/admin/apps': typeof AdminAppsRoute
|
||||
'/admin/audit': typeof AdminAuditRoute
|
||||
'/admin/configs': typeof AdminConfigsRoute
|
||||
'/admin/instructions': typeof AdminInstructionsRoute
|
||||
'/admin/maintenance': typeof AdminMaintenanceRoute
|
||||
'/admin/news': typeof AdminNewsRoute
|
||||
'/admin/nodes': typeof AdminNodesRoute
|
||||
@@ -166,6 +173,7 @@ export interface FileRoutesByTo {
|
||||
'/admin/apps': typeof AdminAppsRoute
|
||||
'/admin/audit': typeof AdminAuditRoute
|
||||
'/admin/configs': typeof AdminConfigsRoute
|
||||
'/admin/instructions': typeof AdminInstructionsRoute
|
||||
'/admin/maintenance': typeof AdminMaintenanceRoute
|
||||
'/admin/news': typeof AdminNewsRoute
|
||||
'/admin/nodes': typeof AdminNodesRoute
|
||||
@@ -189,6 +197,7 @@ export interface FileRoutesById {
|
||||
'/admin/apps': typeof AdminAppsRoute
|
||||
'/admin/audit': typeof AdminAuditRoute
|
||||
'/admin/configs': typeof AdminConfigsRoute
|
||||
'/admin/instructions': typeof AdminInstructionsRoute
|
||||
'/admin/maintenance': typeof AdminMaintenanceRoute
|
||||
'/admin/news': typeof AdminNewsRoute
|
||||
'/admin/nodes': typeof AdminNodesRoute
|
||||
@@ -213,6 +222,7 @@ export interface FileRouteTypes {
|
||||
| '/admin/apps'
|
||||
| '/admin/audit'
|
||||
| '/admin/configs'
|
||||
| '/admin/instructions'
|
||||
| '/admin/maintenance'
|
||||
| '/admin/news'
|
||||
| '/admin/nodes'
|
||||
@@ -234,6 +244,7 @@ export interface FileRouteTypes {
|
||||
| '/admin/apps'
|
||||
| '/admin/audit'
|
||||
| '/admin/configs'
|
||||
| '/admin/instructions'
|
||||
| '/admin/maintenance'
|
||||
| '/admin/news'
|
||||
| '/admin/nodes'
|
||||
@@ -256,6 +267,7 @@ export interface FileRouteTypes {
|
||||
| '/admin/apps'
|
||||
| '/admin/audit'
|
||||
| '/admin/configs'
|
||||
| '/admin/instructions'
|
||||
| '/admin/maintenance'
|
||||
| '/admin/news'
|
||||
| '/admin/nodes'
|
||||
@@ -391,6 +403,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof AdminMaintenanceRouteImport
|
||||
parentRoute: typeof AdminRoute
|
||||
}
|
||||
'/admin/instructions': {
|
||||
id: '/admin/instructions'
|
||||
path: '/instructions'
|
||||
fullPath: '/admin/instructions'
|
||||
preLoaderRoute: typeof AdminInstructionsRouteImport
|
||||
parentRoute: typeof AdminRoute
|
||||
}
|
||||
'/admin/configs': {
|
||||
id: '/admin/configs'
|
||||
path: '/configs'
|
||||
@@ -427,6 +446,7 @@ interface AdminRouteChildren {
|
||||
AdminAppsRoute: typeof AdminAppsRoute
|
||||
AdminAuditRoute: typeof AdminAuditRoute
|
||||
AdminConfigsRoute: typeof AdminConfigsRoute
|
||||
AdminInstructionsRoute: typeof AdminInstructionsRoute
|
||||
AdminMaintenanceRoute: typeof AdminMaintenanceRoute
|
||||
AdminNewsRoute: typeof AdminNewsRoute
|
||||
AdminNodesRoute: typeof AdminNodesRoute
|
||||
@@ -441,6 +461,7 @@ const AdminRouteChildren: AdminRouteChildren = {
|
||||
AdminAppsRoute: AdminAppsRoute,
|
||||
AdminAuditRoute: AdminAuditRoute,
|
||||
AdminConfigsRoute: AdminConfigsRoute,
|
||||
AdminInstructionsRoute: AdminInstructionsRoute,
|
||||
AdminMaintenanceRoute: AdminMaintenanceRoute,
|
||||
AdminNewsRoute: AdminNewsRoute,
|
||||
AdminNodesRoute: AdminNodesRoute,
|
||||
|
||||
@@ -13,6 +13,7 @@ const TABS = [
|
||||
{ to: '/admin/roles', key: 'roles' },
|
||||
{ to: '/admin/nodes', key: 'nodes' },
|
||||
{ to: '/admin/apps', key: 'apps' },
|
||||
{ to: '/admin/instructions', key: 'instructions' },
|
||||
{ to: '/admin/news', key: 'news' },
|
||||
{ to: '/admin/support', key: 'support' },
|
||||
{ to: '/admin/audit', key: 'audit' },
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
import { useState } from 'react'
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { toast } from '@/shared/ui/toast-store'
|
||||
import { Button } from '@/shared/ui/button'
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/shared/ui/card'
|
||||
import { getInstructionIntro, listInstructionTabs } from '@/features/instructions/api'
|
||||
import { deleteInstructionTab } from '@/features/admin/instructions/api'
|
||||
import { InstructionIntroEditor } from '@/features/admin/instructions/InstructionIntroEditor'
|
||||
import { InstructionTabFormDialog } from '@/features/admin/instructions/InstructionTabFormDialog'
|
||||
import type { InstructionTabDto } from '@/shared/api/types'
|
||||
|
||||
export const Route = createFileRoute('/admin/instructions')({ component: AdminInstructionsPage })
|
||||
|
||||
function AdminInstructionsPage() {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
const [editingTab, setEditingTab] = useState<InstructionTabDto | null>(null)
|
||||
|
||||
const introQuery = useQuery({ queryKey: ['instruction-intro'], queryFn: getInstructionIntro })
|
||||
const tabsQuery = useQuery({ queryKey: ['instruction-tabs'], queryFn: listInstructionTabs })
|
||||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: deleteInstructionTab,
|
||||
onSuccess: async () => {
|
||||
toast.success(t('admin.instructions.tabDeleted'))
|
||||
await queryClient.invalidateQueries({ queryKey: ['instruction-tabs'] })
|
||||
},
|
||||
onError: () => toast.error(t('auth.genericError')),
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base">{t('admin.instructions.introTitle')}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{introQuery.isLoading && <p className="text-sm text-muted-foreground">…</p>}
|
||||
{introQuery.data && <InstructionIntroEditor intro={introQuery.data} />}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-lg font-semibold tracking-tight">{t('admin.instructions.tabsTitle')}</h2>
|
||||
<InstructionTabFormDialog />
|
||||
</div>
|
||||
|
||||
{tabsQuery.isLoading && <p className="text-sm text-muted-foreground">…</p>}
|
||||
|
||||
{tabsQuery.isError && (
|
||||
<div className="flex items-center gap-2">
|
||||
<p className="text-sm text-muted-foreground">{t('auth.genericError')}</p>
|
||||
<Button variant="outline" size="sm" onClick={() => void tabsQuery.refetch()}>
|
||||
{t('activation.retry')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tabsQuery.data?.length === 0 && <p className="text-sm text-muted-foreground">{t('admin.instructions.tabsEmpty')}</p>}
|
||||
|
||||
{tabsQuery.data && tabsQuery.data.length > 0 && (
|
||||
<div className="flex flex-col gap-2">
|
||||
{tabsQuery.data.map((tab) => (
|
||||
<div key={tab.id} className="flex items-center justify-between rounded-md border border-border px-3 py-2 text-sm">
|
||||
<div className="flex flex-col">
|
||||
<span>{tab.title}</span>
|
||||
<span className="text-xs text-muted-foreground">{t('admin.apps.sortOrder')}: {tab.sortOrder}</span>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button size="sm" variant="outline" onClick={() => setEditingTab(tab)}>
|
||||
{t('admin.roles.edit')}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
disabled={deleteMutation.isPending}
|
||||
onClick={() => {
|
||||
if (confirm(t('admin.instructions.confirmDeleteTab'))) deleteMutation.mutate(tab.id)
|
||||
}}
|
||||
>
|
||||
{t('admin.roles.delete')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{editingTab && (
|
||||
<InstructionTabFormDialog tab={editingTab} open={!!editingTab} onOpenChange={(open) => !open && setEditingTab(null)} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,32 +1,76 @@
|
||||
import { useState } from 'react'
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import { useRequireActivated } from '@/features/auth/guards'
|
||||
import { AppsCatalog } from '@/features/apps/AppsCatalog'
|
||||
import { getInstructionIntro, listInstructionTabs } from '@/features/instructions/api'
|
||||
import { cn } from '@/shared/lib/cn'
|
||||
|
||||
export const Route = createFileRoute('/instructions')({ component: InstructionsPage })
|
||||
|
||||
const APPS_TAB_ID = '__apps__'
|
||||
const MARKDOWN_CLASSES = '[&_a]:text-primary [&_a]:hover:underline [&_li]:ml-4 [&_ul]:list-disc [&_ol]:list-decimal'
|
||||
|
||||
function InstructionsPage() {
|
||||
const { t } = useTranslation()
|
||||
const { isReady } = useRequireActivated()
|
||||
const introQuery = useQuery({ queryKey: ['instruction-intro'], queryFn: getInstructionIntro })
|
||||
const tabsQuery = useQuery({ queryKey: ['instruction-tabs'], queryFn: listInstructionTabs })
|
||||
const [activeTab, setActiveTab] = useState(APPS_TAB_ID)
|
||||
|
||||
if (!isReady) return null
|
||||
|
||||
const tabs = tabsQuery.data ?? []
|
||||
const activeExtraTab = tabs.find((tab) => tab.id === activeTab)
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-4xl flex-col gap-8 px-6 py-10">
|
||||
<div>
|
||||
<h1 className="text-2xl font-semibold tracking-tight">{t('instructions.title')}</h1>
|
||||
<p className="mt-1 text-sm text-muted-foreground">{t('instructions.intro')}</p>
|
||||
{introQuery.data?.body && (
|
||||
<div className={cn('mt-2 flex flex-col gap-2 text-sm text-muted-foreground', MARKDOWN_CLASSES)}>
|
||||
<ReactMarkdown remarkPlugins={[remarkGfm]}>{introQuery.data.body}</ReactMarkdown>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ol className="flex flex-col gap-2 text-sm">
|
||||
<li>1. {t('instructions.step1')}</li>
|
||||
<li>2. {t('instructions.step2')}</li>
|
||||
<li>3. {t('instructions.step3')}</li>
|
||||
</ol>
|
||||
<div className="flex flex-col gap-4">
|
||||
<nav className="flex flex-wrap gap-1 border-b border-border">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setActiveTab(APPS_TAB_ID)}
|
||||
className={cn(
|
||||
'whitespace-nowrap px-3 py-2 text-sm text-muted-foreground hover:text-foreground',
|
||||
activeTab === APPS_TAB_ID && 'border-b-2 border-primary font-medium text-foreground',
|
||||
)}
|
||||
>
|
||||
{t('instructions.appsTitle')}
|
||||
</button>
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
className={cn(
|
||||
'whitespace-nowrap px-3 py-2 text-sm text-muted-foreground hover:text-foreground',
|
||||
activeTab === tab.id && 'border-b-2 border-primary font-medium text-foreground',
|
||||
)}
|
||||
>
|
||||
{tab.title}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div>
|
||||
<h2 className="mb-3 text-lg font-semibold tracking-tight">{t('instructions.appsTitle')}</h2>
|
||||
<AppsCatalog />
|
||||
{activeTab === APPS_TAB_ID ? (
|
||||
<AppsCatalog />
|
||||
) : activeExtraTab ? (
|
||||
<div className={cn('flex flex-col gap-2 text-sm', MARKDOWN_CLASSES)}>
|
||||
<ReactMarkdown remarkPlugins={[remarkGfm]}>{activeExtraTab.body}</ReactMarkdown>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -117,6 +117,22 @@ export type NewsPostDto = {
|
||||
updatedAt: string | null
|
||||
}
|
||||
|
||||
export type InstructionIntroDto = {
|
||||
id: string
|
||||
body: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/** Один DTO на пользовательскую страницу и админку — у вкладки нет полей, скрытых от юзера. */
|
||||
export type InstructionTabDto = {
|
||||
id: string
|
||||
title: string
|
||||
body: string
|
||||
sortOrder: number
|
||||
createdAt: string
|
||||
updatedAt: string | null
|
||||
}
|
||||
|
||||
export type LinkTokenResponse = {
|
||||
deepLink: string | null
|
||||
expiresAt: string
|
||||
|
||||
@@ -102,10 +102,6 @@ const resources = {
|
||||
|
||||
instructions: {
|
||||
title: 'Инструкции по подключению',
|
||||
intro: 'Как подключиться за три шага — на любом устройстве.',
|
||||
step1: 'Установите приложение для вашей ОС из списка ниже.',
|
||||
step2: 'На странице «Мои конфиги» скопируйте ссылку или откройте QR-код нужного конфига.',
|
||||
step3: 'Импортируйте ссылку или отсканируйте QR в приложении — готово.',
|
||||
appsTitle: 'Приложения',
|
||||
noApps: 'Каталог приложений пока пуст.',
|
||||
recommended: 'Рекомендуем',
|
||||
@@ -196,6 +192,7 @@ const resources = {
|
||||
roles: 'Роли',
|
||||
nodes: 'Ноды',
|
||||
apps: 'Приложения',
|
||||
instructions: 'Инструкции',
|
||||
news: 'Новости',
|
||||
support: 'Тикеты',
|
||||
audit: 'Аудит',
|
||||
@@ -319,6 +316,20 @@ const resources = {
|
||||
deleted: 'Приложение удалено.',
|
||||
confirmDelete: 'Удалить приложение из каталога?',
|
||||
},
|
||||
instructions: {
|
||||
introTitle: 'Основная инструкция',
|
||||
introHint: 'Показывается над вкладками на странице «Инструкции» (Markdown).',
|
||||
introSaved: 'Инструкция сохранена.',
|
||||
tabsTitle: 'Дополнительные вкладки',
|
||||
tabsEmpty: 'Дополнительных вкладок пока нет.',
|
||||
createTab: 'Добавить вкладку',
|
||||
tabTitle: 'Название вкладки',
|
||||
tabBody: 'Текст (Markdown)',
|
||||
tabCreated: 'Вкладка добавлена.',
|
||||
tabUpdated: 'Вкладка обновлена.',
|
||||
tabDeleted: 'Вкладка удалена.',
|
||||
confirmDeleteTab: 'Удалить вкладку инструкций?',
|
||||
},
|
||||
news: {
|
||||
create: 'Добавить новость',
|
||||
title: 'Заголовок',
|
||||
@@ -509,10 +520,6 @@ const resources = {
|
||||
|
||||
instructions: {
|
||||
title: 'Connection instructions',
|
||||
intro: 'Get connected in three steps, on any device.',
|
||||
step1: 'Install the app for your OS from the list below.',
|
||||
step2: 'On the "My configs" page, copy the link or open the QR code for the config you want.',
|
||||
step3: 'Import the link or scan the QR code in the app — done.',
|
||||
appsTitle: 'Apps',
|
||||
noApps: 'The app catalog is empty right now.',
|
||||
recommended: 'Recommended',
|
||||
@@ -603,6 +610,7 @@ const resources = {
|
||||
roles: 'Roles',
|
||||
nodes: 'Nodes',
|
||||
apps: 'Apps',
|
||||
instructions: 'Instructions',
|
||||
news: 'News',
|
||||
support: 'Tickets',
|
||||
audit: 'Audit',
|
||||
@@ -726,6 +734,20 @@ const resources = {
|
||||
deleted: 'App deleted.',
|
||||
confirmDelete: 'Remove this app from the catalog?',
|
||||
},
|
||||
instructions: {
|
||||
introTitle: 'Main instruction',
|
||||
introHint: 'Shown above the tabs on the Instructions page (Markdown).',
|
||||
introSaved: 'Instruction saved.',
|
||||
tabsTitle: 'Additional tabs',
|
||||
tabsEmpty: 'No additional tabs yet.',
|
||||
createTab: 'Add tab',
|
||||
tabTitle: 'Tab title',
|
||||
tabBody: 'Body (Markdown)',
|
||||
tabCreated: 'Tab added.',
|
||||
tabUpdated: 'Tab updated.',
|
||||
tabDeleted: 'Tab deleted.',
|
||||
confirmDeleteTab: 'Delete this instruction tab?',
|
||||
},
|
||||
news: {
|
||||
create: 'Add post',
|
||||
title: 'Title',
|
||||
|
||||
Reference in New Issue
Block a user