feat: 实现租户管理及套餐流程

This commit is contained in:
2025-12-03 16:37:50 +08:00
parent 151f64d41a
commit a536a554c2
34 changed files with 1732 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
using System.Linq;
using MediatR;
using TakeoutSaaS.Application.App.Tenants.Dto;
using TakeoutSaaS.Application.App.Tenants.Queries;
using TakeoutSaaS.Domain.Tenants.Repositories;
using TakeoutSaaS.Shared.Abstractions.Results;
namespace TakeoutSaaS.Application.App.Tenants.Handlers;
/// <summary>
/// 审核日志查询。
/// </summary>
public sealed class GetTenantAuditLogsQueryHandler(ITenantRepository tenantRepository)
: IRequestHandler<GetTenantAuditLogsQuery, PagedResult<TenantAuditLogDto>>
{
private readonly ITenantRepository _tenantRepository = tenantRepository;
/// <inheritdoc />
public async Task<PagedResult<TenantAuditLogDto>> Handle(GetTenantAuditLogsQuery request, CancellationToken cancellationToken)
{
var logs = await _tenantRepository.GetAuditLogsAsync(request.TenantId, cancellationToken);
var total = logs.Count;
var paged = logs
.Skip((request.Page - 1) * request.PageSize)
.Take(request.PageSize)
.Select(TenantMapping.ToDto)
.ToList();
return new PagedResult<TenantAuditLogDto>(paged, request.Page, request.PageSize, total);
}
}