feat: V2 microservices stack — backend services, gateway, JWT auth
Add full V2 architecture: identity, content, studio (.NET 10) and file, render, notification, gateway (Go) services with vendored deps, plus DB migrations, event/API contracts, and an init-db script. Wire the Next.js frontend to the gateway: server-side JWT auth routes (login/register/refresh/logout/me), gateway fetch helper, and session/ cookie/jwt helpers under src/lib. Containerize the stack via docker-compose.v2.yml and per-service Dockerfiles. Base images resolve through a Nexus mirror (Docker Hub) and MCR directly; npm/NuGet pull from Nexus groups. Self-host fonts via next/font/local to avoid Google Fonts (geo-blocked). Add CI workflow and ignore .env.v2, *.stackdump, and .NET bin/obj. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
using FlatRender.IdentitySvc.Domain.Enums;
|
||||
|
||||
namespace FlatRender.IdentitySvc.Domain.Entities;
|
||||
|
||||
public class Plan
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
public PlanScope Scope { get; set; } = PlanScope.User;
|
||||
public string Code { get; set; } = default!;
|
||||
public string Name { get; set; } = default!;
|
||||
public string? Description { get; set; }
|
||||
|
||||
public long PriceMinor { get; set; }
|
||||
public long? BeforePriceMinor { get; set; }
|
||||
public string Currency { get; set; } = "IRR";
|
||||
public decimal DiscountPercentage { get; set; }
|
||||
|
||||
public BillingPeriod BillingPeriod { get; set; } = BillingPeriod.Monthly;
|
||||
public int? MonthsDuration { get; set; }
|
||||
|
||||
public int SecondsCharge { get; set; }
|
||||
public int? MonthlyRendersQuota { get; set; }
|
||||
public int StorageGb { get; set; } = 1;
|
||||
public int ParallelRenders { get; set; } = 1;
|
||||
public string MaxResolution { get; set; } = "FullHD";
|
||||
public int MinVideoLengthSec { get; set; }
|
||||
public decimal RenderSpeedFactor { get; set; } = 1.0m;
|
||||
|
||||
public int Sort { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public string? Cover { get; set; }
|
||||
public string? Color { get; set; }
|
||||
public bool IsFeatured { get; set; }
|
||||
|
||||
public string Features { get; set; } = "{}";
|
||||
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime? AvailableFrom { get; set; }
|
||||
public DateTime? AvailableUntil { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? DeletedAt { get; set; }
|
||||
|
||||
public ICollection<UserPlan> UserPlans { get; set; } = [];
|
||||
}
|
||||
|
||||
public class UserPlan
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid UserId { get; set; }
|
||||
public User User { get; set; } = default!;
|
||||
public Guid TenantId { get; set; }
|
||||
public Guid PlanId { get; set; }
|
||||
public Plan Plan { get; set; } = default!;
|
||||
|
||||
public string PlanCode { get; set; } = default!;
|
||||
public string PlanName { get; set; } = default!;
|
||||
public long PriceMinorPaid { get; set; }
|
||||
public string Currency { get; set; } = "IRR";
|
||||
|
||||
public int InitialSecondsCharge { get; set; }
|
||||
public int RemainChargeSec { get; set; }
|
||||
public int AddedChargeFromPastPlan { get; set; }
|
||||
public int MonthlyRendersUsed { get; set; }
|
||||
public DateTime? MonthlyRendersResetAt { get; set; }
|
||||
|
||||
public DateTime RegisterDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime StartsAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
public DateTime? CancelledAt { get; set; }
|
||||
public string? CancelReason { get; set; }
|
||||
public bool AutoRenew { get; set; }
|
||||
|
||||
public Guid? PaymentId { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class Payment
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid TenantId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public User User { get; set; } = default!;
|
||||
|
||||
public PaymentGateway Gateway { get; set; }
|
||||
public PaymentStatus Status { get; set; } = PaymentStatus.Pending;
|
||||
public PaymentAction Action { get; set; }
|
||||
|
||||
public long AmountMinor { get; set; }
|
||||
public string Currency { get; set; } = "IRR";
|
||||
public long BalanceReducerMinor { get; set; }
|
||||
public long DiscountValueMinor { get; set; }
|
||||
|
||||
public string? GatewayToken { get; set; }
|
||||
public string? GatewayOrderId { get; set; }
|
||||
public string? GatewayTrackId { get; set; }
|
||||
public string? GatewayResponse { get; set; }
|
||||
public string? CardLast4 { get; set; }
|
||||
public string? CardHash { get; set; }
|
||||
|
||||
public string? Title { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public Guid? OwnerUserId { get; set; }
|
||||
public long AffiliateProfitMinor { get; set; }
|
||||
|
||||
public Guid? UsedDiscountId { get; set; }
|
||||
public Guid? PlanId { get; set; }
|
||||
public Guid? RenderJobId { get; set; }
|
||||
public Guid? UserProjectId { get; set; }
|
||||
|
||||
public DateTime? ConfirmedAt { get; set; }
|
||||
public DateTime? FailedAt { get; set; }
|
||||
public string? FailureReason { get; set; }
|
||||
public DateTime? RefundedAt { get; set; }
|
||||
public long? RefundAmountMinor { get; set; }
|
||||
public string? RefundReason { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class Discount
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid TenantId { get; set; }
|
||||
|
||||
public string Name { get; set; } = default!;
|
||||
public string Code { get; set; } = default!;
|
||||
public DiscountKind Kind { get; set; }
|
||||
public decimal Value { get; set; }
|
||||
|
||||
public Guid? OwnerUserId { get; set; }
|
||||
public decimal OwnerProfitPercentage { get; set; }
|
||||
public bool OnlyOwner { get; set; }
|
||||
|
||||
public int? MaxUseCount { get; set; }
|
||||
public int UsedCount { get; set; }
|
||||
public long MinPurchaseMinor { get; set; }
|
||||
public Guid[]? AppliesToPlanIds { get; set; }
|
||||
|
||||
public DateTime? StartsAt { get; set; }
|
||||
public DateTime? ExpiresAt { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class UsedDiscount
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid DiscountId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public Guid? PaymentId { get; set; }
|
||||
public string Code { get; set; } = default!;
|
||||
public long AmountDiscountedMinor { get; set; }
|
||||
public DateTime UseDate { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user