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;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using FlatRender.IdentitySvc.Domain.Enums;
|
||||
|
||||
namespace FlatRender.IdentitySvc.Domain.Entities;
|
||||
|
||||
public class Quest
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
public string Title { get; set; } = default!;
|
||||
public string? Challenge { get; set; }
|
||||
public string? Why { get; set; }
|
||||
public string? Hint { get; set; }
|
||||
public string? Aphorism { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
|
||||
public QuestType QuestType { get; set; }
|
||||
public string TargetEvent { get; set; } = default!;
|
||||
public int TargetCount { get; set; } = 1;
|
||||
public string Metadata { get; set; } = "{}";
|
||||
|
||||
public PrizeType PrizeType { get; set; }
|
||||
public long PrizeAmount { get; set; }
|
||||
|
||||
public int? LevelLimit { get; set; }
|
||||
public string? StartUrl { get; set; }
|
||||
public string? PostActionName { get; set; }
|
||||
public int OrderValue { 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 ICollection<UserQuestProgress> Progress { get; set; } = [];
|
||||
}
|
||||
|
||||
public class UserQuestProgress
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid UserId { get; set; }
|
||||
public Guid QuestId { get; set; }
|
||||
public Quest Quest { get; set; } = default!;
|
||||
|
||||
public int CurrentCount { get; set; }
|
||||
public string? TextValue { get; set; }
|
||||
public bool IsCompleted { get; set; }
|
||||
public DateTime? CompletedAt { get; set; }
|
||||
public bool PrizeClaimed { get; set; }
|
||||
public DateTime? PrizeClaimedAt { get; set; }
|
||||
public DateOnly? PeriodStart { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class Gift
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
public string Name { get; set; } = default!;
|
||||
public string? Description { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public GiftType GiftType { get; set; }
|
||||
public PrizeType PrizeType { get; set; }
|
||||
public long Value { get; set; }
|
||||
public string? Unit { get; set; }
|
||||
|
||||
public Guid? AssignedByUserId { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public ICollection<EarnedGift> EarnedGifts { get; set; } = [];
|
||||
}
|
||||
|
||||
public class EarnedGift
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid UserId { get; set; }
|
||||
public Guid GiftId { get; set; }
|
||||
public Gift Gift { get; set; } = default!;
|
||||
public Guid? NotificationId { get; set; }
|
||||
public string? Source { get; set; }
|
||||
public Guid? SourceRef { get; set; }
|
||||
|
||||
public DateTime EarnedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? ExpiresAt { get; set; }
|
||||
public bool IsUsed { get; set; }
|
||||
public DateTime? UsedAt { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class Avatar
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public string Code { get; set; } = default!;
|
||||
public string Url { get; set; } = default!;
|
||||
public string? Description { get; set; }
|
||||
public int Sort { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
using FlatRender.IdentitySvc.Domain.Enums;
|
||||
|
||||
namespace FlatRender.IdentitySvc.Domain.Entities;
|
||||
|
||||
public class Tenant
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public string Slug { get; set; } = default!;
|
||||
public string Name { get; set; } = default!;
|
||||
public TenantKind Kind { get; set; } = TenantKind.Reseller;
|
||||
public TenantStatus Status { get; set; } = TenantStatus.Trial;
|
||||
|
||||
public string? CustomDomain { get; set; }
|
||||
public bool DomainVerified { get; set; }
|
||||
public string[] AllowedOrigins { get; set; } = [];
|
||||
|
||||
public string? ContactName { get; set; }
|
||||
public string? ContactEmail { get; set; }
|
||||
public string? ContactPhone { get; set; }
|
||||
public string? BillingEmail { get; set; }
|
||||
|
||||
public int? MaxUsers { get; set; }
|
||||
public int? MaxStorageGb { get; set; }
|
||||
public int? MonthlyRenderQty { get; set; }
|
||||
public int? MonthlyRenderSec { get; set; }
|
||||
|
||||
public DateTime? TrialEndsAt { get; set; }
|
||||
public DateTime? SuspendedAt { get; set; }
|
||||
public string? SuspensionReason { get; set; }
|
||||
|
||||
public string Metadata { get; set; } = "{}";
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? DeletedAt { get; set; }
|
||||
|
||||
public TenantBranding? Branding { get; set; }
|
||||
public ICollection<TenantApiKey> ApiKeys { get; set; } = [];
|
||||
public ICollection<TenantWebhook> Webhooks { get; set; } = [];
|
||||
}
|
||||
|
||||
public class TenantBranding
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid TenantId { get; set; }
|
||||
public Tenant Tenant { get; set; } = default!;
|
||||
|
||||
public string? DisplayName { get; set; }
|
||||
public string? LogoUrl { get; set; }
|
||||
public string? LogoDarkUrl { get; set; }
|
||||
public string? FaviconUrl { get; set; }
|
||||
public string? OgImageUrl { get; set; }
|
||||
public string? PrimaryColor { get; set; }
|
||||
public string? SecondaryColor { get; set; }
|
||||
public string? AccentColor { get; set; }
|
||||
public string? BackgroundColor { get; set; }
|
||||
public string? FontFamily { get; set; }
|
||||
public string? EmailFromName { get; set; }
|
||||
public string? EmailFromAddress { get; set; }
|
||||
public string? EmailReplyTo { get; set; }
|
||||
public string? EmailFooterHtml { get; set; }
|
||||
public string? SupportUrl { get; set; }
|
||||
public string? TermsUrl { get; set; }
|
||||
public string? PrivacyUrl { get; set; }
|
||||
public bool EmbedEnabled { get; set; }
|
||||
public string[] EmbedAllowedHosts { get; set; } = [];
|
||||
public string? WatermarkText { get; set; }
|
||||
public string? WatermarkImageUrl { get; set; }
|
||||
public bool WatermarkEnabled { get; set; }
|
||||
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class TenantApiKey
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid TenantId { get; set; }
|
||||
public Tenant Tenant { get; set; } = default!;
|
||||
public Guid? CreatedByUserId { get; set; }
|
||||
|
||||
public string Name { get; set; } = default!;
|
||||
public string Environment { get; set; } = "Live";
|
||||
public string KeyPrefix { get; set; } = default!;
|
||||
public string KeyHash { get; set; } = default!;
|
||||
public string Last4 { get; set; } = default!;
|
||||
public string[] Scopes { get; set; } = [];
|
||||
public string[] AllowedIps { get; set; } = [];
|
||||
public int RateLimitRpm { get; set; } = 60;
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime? ExpiresAt { get; set; }
|
||||
public DateTime? LastUsedAt { get; set; }
|
||||
public long UsageCount { get; set; }
|
||||
public string? RevokeReason { get; set; }
|
||||
public DateTime? RevokedAt { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class TenantWebhook
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid TenantId { get; set; }
|
||||
public Tenant Tenant { get; set; } = default!;
|
||||
|
||||
public string Name { get; set; } = default!;
|
||||
public string Url { get; set; } = default!;
|
||||
public string[] Events { get; set; } = [];
|
||||
public string? SecretHash { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime? LastTriggeredAt { get; set; }
|
||||
public int? LastStatusCode { get; set; }
|
||||
public int ConsecutiveFailures { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public ICollection<TenantWebhookDelivery> Deliveries { get; set; } = [];
|
||||
}
|
||||
|
||||
public class TenantWebhookDelivery
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid WebhookId { get; set; }
|
||||
public TenantWebhook Webhook { get; set; } = default!;
|
||||
|
||||
public string EventType { get; set; } = default!;
|
||||
public string RequestUrl { get; set; } = default!;
|
||||
public string? RequestBody { get; set; }
|
||||
public int? ResponseStatus { get; set; }
|
||||
public string? ResponseBody { get; set; }
|
||||
public int DurationMs { get; set; }
|
||||
public int Attempt { get; set; } = 1;
|
||||
public bool Succeeded { get; set; }
|
||||
public string? ErrorMessage { get; set; }
|
||||
public DateTime? DeliveredAt { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class TenantUsageDaily
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid TenantId { get; set; }
|
||||
public DateOnly UsageDate { get; set; }
|
||||
|
||||
public int RendersCompleted { get; set; }
|
||||
public long RenderSeconds { get; set; }
|
||||
public long StorageBytes { get; set; }
|
||||
public long ApiCalls { get; set; }
|
||||
public int ActiveUsers { get; set; }
|
||||
public long AmountBilledMinor { get; set; }
|
||||
public string BillingCurrency { get; set; } = "IRR";
|
||||
public string? BillingStatus { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
using FlatRender.IdentitySvc.Domain.Enums;
|
||||
|
||||
namespace FlatRender.IdentitySvc.Domain.Entities;
|
||||
|
||||
public class User
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid TenantId { get; set; }
|
||||
public Tenant Tenant { get; set; } = default!;
|
||||
|
||||
// Auth
|
||||
public string? Email { get; set; }
|
||||
public bool EmailVerified { get; set; }
|
||||
public DateTime? EmailVerifiedAt { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
public string? PhoneCountryCode { get; set; }
|
||||
public bool PhoneVerified { get; set; }
|
||||
public DateTime? PhoneVerifiedAt { get; set; }
|
||||
public string? PasswordHash { get; set; }
|
||||
public DateTime? PasswordSetAt { get; set; }
|
||||
public DateTime? LastPasswordResetDate { get; set; }
|
||||
public RegisterMode RegisterMode { get; set; } = RegisterMode.Email;
|
||||
public string? ExternalProvider { get; set; }
|
||||
public string? ExternalProviderId { get; set; }
|
||||
|
||||
// Profile
|
||||
public string? FullName { get; set; }
|
||||
public string? AvatarUrl { get; set; }
|
||||
public DateOnly? BirthDate { get; set; }
|
||||
public GenderKind? Gender { get; set; }
|
||||
public string? NationalCode { get; set; }
|
||||
public string? CountryCode { get; set; }
|
||||
public string? CompanyName { get; set; }
|
||||
public string? WebsiteName { get; set; }
|
||||
public string? Slogan { get; set; }
|
||||
public string? AboutMe { get; set; }
|
||||
public string? MethodOfIntroduction { get; set; }
|
||||
|
||||
// Balances
|
||||
public long BalanceMinor { get; set; }
|
||||
public long AffiliateBalanceMinor { get; set; }
|
||||
public Guid? AffiliateOwnerId { get; set; }
|
||||
public decimal ProfitPercentage { get; set; }
|
||||
|
||||
// Gamification
|
||||
public int LoyaltyScore { get; set; }
|
||||
public int PurplePoint { get; set; }
|
||||
|
||||
// Render quotas
|
||||
public int DailyRemainRenderCount { get; set; }
|
||||
public int MaxDailyRenderCount { get; set; }
|
||||
public int ParallelRenderingCeiling { get; set; } = 1;
|
||||
public int UserDailyFreeChargeSec { get; set; }
|
||||
public DateTime? DailyFreeChargeResetDate { get; set; }
|
||||
public int MaxPreviewDurationSec { get; set; } = 30;
|
||||
public bool ForceRenderQueue { get; set; }
|
||||
public bool RemoveWatermarkService { get; set; }
|
||||
|
||||
// Telegram
|
||||
public string? TelegramId { get; set; }
|
||||
public bool TelegramTellMe { get; set; }
|
||||
|
||||
// Comms prefs
|
||||
public bool EmailTellMe { get; set; } = true;
|
||||
public bool SmsTellMe { get; set; }
|
||||
public bool PushTellMe { get; set; } = true;
|
||||
|
||||
// Storage
|
||||
public string? StorageEndpoint { get; set; }
|
||||
public long UsedStorageBytes { get; set; }
|
||||
|
||||
// Status
|
||||
public bool IsAdmin { get; set; }
|
||||
public bool IsTenantAdmin { get; set; }
|
||||
public bool BanAccount { get; set; }
|
||||
public string? BanReason { get; set; }
|
||||
public DateTime? UnblockDate { get; set; }
|
||||
|
||||
// Activity
|
||||
public DateTime? LastActiveDate { get; set; }
|
||||
public DateTime? LastLoginAt { get; set; }
|
||||
public string? LastLoginIp { get; set; }
|
||||
public bool RegisteredWithMobileApp { get; set; }
|
||||
public DateTime RegisterDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public string Metadata { get; set; } = "{}";
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? DeletedAt { get; set; }
|
||||
|
||||
public ICollection<UserSession> Sessions { get; set; } = [];
|
||||
public ICollection<MfaFactor> MfaFactors { get; set; } = [];
|
||||
public ICollection<PushSubscription> PushSubscriptions { get; set; } = [];
|
||||
public ICollection<UserPlan> Plans { get; set; } = [];
|
||||
public ICollection<Payment> Payments { get; set; } = [];
|
||||
}
|
||||
|
||||
public class UserSession
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid UserId { get; set; }
|
||||
public User User { get; set; } = default!;
|
||||
public Guid TenantId { get; set; }
|
||||
|
||||
public string RefreshTokenHash { get; set; } = default!;
|
||||
public string? DeviceId { get; set; }
|
||||
public string? DeviceName { get; set; }
|
||||
public string? UserAgent { get; set; }
|
||||
public string? IpAddress { get; set; }
|
||||
|
||||
public DateTime IssuedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
public DateTime? RevokedAt { get; set; }
|
||||
public DateTime? LastUsedAt { get; set; }
|
||||
}
|
||||
|
||||
public class ConfirmationToken
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid? UserId { get; set; }
|
||||
public Guid TenantId { get; set; }
|
||||
public TokenPurpose Purpose { get; set; }
|
||||
|
||||
public string Identifier { get; set; } = default!;
|
||||
public string? NextIdentifier { get; set; }
|
||||
public string TokenHash { get; set; } = default!;
|
||||
public string? Code { get; set; }
|
||||
|
||||
public bool IsConsumed { get; set; }
|
||||
public DateTime? ConsumedAt { get; set; }
|
||||
public int TryCount { get; set; }
|
||||
public int MaxTries { get; set; } = 5;
|
||||
|
||||
public string? RequestIp { get; set; }
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class PushSubscription
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid UserId { get; set; }
|
||||
public User User { get; set; } = default!;
|
||||
public Guid TenantId { get; set; }
|
||||
|
||||
public string Endpoint { get; set; } = default!;
|
||||
public string P256dhKey { get; set; } = default!;
|
||||
public string AuthKey { get; set; } = default!;
|
||||
public string? UserAgent { get; set; }
|
||||
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime? LastUsedAt { get; set; }
|
||||
public int FailureCount { get; set; }
|
||||
public DateTime? LastFailureAt { get; set; }
|
||||
public int? LastFailureStatus { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class MfaFactor
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid UserId { get; set; }
|
||||
public User User { get; set; } = default!;
|
||||
public MfaFactorType FactorType { get; set; }
|
||||
public string? SecretEncrypted { get; set; }
|
||||
public bool IsVerified { get; set; }
|
||||
public bool IsPrimary { get; set; }
|
||||
public string? Label { get; set; }
|
||||
public DateTime? LastUsedAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace FlatRender.IdentitySvc.Domain.Enums;
|
||||
|
||||
public enum TenantStatus { Active, Trial, Suspended, Cancelled }
|
||||
public enum TenantKind { Internal, Reseller, Enterprise }
|
||||
public enum RegisterMode { Email, Mobile, Google, Telegram, SSO, Reseller }
|
||||
public enum GenderKind { Male, Female, Other, PreferNotToSay }
|
||||
public enum TokenPurpose { EmailVerification, PhoneVerification, PasswordReset, MfaSetup, Login, EmailChange }
|
||||
public enum MfaFactorType { TOTP, SMS, Email, RecoveryCode }
|
||||
public enum PlanScope { User, Tenant }
|
||||
public enum BillingPeriod { Monthly, Quarterly, SemiAnnual, Annual, Lifetime, OneTime }
|
||||
public enum PaymentGateway { ZarinPal, IdPay, Bazaar, Stripe, Balance, Manual, Tara, SnapPay }
|
||||
public enum PaymentStatus { Pending, Succeeded, Failed, Refunded, Cancelled }
|
||||
public enum PaymentAction { PlanPurchase, BalanceCharge, ProjectRender, UserProject, StorageUpgrade, Other }
|
||||
public enum DiscountKind { Percentage, FixedAmount, FreeMonths, RenderCredits }
|
||||
public enum UserProjectStatus { Draft, Submitted, Quoted, InProgress, Review, Completed, Cancelled }
|
||||
public enum QuestType { OneTime, Daily, Weekly, Onboarding, Milestone }
|
||||
public enum PrizeType { Balance, RenderSeconds, LoyaltyPoints, StorageGB, Plan, Discount }
|
||||
public enum GiftType { Bonus, Referral, Compensation, Promotion, Achievement }
|
||||
Reference in New Issue
Block a user