forked from gongxuegit/tiku-backend.net
feat: enforce tenant isolation and shared question bank
This commit is contained in:
47
Tiku.Application/Tenancy/TenantFrontendConfigModels.cs
Normal file
47
Tiku.Application/Tenancy/TenantFrontendConfigModels.cs
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user