Files
tiku-backend.net/Tiku.Application/Tenancy/TenantFrontendConfigModels.cs

48 lines
1.4 KiB
C#

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;
}