- Added new configuration options for user plans in `.env.example`, including `Plans__MaxCustomConfigCount` and `Plans__MinCustomConfigCount`. - Introduced `MapPlanEndpoints` in `Program.cs` to handle plan-related API routes. - Implemented `SetUserPlan` endpoint in `RoleEndpoints` to allow admins to assign plans to users. - Removed deprecated role request approval endpoints from `AdminSupportEndpoints`. - Updated `ITelegramNotifier` and related classes to reflect changes in role request handling and payment notifications. - Refactored role management commands to remove `MaxConfigs` and focus on `MaxIpLimit` and billing settings. - Enhanced billing request handling to accommodate plan changes instead of role changes. - Updated various interfaces and command handlers to support new plan management features.
77 lines
2.7 KiB
C#
77 lines
2.7 KiB
C#
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using PnvPanel.Application.Common.Interfaces;
|
|
using PnvPanel.Domain.Activation;
|
|
using PnvPanel.Domain.Apps;
|
|
using PnvPanel.Domain.Audit;
|
|
using PnvPanel.Domain.Billing;
|
|
using PnvPanel.Domain.Configs;
|
|
using PnvPanel.Domain.Inbounds;
|
|
using PnvPanel.Domain.Instructions;
|
|
using PnvPanel.Domain.News;
|
|
using PnvPanel.Domain.Nodes;
|
|
using PnvPanel.Domain.Plans;
|
|
using PnvPanel.Domain.Pricing;
|
|
using PnvPanel.Domain.Support;
|
|
using PnvPanel.Domain.Telegram;
|
|
using PnvPanel.Infrastructure.Identity;
|
|
|
|
namespace PnvPanel.Infrastructure.Persistence;
|
|
|
|
/// <summary>
|
|
/// Корневой DbContext приложения: Identity-схема (пользователи/роли) + сущности домена
|
|
/// (добавляются по мере реализации фич, см. docs/roadmap.md).
|
|
/// </summary>
|
|
public class AppDbContext(DbContextOptions<AppDbContext> options)
|
|
: IdentityDbContext<AppUser, AppRole, Guid>(options),
|
|
IAppDbContext
|
|
{
|
|
public DbSet<RefreshToken> RefreshTokens => Set<RefreshToken>();
|
|
|
|
public DbSet<ActivationRequest> ActivationRequests => Set<ActivationRequest>();
|
|
|
|
public DbSet<AuditLog> AuditLogs => Set<AuditLog>();
|
|
|
|
public DbSet<TelegramLinkToken> TelegramLinkTokens => Set<TelegramLinkToken>();
|
|
|
|
public DbSet<TelegramLoginRequest> TelegramLoginRequests => Set<TelegramLoginRequest>();
|
|
|
|
public DbSet<Node> Nodes => Set<Node>();
|
|
|
|
public DbSet<Inbound> Inbounds => Set<Inbound>();
|
|
|
|
public DbSet<VpnConfig> VpnConfigs => Set<VpnConfig>();
|
|
|
|
public DbSet<TrafficSample> TrafficSamples => Set<TrafficSample>();
|
|
|
|
public DbSet<ClientApp> ClientApps => Set<ClientApp>();
|
|
|
|
public DbSet<NewsPost> NewsPosts => Set<NewsPost>();
|
|
|
|
public DbSet<SupportTicket> SupportTickets => Set<SupportTicket>();
|
|
|
|
public DbSet<TicketComment> TicketComments => Set<TicketComment>();
|
|
|
|
public DbSet<TicketAttachment> TicketAttachments => Set<TicketAttachment>();
|
|
|
|
public DbSet<InstructionIntro> InstructionIntros => Set<InstructionIntro>();
|
|
|
|
public DbSet<InstructionTab> InstructionTabs => Set<InstructionTab>();
|
|
|
|
public DbSet<PricingSettings> PricingSettings => Set<PricingSettings>();
|
|
|
|
public DbSet<PricingDiscountTier> PricingDiscountTiers => Set<PricingDiscountTier>();
|
|
|
|
public DbSet<BillingSettings> BillingSettings => Set<BillingSettings>();
|
|
|
|
public DbSet<PaymentRequest> PaymentRequests => Set<PaymentRequest>();
|
|
|
|
public DbSet<Plan> Plans => Set<Plan>();
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
|
|
}
|
|
}
|