diff --git a/budgit/server/services/CategoriesService.js b/budgit/server/services/CategoriesService.js index 56569f0..f4622d1 100644 --- a/budgit/server/services/CategoriesService.js +++ b/budgit/server/services/CategoriesService.js @@ -51,6 +51,7 @@ class CategoriesService { if (!category) { throw new BadRequest('category does not exist') } + // TODO this needs to reallocate all transactions under this category to unassigned category.remove() return category } diff --git a/budgit/server/services/TransactionsService.js b/budgit/server/services/TransactionsService.js index 1c14064..8c8c615 100644 --- a/budgit/server/services/TransactionsService.js +++ b/budgit/server/services/TransactionsService.js @@ -4,6 +4,9 @@ import { logger } from '../utils/Logger' class TransactionsService { async create(newTransaction) { + if (newTransaction.categoryId == '') { + newTransaction.categoryId = null + } const dbTransaction = await dbContext.Transactions.create(newTransaction) if (!dbTransaction) { throw new BadRequest("transaction does not exist")