fix
This commit is contained in:
@@ -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