fix
This commit is contained in:
@@ -84,14 +84,18 @@ public class BudgetApplication(
|
||||
Limit = result.Month.Limit,
|
||||
Current = result.Month.Current,
|
||||
Remaining = result.Month.Limit - result.Month.Current,
|
||||
UsagePercentage = result.Month.Rate
|
||||
UsagePercentage = result.Month.Rate,
|
||||
Trend = result.Month.Trend,
|
||||
Description = result.Month.Description
|
||||
},
|
||||
Year = new BudgetStatsDetail
|
||||
{
|
||||
Limit = result.Year.Limit,
|
||||
Current = result.Year.Current,
|
||||
Remaining = result.Year.Limit - result.Year.Current,
|
||||
UsagePercentage = result.Year.Rate
|
||||
UsagePercentage = result.Year.Rate,
|
||||
Trend = result.Year.Trend,
|
||||
Description = result.Year.Description
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public record BudgetStatsDetail
|
||||
public decimal Current { get; init; }
|
||||
public decimal Remaining { get; init; }
|
||||
public decimal UsagePercentage { get; init; }
|
||||
public List<decimal?> Trend { get; init; } = [];
|
||||
public string Description { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,6 +17,7 @@ public interface ITransactionCategoryApplication
|
||||
Task<int> BatchCreateAsync(List<CreateCategoryRequest> requests);
|
||||
Task<string> GenerateIconAsync(GenerateIconRequest request);
|
||||
Task UpdateSelectedIconAsync(UpdateSelectedIconRequest request);
|
||||
Task DeleteIconAsync(long classificationId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -215,6 +216,25 @@ public class TransactionCategoryApplication(
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteIconAsync(long classificationId)
|
||||
{
|
||||
var category = await categoryRepository.GetByIdAsync(classificationId);
|
||||
if (category == null)
|
||||
{
|
||||
throw new NotFoundException("分类不存在");
|
||||
}
|
||||
|
||||
// 将 Icon 字段设置为 null
|
||||
category.Icon = null;
|
||||
category.UpdateTime = DateTime.Now;
|
||||
|
||||
var success = await categoryRepository.UpdateAsync(category);
|
||||
if (!success)
|
||||
{
|
||||
throw new BusinessException("删除图标失败");
|
||||
}
|
||||
}
|
||||
|
||||
private static CategoryResponse MapToResponse(TransactionCategory category)
|
||||
{
|
||||
return new CategoryResponse
|
||||
|
||||
Reference in New Issue
Block a user