feat: enforce tenant isolation and shared question bank

This commit is contained in:
2026-07-27 16:59:12 +08:00
parent 28e9a9fa41
commit db4c7b4496
137 changed files with 6402 additions and 112274 deletions

View File

@@ -0,0 +1,47 @@
using System.Text.Json;
namespace Tiku.Application.Tenancy;
public sealed record TenantFrontendConfigDraft(
JsonElement Branding,
JsonElement Theme,
JsonElement Features,
JsonElement Navigation,
JsonElement HomeModules);
public sealed record TenantFrontendConfigItem(
int SchemaVersion,
int ConfigVersion,
TenantFrontendConfigDraft Published,
TenantFrontendConfigDraft Draft,
DateTimeOffset? PublishedAt);
public sealed record TenantRuntimeBootstrap(
int SchemaVersion,
int ConfigVersion,
string TenantCode,
string TenantName,
JsonElement Branding,
JsonElement Theme,
JsonElement Features,
JsonElement Navigation,
JsonElement HomeModules);
public interface ITenantFrontendConfigService
{
Task<TenantFrontendConfigItem> GetAsync(Guid tenantId, CancellationToken cancellationToken = default);
Task<TenantFrontendConfigItem> SaveDraftAsync(
Guid tenantId,
TenantFrontendConfigDraft draft,
CancellationToken cancellationToken = default);
Task<TenantFrontendConfigItem> PublishAsync(
Guid tenantId,
int expectedVersion,
CancellationToken cancellationToken = default);
Task<TenantRuntimeBootstrap> GetRuntimeAsync(Guid tenantId, CancellationToken cancellationToken = default);
}
public sealed class TenantFrontendConfigException(string code, string message) : Exception(message)
{
public string Code { get; } = code;
}