Add instructions management functionality and update related components
CI / Backend (build + test) (push) Successful in 1m17s
CI / Frontend (lint + typecheck + build) (push) Successful in 32s

- 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:
Leonid Pershin
2026-07-14 22:20:10 +03:00
parent 8c53fcded2
commit bef3880593
52 changed files with 2303 additions and 24 deletions
@@ -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();
}
}
+2
View File
@@ -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>>;
@@ -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)));
}
}
@@ -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>;
@@ -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>>;
@@ -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));
}
}
@@ -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>>;
@@ -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));
}
}
@@ -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);
@@ -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);
}
}
@@ -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);
}
}
@@ -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
}
}
}
@@ -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");
}
}
}
@@ -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")