feat: tenant detail 返回实名与套餐详情

This commit is contained in:
2025-12-14 18:02:17 +08:00
parent 4b63c1913c
commit 91c9ed413b
4 changed files with 53 additions and 3 deletions

View File

@@ -10,7 +10,9 @@ namespace TakeoutSaaS.Application.App.Tenants.Handlers;
/// <summary>
/// 租户详情查询处理器。
/// </summary>
public sealed class GetTenantByIdQueryHandler(ITenantRepository tenantRepository)
public sealed class GetTenantByIdQueryHandler(
ITenantRepository tenantRepository,
ITenantPackageRepository tenantPackageRepository)
: IRequestHandler<GetTenantByIdQuery, TenantDetailDto>
{
/// <inheritdoc />
@@ -24,12 +26,18 @@ public sealed class GetTenantByIdQueryHandler(ITenantRepository tenantRepository
var subscription = await tenantRepository.GetActiveSubscriptionAsync(request.TenantId, cancellationToken);
var verification = await tenantRepository.GetVerificationProfileAsync(request.TenantId, cancellationToken);
// 3. 组装返回
// 3. (空行后) 查询当前套餐
var package = subscription == null
? null
: await tenantPackageRepository.FindByIdAsync(subscription.TenantPackageId, cancellationToken);
// 4. (空行后) 组装返回
return new TenantDetailDto
{
Tenant = TenantMapping.ToDto(tenant, subscription, verification),
Verification = verification.ToVerificationDto(),
Subscription = subscription.ToSubscriptionDto()
Subscription = subscription.ToSubscriptionDto(),
Package = package?.ToDto()
};
}
}