chore: add documentation comments and stylecop rules

This commit is contained in:
2025-12-04 11:25:01 +08:00
parent 17d143a351
commit 8e4c2b0e45
142 changed files with 1309 additions and 439 deletions

View File

@@ -15,25 +15,21 @@ public sealed class DeleteMerchantCommandHandler(
ILogger<DeleteMerchantCommandHandler> logger)
: IRequestHandler<DeleteMerchantCommand, bool>
{
private readonly IMerchantRepository _merchantRepository = merchantRepository;
private readonly ITenantProvider _tenantProvider = tenantProvider;
private readonly ILogger<DeleteMerchantCommandHandler> _logger = logger;
/// <inheritdoc />
public async Task<bool> Handle(DeleteMerchantCommand request, CancellationToken cancellationToken)
{
// 1. 校验存在性
var tenantId = _tenantProvider.GetCurrentTenantId();
var existing = await _merchantRepository.FindByIdAsync(request.MerchantId, tenantId, cancellationToken);
var tenantId = tenantProvider.GetCurrentTenantId();
var existing = await merchantRepository.FindByIdAsync(request.MerchantId, tenantId, cancellationToken);
if (existing == null)
{
return false;
}
// 2. 删除
await _merchantRepository.DeleteMerchantAsync(request.MerchantId, tenantId, cancellationToken);
await _merchantRepository.SaveChangesAsync(cancellationToken);
_logger.LogInformation("删除商户 {MerchantId}", request.MerchantId);
await merchantRepository.DeleteMerchantAsync(request.MerchantId, tenantId, cancellationToken);
await merchantRepository.SaveChangesAsync(cancellationToken);
logger.LogInformation("删除商户 {MerchantId}", request.MerchantId);
return true;
}