Files
TakeoutSaaS.TenantApi/src/Application/TakeoutSaaS.Application/App/Tenants/Dto/QuotaUsageHistoryDto.cs
MSuMshk 907c9938ae feat(admin-api): 实现 TD-001 和 TD-002 后端接口
TD-001 - PUT /api/admin/v1/tenants/{tenantId}:
- 新增 UpdateTenantCommand + UpdateTenantCommandHandler
- Controller 新增 Update 端点(tenant:update 权限)
- 校验:租户存在、name 非空、name/contactPhone 冲突返回 409
- 仓储扩展:ITenantRepository.ExistsByNameAsync

TD-002 - GET /api/admin/v1/tenants/{tenantId}/quota-usage-history:
- 新增 CQRS Query/Handler/DTO/Validator
- 支持分页(Page>=1, PageSize 1~100)
- 支持时间范围和 QuotaType 过滤
- 新增 tenant_quota_usage_histories 表(含迁移)
- 写入点:CheckTenantQuotaCommandHandler + PurchaseQuotaPackageCommandHandler

构建验证:dotnet build 通过
数据库迁移:已应用 20251218121053_AddTenantQuotaUsageHistories
2025-12-18 20:19:33 +08:00

46 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using TakeoutSaaS.Domain.Tenants.Enums;
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 租户配额使用历史 DTO。
/// </summary>
public sealed record QuotaUsageHistoryDto
{
/// <summary>
/// 配额类型。
/// </summary>
public TenantQuotaType QuotaType { get; init; }
/// <summary>
/// 已使用值。
/// </summary>
public decimal UsedValue { get; init; }
/// <summary>
/// 限额值。
/// </summary>
public decimal LimitValue { get; init; }
/// <summary>
/// 记录时间UTC
/// </summary>
public DateTime RecordedAt { get; init; }
/// <summary>
/// 变更类型increase | decrease | init | snapshot。
/// </summary>
public string ChangeType { get; init; } = "snapshot";
/// <summary>
/// 变更量(可选)。
/// </summary>
public decimal? ChangeAmount { get; init; }
/// <summary>
/// 变更原因(可选)。
/// </summary>
public string? ChangeReason { get; init; }
}