feat: add tenant resolve and health endpoints

This commit is contained in:
xiong
2026-07-26 13:28:51 +08:00
parent 00413d6b3b
commit b10e1495c5
6 changed files with 426 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
namespace Tiku.Api.Contracts;
public sealed record HealthResponseDto(
string Status,
string Service,
DateTimeOffset CheckedAt);

View File

@@ -0,0 +1,56 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using Tiku.Domain.Common;
using Tiku.Domain.Tenancy;
namespace Tiku.Api.Contracts;
public sealed class TenantResolveQueryDto
{
[StringLength(253)]
[Description("要解析的访问域名,例如 student.example.com。本地开发也可以直接传 localhost。")]
public string? Host { get; set; }
[StringLength(100)]
[Description("租户编码;本地开发或无独立域名时使用,例如 master。")]
public string? TenantCode { get; set; }
}
public sealed record TenantResolveResponseDto(
PublicTenantDto Tenant,
PublicTenantBrandingDto Branding,
JsonElement Features,
JsonElement AdminFeatures,
JsonElement PublicConfig);
public sealed record PublicTenantDto(
Guid Id,
string Slug,
string Name,
TenantStatus Status,
TenantMode Mode,
string? Host);
public sealed record PublicTenantBrandingDto(
string? BrandName,
string? ShortName,
string? Slogan,
string? LogoUrl,
string? FaviconUrl,
string? ServiceWechat,
string? ServiceAccountName,
JsonElement Theme,
JsonElement PublicAssets)
{
public static PublicTenantBrandingDto Empty { get; } = new(
null,
null,
null,
null,
null,
null,
null,
JsonDefaults.Object(),
JsonDefaults.Object());
}