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:
soroush.asadi
2026-05-29 23:29:31 +03:30
parent 53ea78a00d
commit 90ac0b81d1
7636 changed files with 3707504 additions and 240 deletions
@@ -0,0 +1,297 @@
using FlatRender.ContentSvc.Domain.Enums;
namespace FlatRender.ContentSvc.Domain.Entities;
public class Scene
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid ProjectId { get; set; }
public Project Project { get; set; } = default!;
public string Key { get; set; } = default!;
public string Title { get; set; } = default!;
public string? LocalizedTitle { get; set; }
public SceneKind SceneType { get; set; } = SceneKind.Normal;
public string? Image { get; set; }
public string? Demo { get; set; }
public string? SceneColorSvg { get; set; }
public string? SnapshotUrl { get; set; }
public bool GenerateKf { get; set; }
public decimal? DefaultDurationSec { get; set; }
public decimal? MinDurationSec { get; set; }
public decimal? MaxDurationSec { get; set; }
public decimal OverlapAtEndSec { get; set; }
public bool CanHandleDuration { get; set; } = true;
public bool ManualColorSelection { get; set; }
public int Sort { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public DateTime? DeletedAt { get; set; }
public ICollection<RepeaterItem> RepeaterItems { get; set; } = [];
public ICollection<SceneContentElement> ContentElements { get; set; } = [];
public ICollection<SceneColorElement> ColorElements { get; set; } = [];
public ICollection<SceneColorPreset> ColorPresets { get; set; } = [];
public ICollection<SceneCharacter> Characters { get; set; } = [];
public ICollection<SceneCategory> SceneCategories { get; set; } = [];
}
public class RepeaterItem
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid SceneId { get; set; }
public Scene Scene { get; set; } = default!;
public string Title { get; set; } = default!;
public string RepeatBoxKey { get; set; } = default!;
public string RepeatItemKey { get; set; } = default!;
public int MaxRepeatCount { get; set; } = 10;
public bool UserCanChangeSort { get; set; } = true;
public RepeatSortStrategy RepeatSortStrategy { get; set; } = RepeatSortStrategy.Manual;
public int Sort { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public ICollection<SceneContentElement> ContentElements { get; set; } = [];
}
public class SceneContentElement
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid SceneId { get; set; }
public Scene Scene { get; set; } = default!;
public Guid? RepeaterItemId { get; set; }
public string Key { get; set; } = default!;
public string Title { get; set; } = default!;
public string? LocalizedTitle { get; set; }
public string? Hint { get; set; }
public ContentElementType Type { get; set; }
public string? DefaultValue { get; set; }
// Text
public Guid? FontId { get; set; }
public string? FontFace { get; set; }
public string? FontFaceName { get; set; }
public int? FontSize { get; set; }
public int? DefaultFontSize { get; set; }
public string? DefaultFontFace { get; set; }
public bool IsFontChangeable { get; set; } = true;
public bool IsFontSizeChangeable { get; set; } = true;
public JustifyKind Justify { get; set; } = JustifyKind.CENTER_JUSTIFY;
public bool CanJustify { get; set; } = true;
public int PositionInContainer { get; set; }
public bool IsTextBox { get; set; }
public int? MaxSize { get; set; }
public string? DirectionLayerKey { get; set; }
public int DirectionLayerValue { get; set; }
// Media
public bool VideoSupport { get; set; }
public decimal? MinDurationSec { get; set; }
public decimal? MaxDurationSec { get; set; }
public int? Width { get; set; }
public int? Height { get; set; }
public string? Thumbnail { get; set; }
// Misc
public string? MappedList { get; set; }
public string? CounterMode { get; set; }
public AiInputType AiInputType { get; set; } = AiInputType.None;
public bool IsHidden { get; set; }
public bool IsFocused { get; set; }
public string? OpacityControllerKey { get; set; }
// Legacy design pattern variants
public string? Dp1Image { get; set; }
public string? Dp1Title { get; set; }
public string? Dp2Image { get; set; }
public string? Dp2Title { get; set; }
public string? Dp3Image { get; set; }
public string? Dp3Title { get; set; }
public string? Dp4Image { get; set; }
public string? Dp4Title { get; set; }
public int VirtualCount { get; set; } = 1;
public int Sort { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
public class SceneColorElement
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid SceneId { get; set; }
public Scene Scene { get; set; } = default!;
public string ElementKey { get; set; } = default!;
public string Title { get; set; } = default!;
public string? Icon { get; set; }
public AttrValueKind AttrValue { get; set; } = AttrValueKind.fill;
public string DefaultColor { get; set; } = default!;
public int Sort { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
public class SceneColorPreset
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid SceneId { get; set; }
public string? Name { get; set; }
public int Sort { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public ICollection<SceneColorPresetItem> Items { get; set; } = [];
}
public class SceneColorPresetItem
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid PresetId { get; set; }
public SceneColorPreset Preset { get; set; } = default!;
public string ElementKey { get; set; } = default!;
public string Value { get; set; } = default!;
public int Sort { get; set; }
}
public class SharedColor
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid ProjectId { get; set; }
public Project Project { get; set; } = default!;
public string ElementKey { get; set; } = default!;
public string Title { get; set; } = default!;
public string? Icon { get; set; }
public AttrValueKind AttrValue { get; set; } = AttrValueKind.fill;
public string DefaultColor { get; set; } = default!;
public int Sort { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
public class SharedLayer
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid ProjectId { get; set; }
public Project Project { get; set; } = default!;
public string Key { get; set; } = default!;
public string Title { get; set; } = default!;
public string? LocalizedTitle { get; set; }
public string? Hint { get; set; }
public ContentElementType Type { get; set; }
public string? DefaultValue { get; set; }
public Guid? FontId { get; set; }
public string? FontFace { get; set; }
public string? FontFaceName { get; set; }
public int? FontSize { get; set; }
public int? DefaultFontSize { get; set; }
public string? DefaultFontFace { get; set; }
public bool IsFontChangeable { get; set; } = true;
public bool IsFontSizeChangeable { get; set; } = true;
public JustifyKind Justify { get; set; } = JustifyKind.CENTER_JUSTIFY;
public bool CanJustify { get; set; } = true;
public int PositionInContainer { get; set; }
public bool IsTextBox { get; set; }
public int? MaxSize { get; set; }
public string? DirectionLayerKey { get; set; }
public int DirectionLayerValue { get; set; }
public bool VideoSupport { get; set; }
public decimal? MinDurationSec { get; set; }
public decimal? MaxDurationSec { get; set; }
public int? Width { get; set; }
public int? Height { get; set; }
public string? Thumbnail { get; set; }
public string? MappedList { get; set; }
public string? CounterMode { get; set; }
public AiInputType AiInputType { get; set; } = AiInputType.None;
public bool IsHidden { get; set; }
public bool IsFocused { get; set; }
// Legacy design pattern variants
public string? Dp1Image { get; set; }
public string? Dp1Title { get; set; }
public string? Dp2Image { get; set; }
public string? Dp2Title { get; set; }
public string? Dp3Image { get; set; }
public string? Dp3Title { get; set; }
public string? Dp4Image { get; set; }
public string? Dp4Title { get; set; }
public int VirtualCount { get; set; } = 1;
public int Sort { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
public class SceneCategory
{
public Guid SceneId { get; set; }
public Scene Scene { get; set; } = default!;
public Guid CategoryId { get; set; }
public Category Category { get; set; } = default!;
}
public class SharedColorPreset
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid ProjectId { get; set; }
public Project Project { get; set; } = default!;
public string? Name { get; set; }
public int Sort { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public ICollection<SharedColorPresetItem> Items { get; set; } = [];
}
public class SharedColorPresetItem
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid PresetId { get; set; }
public SharedColorPreset Preset { get; set; } = default!;
public string ElementKey { get; set; } = default!;
public string Value { get; set; } = default!;
public int Sort { get; set; }
}
public class TemplateSvgPreview
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid? ProjectId { get; set; }
public Guid? SceneId { get; set; }
public string? SourceImageUrl { get; set; }
public string SvgUrl { get; set; } = default!;
public string? ThumbnailUrl { get; set; }
public string ColorZones { get; set; } = "[]";
public int? Width { get; set; }
public int? Height { get; set; }
public string? GenerationMethod { get; set; }
public bool GeneratedByAi { get; set; }
public decimal? QualityScore { get; set; }
public Guid? CreatedByUserId { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}