feat: tenant detail 返回实名与套餐详情
This commit is contained in:
@@ -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()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user