Skip to content

Commit

Permalink
Fix leaking of history when budget is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
ParadoxZero committed Aug 4, 2024
1 parent 30b4587 commit 56d50d3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/services/db_service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ public async Task AddRecurringAsync(string budget_id, Recurring recurring)
public async Task DeleteBudgetAsync(string budget_id)
{
var user_data = await GetUserData(_identityService.GetUserIdentity());
var budget = await GetBudgetAsync(budget_id);
user_data.BudgetIds.Remove(budget_id);
await UpdateUserData(user_data);
await _container.DeleteItemAsync<Budget>(budget_id, new PartitionKey(budget_id));
await _container.DeleteItemAsync<BudgetHistory>(budget.history_id, new PartitionKey(budget.history_id));
}

public async Task<Budget> DeleteCategoryAsync(string budget_id, int category_id)
Expand Down

0 comments on commit 56d50d3

Please sign in to comment.